refactor(skills): cap every SKILL.md at 600 words and cut agent messages
Every loaded SKILL.md and every listed description is paid on every turn of every session, and every delivered message costs its recipient a full turn. scripts/budget.py gains SKILL_WORDS = 600, enforced by test_lock, and test_naming forbids a skill naming its own slash command; 53 descriptions and 10 body lines drop it. The 18 longest skills move details into 31 side files read only in their situation (organize's capacity, succession, peers, offices, relay and lineage; cleanup's docker, worktrees, execute and ask; code-tune, changelog, triage, dream, split and others), so all SKILL.md files shrink from 33866 to 26291 words without dropping a rule; an independent review of HEAD against the new text found no loss in 60 of 64 skills and three weakenings, now restored (WSJF re-estimates after an objective change, cleanup's volume checklist, essence's absolute dates). The kvb-org-organize Peer protocol sends status that asks nothing to the news board, answers nothing that asks nothing, keeps messages terse, and lets light runs admit themselves in the operator's wording; the skills follow it (operator reads the register, relax and wakeup reply through the news, evening collects them there, wsjf asks only for missing estimates, cleanup and triage batch their questions). Skills that explore code ask the codebase-memory-mcp graph first, subagent briefs scale with the stakes and cap their answers, and the skills that need the full register or council tables call show --wide or list --long. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
34b434a744
commit
3c2f6c44b5
99 files changed
+2110
-2086
No files matched your search
+59
-121
@@ -2,152 +2,90 @@
|
||||
name: kvb-dream
|
||||
description: >
|
||||
Process the last 24 hours of every repository and session: memory,
|
||||
improvements, kvb-optimize, cleanups. Trigger on /kvb-dream or a request
|
||||
to learn from recent work.
|
||||
improvements, kvb-optimize, cleanups. Trigger on a request to learn from
|
||||
recent work.
|
||||
---
|
||||
|
||||
Sleep on the work: replay what happened, separate what held from what broke,
|
||||
keep only the conclusions that survive an attack, then optimize and clean up.
|
||||
Dreaming processes everything. A dream that flatters the dreamer is worthless —
|
||||
an unverified success counts as unknown, not as a win.
|
||||
Replay what happened, separate what held from what broke, keep only
|
||||
conclusions that survive an attack, then optimize and clean up.
|
||||
|
||||
## Objective
|
||||
|
||||
The dream exists to raise the confidence of every future run until the
|
||||
mistakes it found cannot happen again. Judge every finding, memory
|
||||
entry, and proposal by one question: does it make the next run measurably less
|
||||
likely to repeat this failure? What changes nothing about future behaviour is
|
||||
not worth recording.
|
||||
|
||||
A class of error counts as closed only when something structural prevents it —
|
||||
a test, a lint rule, a CI check, a hook, a written rule in the agent
|
||||
instructions, or a skill. "Be more careful next time" closes nothing. Report the
|
||||
confidence the next run can now hold on each closed class, calibrated as the
|
||||
Make the next run measurably less likely to repeat each failure found; what
|
||||
changes no future behaviour is not recorded. An error class is closed only by
|
||||
something structural (test, lint rule, CI check, hook, written rule in the
|
||||
agent instructions, skill), never by "be more careful". Per closed class,
|
||||
report the confidence the next run can hold, calibrated as the
|
||||
`kvb-check-confidence` skill requires, and name what is still open.
|
||||
|
||||
## Scope
|
||||
|
||||
Every repository and session this agent touched in the window: the
|
||||
repositories named by its session transcripts (working directories and
|
||||
worktrees), by the workdirs of its `kvb-org-rasci` register tasks, and the
|
||||
current one. The default window is the last 24 hours — the operator may widen
|
||||
it (`/kvb-dream 7d`). State the repositories and the window in one table before
|
||||
you start. Each repository is recalled and scored on its own; a finding goes
|
||||
into the memory of the project it concerns, never mixed with another's.
|
||||
|
||||
Run only when the operator asks. Two hints point at it, neither is a trigger:
|
||||
`hooks/reminder.sh` tells each agent at most once every twelve hours (stamped
|
||||
per session in `~/.claude/.dream-stamps/`), and the `kvb-dream-notify.timer`
|
||||
user timer shows a GNOME notification daily at 17:00 local time, catching up
|
||||
once after a missed run. Print the hint and continue with the actual request.
|
||||
Every repository and session this agent touched in the window: its
|
||||
transcripts' working directories and worktrees, its `kvb-org-rasci` task
|
||||
workdirs, the current one. Window: 24 hours, or wider on request (`7d` after
|
||||
the command). State both in one table first. Recall and score each repository
|
||||
on its own; a finding goes only into its own project's memory. Run only when
|
||||
the operator asks; read `hints.md` next to this file when a hint appears or
|
||||
before changing the reminder.
|
||||
|
||||
## Step 1: recall
|
||||
|
||||
Gather the window's actual record per repository, not your recollection of it:
|
||||
The actual record per repository, not your recollection:
|
||||
|
||||
- **History**: `git log --since` across all branches plus `--reflog`, with
|
||||
`--stat`; the reflog carries the resets, rebases, and amends the log hides.
|
||||
- **Working state**: `git status`, the staged and unstaged diff, stashes.
|
||||
- **CI**: the runs created in the window, their conclusions, and the failing
|
||||
logs of the red ones — the failing log line, not the job title.
|
||||
- **Reviews**: pull requests and issues touched in the window, and the review
|
||||
comments on them.
|
||||
- **Register**: the `kvb-org-rasci` register: `rasci.py tools` ranks the
|
||||
scripts and tools the window's tasks ran, the refactoring candidates;
|
||||
`get <task>` shows a task's objective, roles, workdir and artifacts.
|
||||
- **Memory**: each project's memory directory and its `MEMORY.md` index — the
|
||||
findings already recorded, so the dream extends them instead of repeating them.
|
||||
- **Instructions**: `CLAUDE.md`, `AGENTS.md`, and the project's own skills, to
|
||||
see which rule a mistake actually violated.
|
||||
- **Sessions**: the readable session transcripts touched in the window, for the
|
||||
operator corrections that never reached a commit.
|
||||
- **History**: `git log --since` over all branches plus `--reflog` (resets,
|
||||
rebases, amends), with `--stat`.
|
||||
- **Working state**: `git status`, staged and unstaged diff, stashes.
|
||||
- **CI**: the window's runs, conclusions, and each red run's failing log line,
|
||||
not the job title.
|
||||
- **Reviews**: pull requests and issues touched, with review comments.
|
||||
- **Register**: `rasci.py tools` ranks the tools the tasks ran (refactoring
|
||||
candidates); `get <task>` shows objective, roles, workdir, artifacts.
|
||||
- **Memory**: each project's memory directory and `MEMORY.md`, to extend
|
||||
recorded findings instead of repeating them.
|
||||
- **Instructions**: `CLAUDE.md`, `AGENTS.md`, the project's skills: which rule
|
||||
a mistake violated.
|
||||
- **Sessions**: readable transcripts, for operator corrections that never
|
||||
reached a commit.
|
||||
|
||||
## Step 2: score
|
||||
|
||||
Classify every action in the window, each with its evidence (`sha`, `file:line`,
|
||||
run id):
|
||||
Every action, with evidence (`sha`, `file:line`, run id):
|
||||
|
||||
- **Held** — shipped and still proven: green CI, a passing test that covers it,
|
||||
no revert, no follow-up fix.
|
||||
- **Broke** — reverted, amended, hot-fixed by a later commit, red CI, or
|
||||
corrected by the operator. A failure that ended green is still a failure; count
|
||||
the detour, not only the destination.
|
||||
- **Unknown** — no verification exists either way. Unknown is a finding in its
|
||||
own right, never a quiet pass.
|
||||
- **Held**: shipped and still proven: green CI, a passing test covering it, no
|
||||
revert, no follow-up fix.
|
||||
- **Broke**: reverted, amended, hot-fixed later, red CI, or corrected by the
|
||||
operator; ending green does not undo the failed first attempt.
|
||||
- **Unknown**: no verification either way, so no win; a finding of its own,
|
||||
never a quiet pass.
|
||||
|
||||
## Step 3: hypothesize
|
||||
## Steps 3 to 6: findings
|
||||
|
||||
Turn the scored record into falsifiable hypotheses, each written as *cause →
|
||||
predicted consequence → what would disprove it*. Take a pattern (two or more
|
||||
occurrences) or a single expensive failure; drop the one-off noise. A hypothesis
|
||||
that nothing could disprove is not a hypothesis — cut it.
|
||||
|
||||
## Step 4: dialectic
|
||||
|
||||
Put every surviving hypothesis through the `kvb-think-dialectic` skill: thesis,
|
||||
independent skeptics, synthesis, iterated to ~99%. What survives becomes a
|
||||
finding. What gets refuted is recorded as discarded **with the refutation**, so
|
||||
the next dream does not re-derive it.
|
||||
|
||||
## Step 5: write memory
|
||||
|
||||
Persist the findings in the memory directory of the project they concern: one file per fact, one
|
||||
pointer line in `MEMORY.md`. Update the file that already covers a fact instead
|
||||
of adding a duplicate, and delete the memories this run disproved. Absolute
|
||||
dates, never "yesterday". Nothing that the repository already records — code
|
||||
structure, git history, `CLAUDE.md` — belongs in memory.
|
||||
|
||||
## Step 6: offer the improvements
|
||||
|
||||
Two kinds come out of the findings:
|
||||
|
||||
- **Code** — the change to the affected repository's source, tests, config, or CI that
|
||||
the finding calls for.
|
||||
- **Agent instructions** — the missing or wrong rule in `CLAUDE.md`,
|
||||
`AGENTS.md`, the project's own skills, or the contributor docs. Every mistake
|
||||
the agent repeated in the window is a candidate: quote the line that failed to
|
||||
prevent it, or name the rule that is absent, and propose the exact wording.
|
||||
|
||||
Ask for each one with `AskUserQuestion` and `multiSelect: false` so it renders
|
||||
as radio buttons: the improvement, the evidence behind it, and the options
|
||||
`Apply now`, `Record as a task`, `Skip`. Ranked by evidence, one question per
|
||||
improvement. No repository file changes before an answer comes back.
|
||||
When the record holds a pattern or an expensive failure, read
|
||||
`hypotheses.md` next to this file. Offer each improvement, ranked by
|
||||
evidence, in its own `AskUserQuestion` with `multiSelect: false`: `Apply
|
||||
now`, `Record as a task`, `Skip`.
|
||||
|
||||
## Step 7: optimize
|
||||
|
||||
With the dialectic done and memory written, run the `kvb-optimize` skill and
|
||||
hand it this run's findings as its evidence, so none of its skills
|
||||
re-collects them. Its pass includes the `kvb-transcend` skill, which carries
|
||||
the scripts, tests and skills of every session in scope into their
|
||||
repositories.
|
||||
Run the `kvb-optimize` skill with this run's findings as its evidence, so none
|
||||
of its skills re-collects them; its `kvb-transcend` pass carries every
|
||||
in-scope session's scripts, tests and skills into their repositories.
|
||||
|
||||
## Step 8: clean up
|
||||
|
||||
Run the `kvb-cleanup` skill for the disk, `/tmp`, Docker and agent
|
||||
directories the window filled, with the artifacts of the window's finished
|
||||
register tasks (`rasci.py artifacts --ended`) as its candidates, then the
|
||||
`kvb-git-branch-gc` skill for the merged branches and worktrees of every
|
||||
repository in scope.
|
||||
|
||||
Every skill in steps 7 and 8 keeps its own confirmation steps; the dream never
|
||||
writes, deletes or commits on their behalf. Close the run by refreshing this
|
||||
agent's reminder stamp, so its next hint is twelve hours out:
|
||||
`date +%s > ~/.claude/.dream-stamps/"$CLAUDE_CODE_SESSION_ID"`.
|
||||
The `kvb-cleanup` skill for the disk, `/tmp`, Docker and agent directories the
|
||||
window filled, with the finished tasks' artifacts (`rasci.py artifacts
|
||||
--ended`) as candidates; then the `kvb-git-branch-gc` skill for every
|
||||
in-scope repository's merged branches and worktrees. Each keeps its own
|
||||
confirmations; the dream never writes, deletes or commits for them. Close
|
||||
with `date +%s > ~/.claude/.dream-stamps/"$CLAUDE_CODE_SESSION_ID"`, so the
|
||||
next hint is twelve hours out.
|
||||
|
||||
## Rules
|
||||
|
||||
- Evidence or unknown: a claim about what held needs a green signal, and its
|
||||
absence is reported as unknown rather than assumed.
|
||||
- Honest scoring: reverts, amends, and follow-up fixes are failures of the first
|
||||
attempt even when the final state is green.
|
||||
- Read-only until step 6: the dream inspects, and writes memory; repository code
|
||||
changes only on an explicit radio answer.
|
||||
- An empty window is a valid result — report "nothing in the last 24 hours" per
|
||||
repository and skip it. Never invent activity to have something to dream
|
||||
about.
|
||||
- Prefer the structural fix over the remembered one: a test, check, hook, or
|
||||
written rule that makes the error impossible beats a memory entry that only
|
||||
reminds you of it.
|
||||
- Report the whole ledger: held, broke, unknown, the surviving findings, the
|
||||
refuted hypotheses with why they fell, and the confidence each closed error
|
||||
class now carries into the next run.
|
||||
- Read-only until step 6: the dream writes memory; repository code changes
|
||||
only on an explicit radio answer.
|
||||
- An empty window is valid: report "nothing in the last 24 hours" per
|
||||
repository and skip it; never invent activity.
|
||||
- Report the whole ledger: held, broke, unknown, surviving findings, refuted
|
||||
hypotheses with why they fell.
|
||||
@@ -0,0 +1,10 @@
|
||||
# Dream hints
|
||||
|
||||
Two hints point at the dream; neither is a trigger:
|
||||
|
||||
- `hooks/reminder.sh` tells each agent at most once every twelve hours,
|
||||
stamped per session in `~/.claude/.dream-stamps/`.
|
||||
- The `kvb-dream-notify.timer` user timer shows a GNOME notification daily at
|
||||
17:00 local time, catching up once after a missed run.
|
||||
|
||||
On a hint, print it and continue with the actual request.
|
||||
@@ -0,0 +1,41 @@
|
||||
# From scored record to improvements
|
||||
|
||||
## Step 3: hypothesize
|
||||
|
||||
A pattern (two or more occurrences) or a single expensive failure becomes a
|
||||
falsifiable hypothesis: *cause → predicted consequence → what would disprove
|
||||
it*. Drop one-off noise; cut a hypothesis nothing could disprove.
|
||||
|
||||
## Step 4: dialectic
|
||||
|
||||
Every surviving hypothesis goes through the `kvb-think-dialectic` skill to
|
||||
~99%. Scale the skeptics to the stakes: one for a memory fact, more for a rule
|
||||
or code change. Each brief names the exact files, commits or log lines and the
|
||||
one claim to attack, and caps the answer at ten lines. Survivors become
|
||||
findings; refuted ones are recorded as discarded **with the refutation**, so
|
||||
the next dream does not re-derive them.
|
||||
|
||||
## Step 5: write memory
|
||||
|
||||
In the memory directory of the project concerned: one file per fact, one
|
||||
pointer line in `MEMORY.md`. Update the file covering a fact instead of adding
|
||||
a duplicate; delete memories this run disproved. Absolute dates, never
|
||||
"yesterday". Nothing the repository already records (code structure, git
|
||||
history, `CLAUDE.md`).
|
||||
|
||||
## Step 6: the improvements
|
||||
|
||||
- **Code**: the change to the repository's source, tests, config or CI the
|
||||
finding calls for.
|
||||
- **Agent instructions**: the missing or wrong rule in `CLAUDE.md`,
|
||||
`AGENTS.md`, the project's skills or contributor docs. Every mistake repeated
|
||||
in the window is a candidate: quote the line that failed to prevent it or
|
||||
name the absent rule, and propose the exact wording.
|
||||
|
||||
Prefer the structural fix (test, check, hook, written rule) that makes the
|
||||
error impossible over a memory entry that only reminds. Each question carries
|
||||
the improvement and its evidence.
|
||||
|
||||
A finding on a live peer's line goes to it as
|
||||
`${CLAUDE_SKILL_DIR}/../kvb-org-organize/scripts/news.py post "<finding>" --to
|
||||
<name>`; `SendMessage` only when the peer must act or answer.
|
||||
Reference in new issue
Block a user