Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .claude/commands/dream.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ $ARGUMENTS
verifiable bullet. If it fits no existing page, create a new
`topics/<slug>.md`, add cross-links, and add one row to `index.md`.
5. If a learning is really a session-governing rule (a do/don't policy or a
completion gate), propose it for `CLAUDE.md` and apply the edit.
completion gate), it belongs in `CLAUDE.md`. Show the proposed `CLAUDE.md` edit and
apply it **only after explicit confirmation** — `CLAUDE.md` is a core governing
prompt (it overrides every session), so it always needs confirmation, even for an
addition. Topic-page and index-row additions do not.
6. **Skills check.** Decide whether the learning is a *fact* or a *recurring
procedure*:
- A **fact** (gotcha, convention, command) → a topic page, as above.
Expand Down Expand Up @@ -83,6 +86,8 @@ $ARGUMENTS
- Never record temporary or branch-specific bugs, or one-time errors already fixed.
- Prefer appending; editing or removing an existing fact needs explicit user
confirmation. Adding a topic or an index row does not.
- Adding or changing a rule in `CLAUDE.md` (a core governing prompt), unlike adding a
topic-page fact, **always** needs explicit confirmation.
- Never auto-create, rewrite, or delete a command/skill. Propose it and act only on
confirmation. Updating `.claude/skills-index.md` rows additively is fine.
- Keep `index.md` to summaries + links; facts belong in topic pages.
Expand Down
18 changes: 11 additions & 7 deletions .claude/commands/fix-localhost.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,25 @@ Success criteria:
- No blocking browser console errors on initial load.
- No failed required network requests on initial load.
- Typecheck, lint, and relevant tests pass.
- Post-fix critic round has no blockers.
- Post-fix single-agent self-review has no blockers.

Procedure:

1. Run the dev server.
2. Open localhost with Chrome or Playwright MCP.
3. Capture the exact browser/terminal error.
4. Run this critic round:
- First-Time User Critic
- Frontend Architecture Critic
- QA / E2E Critic
- Regression Critic
4. As Lead Agent, self-review the failure inline through these four lenses — this
command is intentionally **single-agent**: do NOT fan out to the critic-panel
Workflow. (If a full critic round is warranted, invoke `/critic-round` separately.)
List each finding with severity + evidence:
- First-Time User
- Frontend Architecture
- QA / E2E
- Regression
5. Diagnose root cause.
6. Apply the smallest safe fix.
7. Re-test in browser.
8. Run typecheck, lint, and tests.
9. Run a post-fix critic round.
9. Repeat the single-agent self-review (step 4) after the fix; if the fix is
non-trivial, run `/critic-round` (the critic-panel Workflow) instead.
10. Summarize evidence.
54 changes: 54 additions & 0 deletions .claude/commands/improve-skills.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
description: Meta-critic pass over the project's OWN prompts, skills, and workflow orchestration — fan out one reviewer per quality lens, adversarially verify each finding, and PROPOSE edits to the core prompts. Never auto-applies; every change is confirmation-gated. Use periodically to let the system improve its own machinery, not just its facts.
argument-hint: [scope, e.g. "the loop workflows" | "all commands"]
disable-model-invocation: true
---

Run a **self-improvement pass over the system itself** — the custom prompts, skills,
and multi-agent orchestration that drive this project — not over product code. This
is the counterpart to `/dream`: `/dream` improves what the system *knows* (the wiki);
`/improve-skills` improves the *machinery that does the work* (the command and
workflow prompts), by dogfooding the same critic-panel pattern on our own config.

Scope:
$ARGUMENTS

## Procedure
1. **Run the meta-critic as a deterministic Workflow** — invoke the Workflow tool with
`scriptPath: .claude/workflows/improve-skills.js`,
`args: { "scope": "$ARGUMENTS" }` (optionally pass `args.targets` = a specific list
of files to scope the review). One reviewer per quality lens (clarity,
instruction-following risk, safety/gating, consistency/DRY, workflow DSL, routing)
runs in its own context, in parallel; a *separate* skeptic adversarially verifies
every blocker/important finding. Invoking Workflow here is expected.
2. The workflow returns `{ scope, targets, counts, applyReady, needsDesign, niceToHaves, refuted }`.
Render `applyReady` and `needsDesign` as a matrix and list `niceToHaves` separately:

