From 842cea09cc29e21ab607c6b641761360f3ef775b Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 29 Jun 2026 20:30:18 +0000 Subject: [PATCH 1/2] Add /improve-skills: meta-critic that improves the system's own prompts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The self-learning system improved only its facts (the memory wiki via /dream), not the core prompts and orchestration that drive the work. Add the missing self-improvement axis. - .claude/workflows/improve-skills.js — a deterministic meta-critic that fans out one reviewer per quality lens (clarity, instruction-following risk, safety/gating, consistency/DRY, workflow DSL, routing) across the project's OWN command/workflow/instruction surface, then a SEPARATE skeptic adversarially verifies each blocker/important finding on two axes: is the problem real, and is the proposed edit safe (won't weaken instruction-following or break a workflow). Returns proposed edits only; never writes files. - .claude/commands/improve-skills.md — invokes the workflow, renders the matrix, and applies edits ONLY on confirmation. disable-model-invocation (manual-only) because it edits core prompts. - Wired into CLAUDE.md (workflow list + a "self-improvement vs self-learning" note), skills-index, and the memory wiki. Both axes stay confirmation-gated: never auto-create, rewrite, or delete a command/skill, and never weaken an instruction or remove a safety gate as an "improvement". Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_014xUCrJdREvUMjoVzSX5T8G --- .claude/commands/improve-skills.md | 54 ++++++++++ .claude/memory/log.md | 11 ++ .claude/memory/topics/workflow.md | 15 ++- .claude/skills-index.md | 5 +- .claude/workflows/improve-skills.js | 151 ++++++++++++++++++++++++++++ CLAUDE.md | 8 ++ 6 files changed, 241 insertions(+), 3 deletions(-) create mode 100644 .claude/commands/improve-skills.md create mode 100644 .claude/workflows/improve-skills.js diff --git a/.claude/commands/improve-skills.md b/.claude/commands/improve-skills.md new file mode 100644 index 0000000..c919438 --- /dev/null +++ b/.claude/commands/improve-skills.md @@ -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). +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. diff --git a/.claude/memory/log.md b/.claude/memory/log.md index 740f361..4766b84 100644 --- a/.claude/memory/log.md +++ b/.claude/memory/log.md @@ -113,3 +113,14 @@ change), `rotate` (archived old entries). Format: `## [YYYY-MM-DD] | (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 | |---|---|---| @@ -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 \| 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, diff --git a/.claude/workflows/improve-skills.js b/.claude/workflows/improve-skills.js new file mode 100644 index 0000000..21650dd --- /dev/null +++ b/.claude/workflows/improve-skills.js @@ -0,0 +1,151 @@ +export const meta = { + name: 'improve-skills', + description: + "Deterministic meta-critic over the project's OWN prompts and orchestration: fan out one reviewer per quality lens across the command/workflow/instruction surface (.claude/commands/*.md, .claude/workflows/*.js, CLAUDE.md, skills-index, loop files), adversarially verify each blocker/important finding with a separate skeptic, and return PROPOSED edits. The caller applies them only on confirmation — this workflow never writes files.", + phases: [ + { title: 'Review', detail: 'one meta-critic per lens reviews the prompt/workflow surface' }, + { title: 'Verify', detail: 'a separate skeptic refutes each finding AND its proposed edit' }, + ], +} + +// Optional focus note + explicit target list, passed via the Workflow `args`. +const scope = + (args && (args.scope || (typeof args === 'string' ? args : null))) || + 'all custom prompts, skills, and workflow orchestration in this repo' +// The default prompt surface to review. Callers can pass args.targets to scope it. +const DEFAULT_TARGETS = [ + '.claude/commands/*.md', + '.claude/workflows/*.js', + 'CLAUDE.md', + '.claude/skills-index.md', + '.claude/memory/index.md', + '.claude/loop.md', + '.claude/loop-checklist.md', +] +const targets = (args && Array.isArray(args.targets) && args.targets.length ? args.targets : DEFAULT_TARGETS) +const targetList = targets.join(', ') + +// Meta-critic lenses — each reviews the SYSTEM'S OWN instructions, not product code. +// `code: true` lenses focus on the workflow .js orchestration; the rest on prose prompts. +const LENSES = [ + { key: 'clarity', code: false, label: 'Clarity & Actionability Critic', lens: 'Is every instruction unambiguous and written as an imperative the agent will actually follow? Flag vague/hedged steps, undefined terms, missing acceptance criteria, and steps with no checkable outcome.' }, + { key: 'instruction-following', code: false, label: 'Instruction-Following Risk Critic', lens: 'Where would an LLM plausibly misread, skip, or over-comply? Conflicting directives, a critical rule buried mid-paragraph, ambiguous ordering, "should" where "must" is meant, or prompts so long the key constraint is lost.' }, + { key: 'safety-gating', code: false, label: 'Safety & Gating Critic', lens: 'Are destructive or auto-applied actions properly confirmation-gated and denylist-aware? Flag any prompt that could auto-create/rewrite/delete files, commit/push, or self-modify core prompts WITHOUT an explicit confirmation gate. This is the most important lens for a self-improving system.' }, + { key: 'consistency-dry', code: false, label: 'Consistency & DRY Critic', lens: 'Contradictions or duplication ACROSS CLAUDE.md, the commands, skills-index.md, and the memory wiki. Flag facts/lists stated in multiple places that can drift apart (single-source-of-truth risk), and any command whose body contradicts CLAUDE.md or the wiki.' }, + { key: 'workflow-dsl', code: true, label: 'Workflow DSL & Schema Critic', lens: 'For .claude/workflows/*.js only: fail-safe verifiers (a null/failed verdict must NOT confirm), unique agent labels that include the map index, guarded first pipeline stage before deref, fail-closed defaults, maker/checker given the REAL artifact (not a self-report), valid JSON Schemas, and a meta block that is a pure literal. Flag deviations.' }, + { key: 'routing', code: false, label: 'Routing & Discoverability Critic', lens: 'Does each command have a one-line description (for model routing) and a matching skills-index row? Flag near-duplicate commands, dead index rows, missing argument-hints, and heavy/code-changing commands that lack disable-model-invocation where they should be manual-only.' }, +] + +const FINDINGS_SCHEMA = { + type: 'object', + additionalProperties: false, + required: ['findings'], + properties: { + findings: { + type: 'array', + items: { + type: 'object', + additionalProperties: false, + required: ['severity', 'file', 'title', 'evidence', 'proposedEdit'], + properties: { + severity: { type: 'string', enum: ['blocker', 'important', 'nice-to-have'] }, + file: { type: 'string', description: 'the prompt/workflow file the finding is about (path), or "(cross-file)"' }, + title: { type: 'string' }, + evidence: { type: 'string', description: 'concrete quote or file:line from the prompt being reviewed' }, + proposedEdit: { type: 'string', description: 'the concrete change to make — what to change to what (before → after), specific enough for the caller to apply' }, + }, + }, + }, + }, +} + +const VERDICT_SCHEMA = { + type: 'object', + additionalProperties: false, + required: ['real', 'editSafe', 'reason'], + properties: { + real: { type: 'boolean', description: 'true if the problem is genuine after trying to refute it' }, + editSafe: { type: 'boolean', description: 'true if the proposed edit is a real improvement that would NOT weaken instruction-following, safety gating, or break the workflow' }, + reason: { type: 'string' }, + }, +} + +// Phase 1 — every meta-critic reviews the prompt surface independently, in parallel +// (a barrier: we want the full set before deduping and verifying). +phase('Review') +const reviews = await parallel( + LENSES.map((c) => () => + agent( + `You are the **${c.label}** auditing this project's OWN Claude Code configuration — its custom prompts, skills, and multi-agent orchestration. You are NOT reviewing product/application code; you are reviewing the instructions that drive the agent.\n\nRead these files (the prompt surface): ${targetList}\n${c.code ? 'Focus on the workflow orchestration scripts (.claude/workflows/*.js).' : 'Focus on the prose prompts (commands, CLAUDE.md, skills-index, loop files).'}\n\nReview strictly through your lens:\n${c.lens}\n\nScope: ${scope}\n\nFor each issue return concrete evidence (a quote or file:line) AND a specific proposedEdit (what to change to what). Propose improvements to the prompts/workflows themselves — do not propose product-code changes. An empty list is a valid, honest answer.`, + { label: `meta:${c.key}`, phase: 'Review', schema: FINDINGS_SCHEMA }, + ).then((r) => ({ critic: c.key, label: c.label, findings: (r && r.findings) || [] })), + ), +) + +// Flatten, then dedup on (severity + file + exact normalized title). On a collision, +// MERGE (keep the corroborating critic + evidence) rather than dropping — two critics +// agreeing is a stronger signal, not a duplicate. +const all = reviews + .filter(Boolean) + .flatMap((r) => r.findings.map((f) => ({ ...f, critic: r.critic, criticLabel: r.label }))) +const byKey = new Map() +for (const f of all) { + const k = `${f.severity}::${String(f.file || '').trim().toLowerCase()}::${String(f.title || '').trim().toLowerCase()}` + const existing = byKey.get(k) + if (existing) { + existing.alsoFlaggedBy = existing.alsoFlaggedBy || [] + existing.alsoFlaggedBy.push({ critic: f.critic, evidence: f.evidence }) + } else { + byKey.set(k, { ...f }) + } +} +const deduped = [...byKey.values()] +log(`${deduped.length} findings from ${LENSES.length} meta-critics (${all.length} before merge-dedup)`) + +// Phase 2 — adversarially verify each blocker/important finding with a SEPARATE +// skeptic. It must refute BOTH that the problem is real AND that the proposed edit is +// a safe improvement (so we never "improve" a prompt into being weaker or less safe). +phase('Verify') +const toVerify = deduped.filter((f) => f.severity === 'blocker' || f.severity === 'important') +const verified = await parallel( + toVerify.map((f, i) => () => + agent( + `You are a SEPARATE skeptic (not the critic who raised this). Read the actual file and try to REFUTE this ${f.severity} finding about the project's own prompts/workflows.\n\nJudge two things independently:\n1. real — is the problem genuine? Default real:false if the evidence does not hold up.\n2. editSafe — would the proposed edit be a real improvement that does NOT weaken instruction-following, remove a safety/confirmation gate, or break a workflow? Default editSafe:false if you cannot confirm it is safe.\n\nFile: ${f.file}\nTitle: ${f.title}\nEvidence: ${f.evidence}\nProposed edit: ${f.proposedEdit}`, + { label: `verify:${f.critic}:${i}`, phase: 'Verify', schema: VERDICT_SCHEMA }, + ).then((v) => ({ + ...f, + // Fail safe: a missing/failed verdict must NOT confirm the finding or its edit. + real: v ? v.real : false, + editSafe: v ? v.editSafe : false, + verifyReason: (v && v.reason) || 'verifier returned no verdict — not confirmed', + })), + ), +) + +const niceToHaves = deduped.filter((f) => f.severity === 'nice-to-have') +const settled = verified.filter(Boolean) +// Actionable = the problem is real. `applyReady` additionally requires the edit to be +// verified safe — the caller applies those first and treats real-but-not-editSafe +// findings as "needs a human-designed fix". +const confirmed = settled.filter((f) => f.real !== false) +const applyReady = confirmed.filter((f) => f.editSafe === true) +const needsDesign = confirmed.filter((f) => f.editSafe !== true) +const refuted = settled.filter((f) => f.real === false) + +return { + scope, + targets, + counts: { + lenses: LENSES.length, + confirmedBlockers: confirmed.filter((f) => f.severity === 'blocker').length, + confirmedImportant: confirmed.filter((f) => f.severity === 'important').length, + applyReady: applyReady.length, + needsDesign: needsDesign.length, + niceToHave: niceToHaves.length, + refuted: refuted.length, + }, + applyReady, // real problem + verified-safe edit → caller proposes these for confirmation + needsDesign, // real problem, edit not confirmed safe → needs a human-designed fix + niceToHaves, // recorded only, not verified + refuted, // a skeptic could not substantiate these +} diff --git a/CLAUDE.md b/CLAUDE.md index a183267..165fbd9 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -138,11 +138,19 @@ multi-agent opt-in: - `e2e-design.js` — per-category E2E case enumeration → dedup (`/multi-agent-e2e`). - `loop-iteration.js` — worktree implementer → separate verifier per item (`/loop` at L2/L3). +- `improve-skills.js` — per-lens meta-critic over the project's OWN prompts and + workflows → adversarial verify → proposed edits (`/improve-skills`). This is heavier (many subagents) by design; it buys genuine independent review instead of one context role-playing the panel. Commands that don't fan out (`/fix-localhost`, `/write-goal`, `/dream`, `/memory-audit`) stay single-agent. +**Self-improvement, not just self-learning.** `/dream` improves what the system +*knows* (the memory wiki); `/improve-skills` improves the *machinery* — it dogfoods +the critic panel on our 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". + ## Development loop For every task: From 40a4a65655af1a0d3262657b0a66d231eb0dbaaa Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 29 Jun 2026 20:54:18 +0000 Subject: [PATCH 2/2] Apply /improve-skills findings: close self-modification gap + tighten gates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit First /improve-skills meta-critic run (25 agents, 6 lenses) found 2 blockers + 10 important in the project's own prompts/workflows; the two-axis verifier refuted 7 (including 3 edits that would have weakened a gate). Applied the verified real-and-safe 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 (regex unit-tested: matches the prompt surface, no false positives). The sanctioned path to edit prompts is the manual, confirmation-gated /improve-skills. - /dream: gate CLAUDE.md edits behind explicit confirmation (was the self-contradictory "propose it ... and apply the edit"); add the matching Hard rule. - CLAUDE.md: add "commit/push only when the user asks" (settings pre-allow git commit, but no rule forbade committing 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. - fix-localhost: make its single-agent intent explicit (it named a critic panel inline; CLAUDE.md classes it single-agent and says panels are Workflows). - multi-agent-dev: add typecheck/lint/unit/build to its "never mark complete unless" gate (CLAUDE.md requires them; the command's list omitted them). - write-goal + CLAUDE.md: drop the dangling /plan reference -> outline inline. - improve-skills.js: parse a JSON-string args so scope/targets resolve. Filed the durable lesson (a self-improving system must denylist its own prompt surface) in the memory wiki + log. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_014xUCrJdREvUMjoVzSX5T8G --- .claude/commands/dream.md | 7 ++++++- .claude/commands/fix-localhost.md | 18 +++++++++++------- .claude/commands/multi-agent-dev.md | 1 + .claude/commands/write-goal.md | 3 ++- .claude/loop.md | 17 +++++++++++++---- .claude/memory/log.md | 27 +++++++++++++++++++++++++++ .claude/memory/topics/workflow.md | 6 ++++++ .claude/workflows/improve-skills.js | 15 +++++++++++++-- .claude/workflows/loop-iteration.js | 4 ++++ CLAUDE.md | 7 ++++++- 10 files changed, 89 insertions(+), 16 deletions(-) diff --git a/.claude/commands/dream.md b/.claude/commands/dream.md index 9734f57..97b99ce 100644 --- a/.claude/commands/dream.md +++ b/.claude/commands/dream.md @@ -36,7 +36,10 @@ $ARGUMENTS verifiable bullet. If it fits no existing page, create a new `topics/.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. @@ -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. diff --git a/.claude/commands/fix-localhost.md b/.claude/commands/fix-localhost.md index de6c691..8220072 100644 --- a/.claude/commands/fix-localhost.md +++ b/.claude/commands/fix-localhost.md @@ -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. diff --git a/.claude/commands/multi-agent-dev.md b/.claude/commands/multi-agent-dev.md index 10e5b78..40af51a 100644 --- a/.claude/commands/multi-agent-dev.md +++ b/.claude/commands/multi-agent-dev.md @@ -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 diff --git a/.claude/commands/write-goal.md b/.claude/commands/write-goal.md index f46cb97..a8141fb 100644 --- a/.claude/commands/write-goal.md +++ b/.claude/commands/write-goal.md @@ -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 diff --git a/.claude/loop.md b/.claude/loop.md index 51cf619..989a95e 100644 --- a/.claude/loop.md +++ b/.claude/loop.md @@ -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. @@ -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`, @@ -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. diff --git a/.claude/memory/log.md b/.claude/memory/log.md index 4766b84..b67e856 100644 --- a/.claude/memory/log.md +++ b/.claude/memory/log.md @@ -124,3 +124,30 @@ change), `rotate` (archived old entries). Format: `## [YYYY-MM-DD] | (files || []).some((f) => DENYLIST.some((re) => re.test(f))) diff --git a/CLAUDE.md b/CLAUDE.md index 165fbd9..70b0d94 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -53,7 +53,8 @@ command does this on demand. 6. A **max-budget guard** (e.g. "stop after N turns if not achieved"). **Three ways to get there:** (a) describe the outcome and ask for the `/goal`; -(b) `/plan` first, then convert the plan into a `/goal`; (c) context-dump +(b) outline the plan inline first (steps + files touched), then convert it into a +`/goal`; (c) context-dump (`CLAUDE.md`, the memory wiki, the docs story map) and ask which `/goal`s are worth building. Triggers: "write me the `/goal` for this", "turn this into a `/loop`", "what `/goal` should we build based on how this project works?". @@ -104,6 +105,10 @@ Before browser testing: - Do not delete tests to make the suite pass. - Always explain root cause before applying a fix. - After fixing, run the smallest relevant test first, then the full verification command. +- Commit or push only when the user explicitly asks. Never commit/push as a side + effect of completing a task; `git commit`/`git add` being pre-allowed in + `settings.local.json` is a convenience, not a license to commit unprompted. If on + the default branch, branch first. ## Multi-Agent Development Workflow