| Lens | Severity | File | Finding | Evidence | Proposed edit | Edit verified safe? |
|---|---|---|---|---|---|---|

3. **Confirmation gate (hard rule).** This command may propose edits to core prompts
but must **never apply them without explicit confirmation** — the same rule
`/dream` follows for creating/rewriting skills. Present the proposed edits and ask
before touching any file.
4. After confirmation, apply only the approved `applyReady` edits (the ones whose
`editSafe` is true). Treat `needsDesign` findings (real problem, edit not verified
safe) as items needing a human-designed fix — surface them, don't auto-apply.
5. Do **not** weaken an instruction, remove a safety/confirmation gate, or delete a
command/skill as part of an "improvement". Removing or rewriting an existing rule
needs explicit confirmation; additive clarifications are lower-risk but still shown
before applying.
6. When an edit changes a command or workflow, keep `.claude/skills-index.md` and any
affected memory wiki page in sync (additive index updates need no confirmation).
Comment on lines +41 to +42
7. End the task with `/dream` so any durable lesson from this pass is filed into the
wiki.

## Notes
- Heavier, deterministic path: the workflow spawns ~6 meta-critics + one verifier per
blocker/important finding. That is intended — independent review of our own prompts,
not one context grading its own instructions.
- The verifier judges two things: is the problem **real**, and is the proposed edit
**safe** (would it weaken instruction-following or a safety gate, or break a
workflow?). Only real-and-safe findings are `applyReady`.
- `disable-model-invocation: true`: this command changes core prompts, so it is
manual-only — never auto-invoked from a description match.
1 change: 1 addition & 0 deletions .claude/commands/multi-agent-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Never mark complete unless:

- the flow works in browser
- no blocking console errors remain
- typecheck, lint, and unit tests pass (build passes when the change warrants it)
- relevant E2E tests pass
- post-implementation critic round has no blockers
- files changed are reported
Expand Down
3 changes: 2 additions & 1 deletion .claude/commands/write-goal.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ $ARGUMENTS
`.claude/memory/index.md` → the relevant topic page(s), so the prompt uses this
project's **real** commands, conventions, and gates — not generic ones.
2. If the task is broad or unclear, ask 1–2 sharp clarifying questions first, or
suggest running `/plan` and converting the plan into the goal.
first outline the plan inline (the steps + files it touches) and convert that
outline into the goal.
3. Produce a single, copy-pasteable prompt in a fenced block, grounded in this repo.

## A `/goal` must include all six
Expand Down
17 changes: 13 additions & 4 deletions .claude/loop.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ budget, denylist, escalation, stop conditions). Before running, fix the loop's
1. **Read state first:** open `.claude/memory/loop-run-log.md` (prior iterations,
outcomes, human overrides) and check **remaining budget** against the per-run cap
(turns or tokens — see *Budget & limits*) before doing anything; stop and
escalate if it is already exhausted.
2. Identify the current active task from the conversation.
escalate if it is already exhausted. **If no per-run cap was declared, default to
25 turns and record that you used the default** in the run-log entry.
2. Identify the current active task from the conversation or run-log. **If no active
task is identifiable, treat the watchlist as empty and self-stop (per *Stop when*)
rather than inventing a task.**
3. Check git status and changed files.
4. Start or reuse the dev server.
5. Open the relevant localhost page in Chrome or Playwright MCP.
Expand All @@ -28,7 +31,8 @@ budget, denylist, escalation, stop conditions). Before running, fix the loop's
Render the returned `confirmed` matrix.
8. **Maker/checker:** the pass that verifies a fix must be *separate* from the one
that made it — the implementer never marks its own work "done".
9. Act **only within the trust level**:
9. Act **only within the trust level** (**if no level was explicitly declared for
this run, treat it as L1 — never infer L2/L3 from context**):
- L1: record findings only.
- L2/L3: fix the confirmed blockers + directly-related important findings via the
**loop-iteration Workflow** (`.claude/workflows/loop-iteration.js`,
Expand All @@ -43,7 +47,12 @@ budget, denylist, escalation, stop conditions). Before running, fix the loop's
## Denylist — never touch autonomously (escalate instead)
Auth, payments, secrets/`.env`, infrastructure/deploy, CI workflow config, and
database migrations. Also: do not push, deploy, delete data, modify secrets, or
auto-merge without an explicit allowlist.
auto-merge without an explicit allowlist. **And the agent's own configuration and
prompt surface — `.claude/` (commands, workflows, `loop.md`, `loop-checklist.md`,
the memory wiki) and `CLAUDE.md`: a loop never self-modifies its own instructions
autonomously, even at L3 — propose and escalate instead** (this is enforced
deterministically by the `loop-iteration.js` denylist regex; the sanctioned path to
change the prompt surface is the manual, confirmation-gated `/improve-skills`).

## Escalate to a human (pause and ask) when
- A fix would touch a denylist path.
Expand Down
38 changes: 38 additions & 0 deletions .claude/memory/log.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,41 @@ change), `rotate` (archived old entries). Format: `## [YYYY-MM-DD] <op> | <summa
- Lesson: a maker/checker that hands the checker only the maker's self-report is
weak — give the checker the real artifact (diff). Exact-title dedup also let one
bug appear as two findings; merge, don't drop.

## [2026-06-29] ingest | Self-improvement axis: /improve-skills meta-critic
- The self-learning system improved only its *facts* (the wiki via `/dream`), not its
*own prompts/workflows*. Added `/improve-skills` (`.claude/workflows/improve-skills.js`
+ `.claude/commands/improve-skills.md`): a per-lens meta-critic (clarity,
instruction-following risk, safety/gating, consistency/DRY, workflow DSL, routing)
over the project's OWN command/workflow/instruction surface, with a separate skeptic
verifying each finding on two axes (problem **real** + edit **safe**). Returns
proposed edits only — confirmation-gated, `disable-model-invocation: true`.
- Wired into CLAUDE.md (workflow list + "self-improvement vs self-learning" note),
skills-index, and topics/workflow.md. Filed the two-axis principle there.

## [2026-06-29] ingest | First /improve-skills run found a self-modification gap
- Dogfooded `/improve-skills` (25 agents, 6 lenses): 2 blockers + 10 important
confirmed, 7 refuted (the two-axis verifier rejected 3 "improvements" that would
have *weakened* a gate — proof the editSafe axis works). Applied 7 fixes:
- **Self-modification guard (blocker):** the autonomous-loop denylist protected only
product/infra paths, so an L2/L3 loop could rewrite its OWN governing prompts.
Added `.claude/` + `CLAUDE.md` to the `loop-iteration.js` regex gate AND the
`loop.md` prose denylist. The sanctioned path to edit prompts is the manual,
confirmation-gated `/improve-skills`.
- `/dream`: gated `CLAUDE.md` edits behind explicit confirmation (was "propose and
apply" — contradicted its own Hard rules); added the matching Hard rule.
- `CLAUDE.md`: added "commit/push only when the user asks" (settings pre-allow
`git commit`, but no rule said not to commit unprompted).
- `loop.md`: fail-safe defaults — unstated per-run cap → 25 turns, unstated trust
level → L1 at the action step, no identifiable task → self-stop (don't invent one).
- `fix-localhost`: made its single-agent intent explicit (it was naming a critic
panel inline, which CLAUDE.md says must be a Workflow / is single-agent).
- `multi-agent-dev`: its "never mark complete unless" gate omitted
typecheck/lint/unit/build that CLAUDE.md requires — added them.
- `write-goal` + `CLAUDE.md`: removed the dangling `/plan` reference (no such repo
command) → "outline the plan inline".
- Hardened `improve-skills.js` to parse a JSON-string `args` (a command may pass
args as a string; was leaking the raw JSON into `scope`).
- Lesson: a self-improving system MUST add its own prompt surface (`.claude/`,
`CLAUDE.md`) to every autonomous denylist — otherwise the loop can edit the rules
that constrain it. The meta-critic caught this in its own machinery on the first run.
21 changes: 19 additions & 2 deletions .claude/memory/topics/workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,28 @@
`.claude/workflows/`, not one agent simulating critics: `critic-panel` (critics →
adversarial verify → matrix), `scan-docs` (per-story evidence → status verifier),
`gap-analysis` (per-dimension gaps → synth order), `e2e-design` (per-category
cases → dedup), `loop-iteration` (worktree implementer → separate verifier).
Commands invoke them via the Workflow tool (the sanctioned opt-in). Name a workflow
cases → dedup), `loop-iteration` (worktree implementer → separate verifier),
`improve-skills` (per-lens meta-critic over our OWN prompts/workflows → proposed
edits, confirmation-gated). Commands invoke them via the Workflow tool (the
sanctioned opt-in). Name a workflow
distinctly from any command (e.g. `critic-panel` vs the `/critic-round` command) to
avoid a duplicate skills-list entry. Don't force non-fan-out commands
(`/fix-localhost`, `/write-goal`, `/dream`, `/memory-audit`) into workflows.
- **Self-improvement vs self-learning (two axes).** `/dream` improves what the system
*knows* (curates the memory wiki — facts); `/improve-skills` improves the *machinery*
(a meta-critic Workflow that reviews the project's OWN command/workflow prompts and
proposes tightenings). Both are confirmation-gated: never auto-create, rewrite, or
delete a command/skill, and never weaken an instruction or remove a safety gate as
an "improvement". `/improve-skills` is `disable-model-invocation: true` (manual-only)
because it edits core prompts; its verifier judges a finding on *two* axes — is the
problem **real** and is the proposed edit **safe** (won't weaken instruction-following
or break a workflow) — and only real-and-safe findings are `applyReady`.
- **A self-improving system must add its OWN prompt surface to every autonomous
denylist.** The loop's deterministic gate (`loop-iteration.js` DENYLIST) and prose
denylist (`loop.md`) both include `.claude/` and `CLAUDE.md`, so an L2/L3 loop can
never autonomously rewrite the rules that constrain it — it escalates instead. The
only sanctioned way to change the prompt surface is the manual, confirmation-gated
`/improve-skills`. (Found by the first `/improve-skills` run, on its own machinery.)
- Workflow scripts use a DSL (`agent()/parallel()/pipeline()/phase()`, top-level
`await`/`return`); validate syntax by wrapping the body in `async function(){…}`
before `node --check` (bare `node --check` reports a false "illegal return").
Expand Down
5 changes: 4 additions & 1 deletion .claude/skills-index.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ catalog so both you and Claude can route to the right command.
- **Map what's built vs documented vs tested** → `/scan-project-docs`, then
`/sync-story-status`, `/story-gap-analysis`
- **Capture/curate what was learned** → `/dream`, `/memory-audit`
- **Improve the system's own prompts/skills/workflows** → `/improve-skills`
- **Keep watching localhost on an interval** → `/loop` (uses `.claude/loop.md`;
gate trust level with `.claude/loop-checklist.md`, state in
`.claude/memory/loop-run-log.md`)
Expand All @@ -32,7 +33,8 @@ catalog so both you and Claude can route to the right command.
> (parallel subagents + adversarial/maker-checker verification), invoked via the
> Workflow tool — not one agent simulating critics: `critic-panel` (critic rounds),
> `scan-docs` (`/scan-project-docs`), `gap-analysis` (`/story-gap-analysis`),
> `e2e-design` (`/multi-agent-e2e`), `loop-iteration` (`/loop` L2/L3).
> `e2e-design` (`/multi-agent-e2e`), `loop-iteration` (`/loop` L2/L3),
> `improve-skills` (`/improve-skills` — meta-critic over our own prompts/workflows).

| Command | When to use | Args |
|---|---|---|
Expand All @@ -55,6 +57,7 @@ catalog so both you and Claude can route to the right command.
|---|---|---|
| `/dream` | End of a non-trivial task: ingest durable learnings into the wiki, lint it, and propose new skills | `[ingest \| query <q> \| lint]` |
| `/memory-audit` | Periodically prune stale/duplicated/misleading memory (no deletes without confirmation) | — |
| `/improve-skills` | Periodically improve the system's OWN prompts/skills/workflows via a meta-critic; proposes edits, confirmation-gated (manual-only) | `[scope]` |

## Conventions for adding a command
- Every command needs a one-line `description` frontmatter (used for routing) and,
Expand Down
Loading
Loading