@soleri/forge 9.3.1 → 9.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/compose-claude-md.js +118 -7
  2. package/dist/compose-claude-md.js.map +1 -1
  3. package/dist/scaffolder.js +39 -1
  4. package/dist/scaffolder.js.map +1 -1
  5. package/dist/skills/agent-dev/SKILL.md +122 -0
  6. package/dist/skills/agent-guide/SKILL.md +116 -0
  7. package/dist/skills/agent-issues/SKILL.md +268 -0
  8. package/dist/skills/agent-persona/SKILL.md +66 -0
  9. package/dist/skills/deep-review/SKILL.md +12 -0
  10. package/dist/skills/deliver-and-ship/SKILL.md +123 -0
  11. package/dist/skills/discovery-phase/SKILL.md +69 -0
  12. package/dist/skills/env-setup/SKILL.md +151 -0
  13. package/dist/skills/executing-plans/SKILL.md +12 -0
  14. package/dist/skills/finishing-a-development-branch/SKILL.md +76 -0
  15. package/dist/skills/fix-and-learn/SKILL.md +12 -0
  16. package/dist/skills/mcp-doctor/SKILL.md +154 -0
  17. package/dist/skills/subagent-driven-development/SKILL.md +77 -0
  18. package/dist/skills/using-git-worktrees/SKILL.md +80 -0
  19. package/dist/skills/vault-curate/SKILL.md +99 -0
  20. package/dist/skills/verification-before-completion/SKILL.md +12 -0
  21. package/dist/skills/yolo-mode/SKILL.md +80 -0
  22. package/dist/templates/clean-worktrees.d.ts +5 -0
  23. package/dist/templates/clean-worktrees.js +59 -0
  24. package/dist/templates/clean-worktrees.js.map +1 -0
  25. package/dist/templates/setup-script.js +26 -1
  26. package/dist/templates/setup-script.js.map +1 -1
  27. package/dist/templates/shared-rules.js +128 -5
  28. package/dist/templates/shared-rules.js.map +1 -1
  29. package/dist/templates/skills.js +3 -29
  30. package/dist/templates/skills.js.map +1 -1
  31. package/dist/templates/vitest-config.js +1 -0
  32. package/dist/templates/vitest-config.js.map +1 -1
  33. package/package.json +1 -1
  34. package/src/compose-claude-md.ts +126 -9
  35. package/src/scaffolder.ts +41 -1
  36. package/src/skills/agent-dev/SKILL.md +122 -0
  37. package/src/skills/agent-guide/SKILL.md +116 -0
  38. package/src/skills/agent-issues/SKILL.md +268 -0
  39. package/src/skills/agent-persona/SKILL.md +66 -0
  40. package/src/skills/deep-review/SKILL.md +12 -0
  41. package/src/skills/deliver-and-ship/SKILL.md +123 -0
  42. package/src/skills/discovery-phase/SKILL.md +69 -0
  43. package/src/skills/env-setup/SKILL.md +151 -0
  44. package/src/skills/executing-plans/SKILL.md +12 -0
  45. package/src/skills/finishing-a-development-branch/SKILL.md +76 -0
  46. package/src/skills/fix-and-learn/SKILL.md +12 -0
  47. package/src/skills/mcp-doctor/SKILL.md +154 -0
  48. package/src/skills/subagent-driven-development/SKILL.md +77 -0
  49. package/src/skills/using-git-worktrees/SKILL.md +80 -0
  50. package/src/skills/vault-curate/SKILL.md +99 -0
  51. package/src/skills/verification-before-completion/SKILL.md +12 -0
  52. package/src/skills/yolo-mode/SKILL.md +80 -0
  53. package/src/templates/clean-worktrees.ts +58 -0
  54. package/src/templates/setup-script.ts +26 -1
  55. package/src/templates/shared-rules.ts +130 -5
  56. package/src/templates/skills.ts +3 -29
  57. package/src/templates/vitest-config.ts +1 -0
  58. package/vitest.config.ts +1 -0
@@ -0,0 +1,77 @@
1
+ ---
2
+ name: subagent-driven-development
3
+ description: >
4
+ Use when the user says "use subagents", "parallel agents", "fan out", "dispatch agents",
5
+ "subagent driven", or when a task decomposes into 2+ independent units that benefit from
6
+ isolated execution. Covers when to dispatch, worktree isolation, and merge strategy.
7
+ ---
8
+
9
+ # Subagent-Driven Development
10
+
11
+ Decompose work into isolated units, dispatch subagents via the Agent tool, merge results back. You are the controller — you never implement, you orchestrate.
12
+
13
+ **Announce at start:** "I'm using the subagent-driven-development skill to dispatch isolated agents."
14
+
15
+ ## When to Dispatch
16
+
17
+ | Signal | Dispatch? |
18
+ |--------|-----------|
19
+ | 2+ independent tasks touching different files | Yes — no conflict risk, parallel speedup |
20
+ | Risky/experimental work (spike, prototype) | Yes — isolate blast radius in a worktree |
21
+ | Large refactor across unrelated modules | Yes — each module is a clean unit |
22
+ | Single-file change or trivial fix | **No** — overhead exceeds benefit |
23
+ | Tasks with sequential dependencies | **No** — cannot parallelize |
24
+ | Tasks modifying the same file | **No** — guaranteed merge conflicts |
25
+
26
+ ## The Process
27
+
28
+ ### Step 1: Decompose
29
+
30
+ Break work into discrete units. For each, determine: files involved, dependencies on other units, conflict risk. Only units with no file overlap and no inter-dependency qualify for dispatch.
31
+
32
+ ### Step 2: Dispatch with Worktree Isolation
33
+
34
+ ```
35
+ Agent(prompt: "<task prompt>", isolation: "worktree")
36
+ ```
37
+
38
+ Each subagent prompt must include: (1) task scope, (2) file boundaries, (3) acceptance criteria, (4) rules — no commits, no out-of-scope changes, run tests before reporting.
39
+
40
+ Launch all independent subagents in a **single message** so they run in parallel.
41
+
42
+ ### Step 3: Review and Merge
43
+
44
+ For each returning subagent:
45
+ 1. **Review** — read actual file changes (do not trust self-reports alone), verify tests pass, check scope compliance
46
+ 2. **Merge** — `git merge` or `git cherry-pick` from the worktree branch, one at a time
47
+ 3. **Test** — run the full suite after each merge; only proceed if green
48
+ 4. **Conflicts** — resolve manually, re-run tests, capture as anti-pattern for future planning
49
+
50
+ After all merges, capture learnings:
51
+ ```
52
+ YOUR_AGENT_core op:capture_quick params:{
53
+ title: "subagent dispatch outcome",
54
+ description: "<which tasks parallelized well, which conflicted>"
55
+ }
56
+ ```
57
+
58
+ ## Anti-Patterns
59
+
60
+ | Anti-Pattern | Why It Fails |
61
+ |-------------|--------------|
62
+ | Dispatching for a 5-line fix | Startup overhead exceeds the work |
63
+ | Parallel dispatch of dependent tasks | Second agent works on stale assumptions |
64
+ | Skipping worktree isolation for nearby files | Silent overwrites between agents |
65
+ | Trusting self-reports without reading code | Agents miss edge cases or misunderstand scope |
66
+ | Dispatching 10+ agents at once | Review bottleneck shifts to the controller |
67
+
68
+ ## Merge Strategy
69
+
70
+ | Situation | Strategy |
71
+ |-----------|----------|
72
+ | Completely separate directories | Fast-forward merge, no conflicts expected |
73
+ | Different files in the same package | Merge one by one, test after each |
74
+ | Unexpected conflict | Resolve manually, re-run tests, capture as anti-pattern |
75
+ | Subagent result fails review | Dispatch fix subagent into same worktree (max 2 retries) |
76
+
77
+ **Related skills:** parallel-execute, executing-plans, verification-before-completion
@@ -0,0 +1,80 @@
1
+ ---
2
+ name: using-git-worktrees
3
+ description: >
4
+ Use when the user says "worktree", "isolate", "parallel branch", "safe branch", or when a plan
5
+ has independent tasks that benefit from parallel execution in isolated branches. Provides the
6
+ protocol for creating, working in, and cleaning up git worktrees safely.
7
+ ---
8
+
9
+ # Using Git Worktrees
10
+
11
+ Isolate work into parallel branches without stashing or switching. Use for multi-task plans, risky changes, or parallel execution. Claude Code natively supports `isolation: "worktree"` on sub-agents.
12
+
13
+ **Announce at start:** "I'm using the using-git-worktrees skill to isolate this work."
14
+
15
+ ## When to Use
16
+
17
+ - Plan has 2+ independent tasks that can run in parallel
18
+ - Risky or experimental change that should not touch the main working tree
19
+ - Long-running task where you need the main branch clean for hotfixes
20
+
21
+ ## Creation Protocol
22
+
23
+ ```bash
24
+ # 1. Pre-flight — working tree must be clean
25
+ git status
26
+ git log origin/main..main # check for unpushed commits
27
+
28
+ # 2. Create worktree
29
+ git worktree add ../<repo>-<task> -b <branch-name>
30
+ cd ../<repo>-<task>
31
+
32
+ # 3. Bootstrap and baseline
33
+ npm install # shared .git does NOT share node_modules
34
+ npm test # must pass before any changes
35
+ ```
36
+
37
+ If the working tree is dirty, commit or stash first. If baseline tests fail, stop and investigate.
38
+
39
+ ## Working in a Worktree
40
+
41
+ - Full working copy — edit, test, commit normally
42
+ - Commits are visible across worktrees (shared `.git`)
43
+ - `git worktree list` to see all active worktrees
44
+
45
+ ## Cleanup Protocol
46
+
47
+ ```bash
48
+ # 1. Safety check — never delete with unpushed/uncommitted work
49
+ git log origin/<branch>..<branch> # unpushed commits?
50
+ git diff --stat # uncommitted changes?
51
+
52
+ # 2. Merge or discard
53
+ git merge <branch-name> # from main worktree
54
+ # OR: git branch -D <branch-name> # only if work is abandoned
55
+
56
+ # 3. Remove and verify
57
+ git worktree remove ../<repo>-<task>
58
+ git worktree prune
59
+ git worktree list # confirm removal
60
+ ```
61
+
62
+ ## Anti-Patterns
63
+ - Creating worktrees for single-file changes or one-liner fixes
64
+ - Leaving orphan worktrees after tasks complete — always clean up
65
+ - Deleting the worktree directory manually instead of `git worktree remove`
66
+ - Forgetting `npm install` in new worktree
67
+ - Skipping baseline tests before starting work
68
+
69
+ ## Quick Reference
70
+
71
+ | Action | Command |
72
+ | ---------------- | ------------------------------------------------ |
73
+ | Create | `git worktree add ../<name> -b <branch>` |
74
+ | List | `git worktree list` |
75
+ | Remove | `git worktree remove ../<name>` |
76
+ | Prune | `git worktree prune` |
77
+ | Check unpushed | `git log origin/<branch>..<branch>` |
78
+ | Claude Code | Sub-agent with `isolation: "worktree"` parameter |
79
+
80
+ **Related skills:** executing-plans, parallel-execute
@@ -0,0 +1,99 @@
1
+ ---
2
+ name: vault-curate
3
+ description: >
4
+ Use when the user says "clean vault", "deduplicate", "groom knowledge",
5
+ "consolidate vault", "vault maintenance", "find duplicates", "merge patterns",
6
+ "check contradictions", "vault health", or wants to maintain, clean, reorganize,
7
+ or improve the quality of the agent's knowledge base.
8
+ ---
9
+
10
+ # Vault Curate — Knowledge Maintenance
11
+
12
+ Maintain vault quality through deduplication, grooming, contradiction detection, and consolidation. A well-curated vault produces better search results and brain recommendations.
13
+
14
+ ## When to Use
15
+
16
+ Periodically (weekly or after heavy capture sessions), when search quality degrades, when vault health shows warnings, or when the user explicitly requests maintenance.
17
+
18
+ ## Orchestration Sequence
19
+
20
+ ### Step 1: Health Assessment
21
+
22
+ ```
23
+ YOUR_AGENT_core op:knowledge_health
24
+ ```
25
+
26
+ ```
27
+ YOUR_AGENT_core op:get_vault_analytics
28
+ ```
29
+
30
+ Present the health summary to the user before proceeding: total entries, quality scores, staleness, coverage gaps.
31
+
32
+ ### Step 2: Detect Duplicates
33
+
34
+ ```
35
+ YOUR_AGENT_core op:curator_detect_duplicates
36
+ ```
37
+
38
+ This finds entries with overlapping titles, descriptions, or content. Review the duplicate pairs — some may be intentional (different contexts) while others are true duplicates.
39
+
40
+ For true duplicates:
41
+
42
+ ```
43
+ YOUR_AGENT_core op:merge_patterns
44
+ params: { patternIds: ["<id1>", "<id2>"] }
45
+ ```
46
+
47
+ Preserve the best content from each.
48
+
49
+ ### Step 3: Find Contradictions
50
+
51
+ ```
52
+ YOUR_AGENT_core op:curator_contradictions
53
+ ```
54
+
55
+ Contradictions erode trust in vault search results. For each contradiction: decide which entry is correct (check dates, context, evidence), then archive or update the incorrect one.
56
+
57
+ ### Step 4: Groom Entries
58
+
59
+ ```
60
+ YOUR_AGENT_core op:curator_groom_all
61
+ ```
62
+
63
+ Runs tag enrichment and metadata cleanup across all entries. This improves searchability and categorization.
64
+
65
+ For targeted grooming of specific entries:
66
+
67
+ ```
68
+ YOUR_AGENT_core op:curator_groom
69
+ params: { entryIds: ["<id>"], tags: ["<tag>"] }
70
+ ```
71
+
72
+ ### Step 5: Full Consolidation
73
+
74
+ ```
75
+ YOUR_AGENT_core op:curator_consolidate
76
+ ```
77
+
78
+ Runs the complete pipeline: dedup + archive stale entries + resolve contradictions. This is the heavy-duty cleanup.
79
+
80
+ ### Step 6: Knowledge Reorganization
81
+
82
+ ```
83
+ YOUR_AGENT_core op:knowledge_reorganize
84
+ params: { mode: "preview" }
85
+ ```
86
+
87
+ Preview first, then run again with `mode: "apply"` if the preview looks good.
88
+
89
+ ### Step 7: Verify Results
90
+
91
+ ```
92
+ YOUR_AGENT_core op:knowledge_health
93
+ ```
94
+
95
+ Compare with Step 1 metrics. Vault health should improve: fewer duplicates, no contradictions, better coverage.
96
+
97
+ ## Exit Criteria
98
+
99
+ Curation is complete when: duplicates merged, contradictions resolved, entries groomed, and health metrics improved compared to Step 1 baseline.
@@ -75,6 +75,18 @@ Capture session summary: `YOUR_AGENT_core op:session_capture params: { summary:
75
75
  - Running linter but not build (linter does not check compilation)
76
76
  - Skipping the red-green cycle for regression tests
77
77
 
78
+ ## Rationalization Prevention
79
+
80
+ Do NOT rationalize away failures. If a check fails, it fails. Period.
81
+
82
+ - **HARD-GATE: All verification commands must pass (exit 0, 0 failures) before claiming task complete.**
83
+ - **HARD-GATE: Agent system checks (`admin_health`, `admin_diagnostic`) must report no problems before completion.**
84
+ - Do not say "tests probably pass" -- run them and read the output.
85
+ - Do not say "this is a minor issue" to skip a failing check.
86
+ - Do not say "it worked last time" -- stale results are not evidence.
87
+ - Do not downgrade a failure to a warning to avoid blocking completion.
88
+ - If a check fails and you cannot fix it, report the failure honestly. Never hide it.
89
+
78
90
  ## Quick Reference
79
91
 
80
92
  | Op | When to Use |
@@ -0,0 +1,80 @@
1
+ ---
2
+ name: yolo-mode
3
+ description: >
4
+ Use when the user says "yolo", "autonomous", "skip approvals", "full auto", "hands off",
5
+ or asks to execute without approval gates. Activates autonomous execution mode where the
6
+ agent skips plan approval gates but preserves all safety invariants.
7
+ ---
8
+
9
+ # YOLO Mode
10
+
11
+ Autonomous execution without approval gates. Plans execute immediately — no Gate 1, no Gate 2, no confirmation prompts.
12
+
13
+ **Announce at start:** "I'm activating YOLO mode — autonomous execution with safety invariants intact."
14
+
15
+ ## Activation Flow
16
+
17
+ ### Step 1: Verify Safety Hook Pack
18
+
19
+ ```
20
+ YOUR_AGENT_core op:admin_health
21
+ ```
22
+
23
+ Check that the YOLO Safety Hook Pack is installed. This pack intercepts destructive commands (force push, reset --hard, drop table, rm -rf).
24
+
25
+ **HARD-GATE: Refuse to activate YOLO mode if the safety hook pack is not installed.** Tell the user: "YOLO mode requires the safety hook pack. Run `soleri hooks add-pack yolo-safety` first."
26
+
27
+ ### Step 2: Morph to YOLO Mode
28
+
29
+ ```
30
+ YOUR_AGENT_core op:morph
31
+ params: { mode: "YOLO-MODE" }
32
+ ```
33
+
34
+ ### Step 3: Confirm to User
35
+
36
+ State clearly: "YOLO mode active. Approval gates are off. Safety invariants remain enforced. Say 'exit YOLO' to return to normal mode."
37
+
38
+ ## What Gets Skipped
39
+
40
+ - Plan approval Gate 1 (`op:approve_plan`)
41
+ - Plan approval Gate 2 (`op:plan_split` confirmation)
42
+ - User confirmation prompts between steps
43
+ - "Ready for feedback?" checkpoints
44
+
45
+ ## What Is NEVER Skipped
46
+
47
+ - **`op:orchestrate_complete`** — knowledge capture runs on every task, always
48
+ - **Vault search before decisions** — check vault for patterns/anti-patterns before acting
49
+ - **YOLO Safety Hook Pack** — intercepts destructive commands (force push, drop table, rm -rf, reset --hard)
50
+ - **Test execution** — tests still run; failures still block completion
51
+ - **`op:plan_reconcile`** — drift reports still generated after execution
52
+
53
+ ## Exit Conditions
54
+
55
+ YOLO mode deactivates when any of these occur:
56
+
57
+ - User says "exit YOLO", "stop YOLO", or "normal mode"
58
+ - Session ends
59
+ - Explicit deactivation: `op:morph params: { mode: "DEFAULT" }`
60
+ - Safety hook intercepts a destructive command (auto-exits, requires re-activation)
61
+
62
+ ## Anti-Patterns
63
+
64
+ - Activating YOLO on an unfamiliar codebase — you need vault context first
65
+ - Skipping tests in YOLO — tests are safety, not ceremony
66
+ - Using YOLO for architectural decisions that need human judgment
67
+ - Staying in YOLO after a safety hook triggers — re-evaluate before re-activating
68
+ - Running YOLO without reviewing what the safety hook pack actually covers
69
+
70
+ ## Quick Reference
71
+
72
+ | Op | When to Use |
73
+ | --------------------- | ------------------------------------ |
74
+ | `admin_health` | Verify safety hook pack is installed |
75
+ | `morph` | Activate/deactivate YOLO mode |
76
+ | `orchestrate_complete`| After every task (never skip) |
77
+ | `search_intelligent` | Before every decision (never skip) |
78
+ | `plan_reconcile` | After execution (never skip) |
79
+
80
+ **Related skills:** executing-plans, writing-plans
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Generate a POSIX sh script that cleans up stale Claude Code worktrees.
3
+ * Registered as a SessionStart hook in scaffolded agents.
4
+ */
5
+ export function generateCleanWorktreesScript(): string {
6
+ return `#!/bin/sh
7
+ # Clean stale Claude Code worktrees on session start.
8
+ # Registered as a SessionStart hook by Soleri scaffolding.
9
+ # Safe: skips active worktrees, checks for unpushed commits.
10
+
11
+ WORKTREE_DIR=".claude/worktrees"
12
+
13
+ # Exit silently if no worktrees directory
14
+ [ -d "$WORKTREE_DIR" ] || exit 0
15
+
16
+ # Prune worktrees whose branches have been deleted
17
+ git worktree prune 2>/dev/null
18
+
19
+ # Get list of active worktrees (skip the main one)
20
+ active_worktrees="$(git worktree list --porcelain 2>/dev/null | grep '^worktree ' | sed 's/^worktree //')"
21
+
22
+ cleaned=0
23
+ skipped=0
24
+
25
+ for dir in "$WORKTREE_DIR"/*/; do
26
+ [ -d "$dir" ] || continue
27
+
28
+ # Resolve to absolute path for comparison
29
+ abs_dir="$(cd "$dir" 2>/dev/null && pwd)" || continue
30
+
31
+ # Skip if still in git worktree list (active)
32
+ if echo "$active_worktrees" | grep -qF "$abs_dir"; then
33
+ skipped=$((skipped + 1))
34
+ continue
35
+ fi
36
+
37
+ # Safety: check for unpushed commits before removing
38
+ branch="$(git -C "$dir" rev-parse --abbrev-ref HEAD 2>/dev/null)" || branch=""
39
+ if [ -n "$branch" ] && [ "$branch" != "HEAD" ]; then
40
+ upstream="$(git -C "$dir" rev-parse --abbrev-ref "@{upstream}" 2>/dev/null)" || upstream=""
41
+ if [ -n "$upstream" ]; then
42
+ unpushed="$(git -C "$dir" log "$upstream..$branch" --oneline 2>/dev/null)"
43
+ if [ -n "$unpushed" ]; then
44
+ skipped=$((skipped + 1))
45
+ continue
46
+ fi
47
+ fi
48
+ fi
49
+
50
+ rm -rf "$dir" 2>/dev/null && cleaned=$((cleaned + 1))
51
+ done
52
+
53
+ # Silent unless something was cleaned
54
+ if [ "$cleaned" -gt 0 ]; then
55
+ echo "Cleaned $cleaned stale worktree(s), $skipped active/protected"
56
+ fi
57
+ `;
58
+ }
@@ -53,11 +53,18 @@ if [ ! -f "$SETTINGS_FILE" ]; then
53
53
  "type": "prompt",
54
54
  "prompt": "Before context is compacted, capture a session summary by calling ${config.id}_core op:session_capture with a brief summary of what was accomplished, the topics covered, files modified, and tools used."
55
55
  }
56
+ ],
57
+ "SessionStart": [
58
+ {
59
+ "type": "command",
60
+ "command": "sh $AGENT_DIR/scripts/clean-worktrees.sh",
61
+ "timeout": 10
62
+ }
56
63
  ]
57
64
  }
58
65
  }
59
66
  SETTINGS
60
- echo "[ok] Created $SETTINGS_FILE with PreCompact hook"
67
+ echo "[ok] Created $SETTINGS_FILE with PreCompact + SessionStart hooks"
61
68
  else
62
69
  if grep -q "PreCompact" "$SETTINGS_FILE" 2>/dev/null; then
63
70
  echo "[ok] PreCompact hook already configured — skipping"
@@ -75,6 +82,24 @@ else
75
82
  "
76
83
  echo "[ok] Added PreCompact hook to $SETTINGS_FILE"
77
84
  fi
85
+ # Add SessionStart worktree cleanup hook
86
+ if grep -q "clean-worktrees" "$SETTINGS_FILE" 2>/dev/null; then
87
+ echo "[ok] SessionStart worktree cleanup hook already configured"
88
+ else
89
+ node -e "
90
+ const fs = require('fs');
91
+ const settings = JSON.parse(fs.readFileSync('$SETTINGS_FILE', 'utf-8'));
92
+ if (!settings.hooks) settings.hooks = {};
93
+ if (!settings.hooks.SessionStart) settings.hooks.SessionStart = [];
94
+ settings.hooks.SessionStart.push({
95
+ type: 'command',
96
+ command: 'sh $AGENT_DIR/scripts/clean-worktrees.sh',
97
+ timeout: 10
98
+ });
99
+ fs.writeFileSync('$SETTINGS_FILE', JSON.stringify(settings, null, 2) + '\\n');
100
+ "
101
+ echo "[ok] Added SessionStart worktree cleanup hook"
102
+ fi
78
103
  fi
79
104
 
80
105
  # Install skills to ~/.claude/commands/
@@ -114,6 +114,19 @@ const ENGINE_RULES_LINES: string[] = [
114
114
  '- Persist lessons: capture + link. An unlinked entry is incomplete.',
115
115
  '- Exceptions: runtime errors with stack traces → codebase first; user explicitly asks to search web.',
116
116
  '',
117
+ '### Vault Search Strategy',
118
+ '',
119
+ "Default to **two-pass search** — scan first, load only what's relevant. This saves tokens and keeps context lean.",
120
+ '',
121
+ '| Situation | Strategy |',
122
+ '|-----------|----------|',
123
+ '| Broad/exploratory query | `mode: "scan"` → triage by score → `op:load_entries` for top matches |',
124
+ '| Specific known entry | `mode: "full"` directly |',
125
+ '| Work task (need vault context before coding) | Scan → pick relevant → load |',
126
+ '| Existence check ("do we have X?") | `mode: "scan"` only, no load needed |',
127
+ '',
128
+ '**Never load all scan results.** Pick the top 2-4 by relevance score and skip entries below 0.30 unless the query is very specific.',
129
+ '',
117
130
 
118
131
  // ─── Planning ────────────────────────────────────────────
119
132
  '## Planning',
@@ -210,6 +223,38 @@ const ENGINE_RULES_LINES: string[] = [
210
223
  '```',
211
224
  '',
212
225
 
226
+ // ─── YOLO Mode ──────────────────────────────────────────
227
+ '## YOLO Mode',
228
+ '<!-- soleri:yolo-mode -->',
229
+ '',
230
+ 'YOLO mode skips plan approval gates for faster execution. The agent executes tasks directly without waiting for Gate 1 (`op:approve_plan`) or Gate 2 (`op:plan_split`) confirmation.',
231
+ '',
232
+ '### What Changes',
233
+ '',
234
+ '- Plan approval gates are **auto-approved** — no user confirmation needed.',
235
+ '- Task routing skips the two-gate ceremony — plans are created, approved, and split in one pass.',
236
+ '',
237
+ '### What Does NOT Change',
238
+ '',
239
+ '- `op:orchestrate_complete` **always runs** — knowledge capture is never skipped.',
240
+ '- Vault search **always runs** — decisions must be informed by existing patterns.',
241
+ '- Brain feedback loop remains active.',
242
+ '- Grade gate still applies — plans must grade A or higher.',
243
+ '',
244
+ '### Prerequisites',
245
+ '',
246
+ '- **YOLO Safety Hook Pack** must be installed: `soleri hooks add-pack yolo-safety`',
247
+ '- The hook pack intercepts destructive commands (force push, reset --hard, drop table) and requires explicit confirmation.',
248
+ '- Staging backups are created before destructive operations.',
249
+ '',
250
+ '### Activation & Deactivation',
251
+ '',
252
+ '| Action | Method |',
253
+ '|--------|--------|',
254
+ '| Activate | `soleri yolo` or `op:morph params:{ mode: "YOLO-MODE" }` |',
255
+ '| Deactivate | "exit YOLO", session end, or `op:activate params:{ deactivate: true }` |',
256
+ '',
257
+
213
258
  // ─── Output Formatting ───────────────────────────────────
214
259
  '## Output Formatting',
215
260
  '<!-- soleri:output-formatting -->',
@@ -299,7 +344,7 @@ const ENGINE_RULES_LINES: string[] = [
299
344
  '`op:orchestrate_complete` runs for EVERY task — simple or complex. This captures:',
300
345
  '- Knowledge to vault (patterns learned, decisions made)',
301
346
  '- Session summary (what was done, files changed)',
302
- '- Brain feedback (what worked, what didn\'t)',
347
+ "- Brain feedback (what worked, what didn't)",
303
348
  '',
304
349
  'Without completion, the knowledge trail is lost. The code is in git, but the WHY disappears.',
305
350
  '',
@@ -350,6 +395,36 @@ const ENGINE_RULES_LINES: string[] = [
350
395
  '- Brain tells you **which** patterns matter (names + strength scores). Vault tells you **what** they are (rules, examples).',
351
396
  "- Pull only what's relevant to the current task — don't load everything at session start.",
352
397
  '',
398
+ '### Second Brain Features',
399
+ '',
400
+ '| Feature | How to use |',
401
+ '|---------|-----------|',
402
+ '| **Two-pass search** | `op:search_intelligent` with `mode: "scan"` for lightweight results, then `op:load_entries` for full content. See **Vault Search Strategy**. |',
403
+ '| **Session briefing** | `op:session_briefing` on session start — surfaces last session, active plans, recent captures, brain recommendations |',
404
+ '| **Evidence reconciliation** | `op:plan_reconcile_with_evidence` — cross-references plan tasks against git diff |',
405
+ '| **Learning radar** | `op:radar_analyze` to detect patterns from corrections, search misses, workarounds. `op:radar_candidates` to review, `op:radar_approve`/`op:radar_dismiss` |',
406
+ '| **External ingestion** | `op:ingest_url` for articles, `op:ingest_text` for transcripts/notes, `op:ingest_batch` for multiple items |',
407
+ '| **Content synthesis** | `op:synthesize` — turn vault knowledge into briefs, outlines, talking points, or post drafts |',
408
+ '| **Skill chains** | `op:chain_execute` — multi-step workflows with data flow between steps and approval gates |',
409
+ '',
410
+ '### Brain Feedback Loop',
411
+ '',
412
+ 'After using a vault search result to inform a decision, action, or response, call `op:record_feedback` with:',
413
+ '- `query`: the original search query',
414
+ '- `entryId`: the vault entry ID that was used',
415
+ '- `action`: "accepted" (result was useful) or "rejected" (result was irrelevant/wrong)',
416
+ '- `confidence`: 0.0–1.0 how relevant the result was to the task',
417
+ '',
418
+ 'Do this for:',
419
+ '- `search_intelligent` results that influence your next action',
420
+ '- `orchestrate_plan` vault recommendations you follow',
421
+ '- Vault entries you cite or reference in responses',
422
+ '',
423
+ 'Do NOT record feedback for:',
424
+ '- Existence checks ("do we have X?" — just scanning, not using)',
425
+ "- Results you browse but don't act on",
426
+ '- Duplicate feedback for the same entry in the same task',
427
+ '',
353
428
 
354
429
  // ─── Cross-Project Memory ────────────────────────────────
355
430
  '## Cross-Project Memory',
@@ -416,11 +491,27 @@ const ENGINE_RULES_LINES: string[] = [
416
491
  '',
417
492
  '### Character Persistence',
418
493
  '',
419
- '- All communication flows through your persona\'s voice tone, vocabulary, opinions',
494
+ '- **MANDATORY**: Prefix every response with `{AgentName} >` when activated (e.g., `Ernesto >`, `Salvador >`). This signals to the user that the agent persona is active.',
495
+ "- All communication flows through your persona's voice — tone, vocabulary, opinions",
420
496
  '- Stay in character until explicitly deactivated',
421
497
  '- Context compaction does not change who you are — these rules persist in CLAUDE.md',
422
498
  '- If you notice yourself dropping character, re-read your activation context',
423
499
  '',
500
+ '### Operator Learning (automatic, silent)',
501
+ 'When calling `op:orchestrate_complete`, fill the `operatorSignals` field with your observations from this session:',
502
+ '',
503
+ '- **Expertise**: which topics did the operator demonstrate knowledge in? Where did they need explanation? Report topic + level (learning/intermediate/expert).',
504
+ "- **Corrections**: did they tell you to change behavior? Quote their exact words. Note if it's global or project-specific.",
505
+ '- **Interests**: did they share anything personal? Hobbies, background, music, culture? Report the tag and context.',
506
+ '- **Patterns**: did you notice work habits? Batching, scoping, pacing, communication style? Report what you observed.',
507
+ '',
508
+ 'Rules:',
509
+ "- Fill what you observed. Empty arrays for what you didn't notice.",
510
+ '- Store facts, not assumptions. "User asked about React hooks" not "User doesn\'t know React."',
511
+ '- Never announce you are learning. Never ask for confirmation.',
512
+ '- Decline to store: health, medical, political, religious, sexual, financial, legal content.',
513
+ '- The engine handles compounding and persistence — just report honestly.',
514
+ '',
424
515
  '### What NOT to Route Through Tools',
425
516
  '',
426
517
  '- Pure file read/write/edit operations (use Read, Edit, Write tools directly)',
@@ -436,8 +527,8 @@ const ENGINE_RULES_LINES: string[] = [
436
527
  '',
437
528
  '### Session Start Protocol',
438
529
  '',
439
- 'On activation, discover capabilities via `op:admin_tool_list`. Call `op:register` when project context is needed for a task.',
440
- 'Call `op:activate` only when checking evolved capabilities or recovering session state.',
530
+ 'On activation, discover capabilities via `op:admin_tool_list`. Call `op:session_briefing` to surface last session context, active plans, and brain recommendations.',
531
+ 'Call `op:register` when project context is needed for a task. Call `op:activate` only when checking evolved capabilities or recovering session state.',
441
532
  'After context compaction, re-discover capabilities — do not assume your tool inventory is still cached.',
442
533
  '',
443
534
  '### Context Compaction',
@@ -516,6 +607,39 @@ const ENGINE_RULES_LINES: string[] = [
516
607
  '| Template drift suspected | `soleri agent diff` to see what changed |',
517
608
  '',
518
609
 
610
+ // ─── Persona Self-Update ────────────────────────────────────
611
+ '## Persona Self-Update',
612
+ '<!-- soleri:persona-self-update -->',
613
+ '',
614
+ 'When the user asks to change your personality, voice, quirks, or character:',
615
+ '',
616
+ '1. **Edit your own `agent.yaml`** — the `persona:` block is the source of truth for your character.',
617
+ '2. **NEVER modify Soleri engine code** — `@soleri/core`, `packages/core/src/persona/defaults.ts`, or any engine package. Those define the default template for ALL agents.',
618
+ '3. After editing `agent.yaml`, tell the user to run `soleri agent refresh` to regenerate CLAUDE.md, then reactivate.',
619
+ '',
620
+ '### What You Can Change',
621
+ '',
622
+ '| Field | Purpose |',
623
+ '|-------|---------|',
624
+ '| `persona.template` | Template ID (informational, can be custom) |',
625
+ '| `persona.inspiration` | Who/what inspires the character |',
626
+ '| `persona.culture` | Cultural background |',
627
+ '| `persona.voice` | How you sound (tone, cadence, vocabulary) |',
628
+ '| `persona.traits` | Personality traits |',
629
+ '| `persona.quirks` | Memorable behaviors and expressions |',
630
+ '| `persona.opinions` | Beliefs about craft and quality |',
631
+ '| `persona.metaphors` | Domains you draw metaphors from |',
632
+ '| `persona.languageRule` | How you mix languages |',
633
+ '| `persona.greetings` | Session start messages |',
634
+ '| `persona.signoffs` | Session end messages |',
635
+ '',
636
+ '### What You Must NOT Change',
637
+ '',
638
+ '- Engine defaults in `packages/core/src/persona/defaults.ts`',
639
+ '- The `PERSONA_TEMPLATES` registry',
640
+ '- Any file inside `@soleri/core` or `@soleri/forge`',
641
+ '',
642
+
519
643
  // ─── Verification Protocol ─────────────────────────────────
520
644
  '## Verification Protocol',
521
645
  '<!-- soleri:verification-protocol -->',
@@ -528,11 +652,12 @@ const ENGINE_RULES_LINES: string[] = [
528
652
  '2. **Prove** — reproduce the issue (test case, error log, stack trace)',
529
653
  '3. **Fix** — only after the issue is proven reproducible',
530
654
  '',
531
- '### Anti-pattern',
655
+ '### Anti-patterns',
532
656
  '',
533
657
  '- Fixing code "just in case" or for aesthetics without a proven issue',
534
658
  '- Claiming a bug exists without reproduction evidence',
535
659
  '- Refactoring working code under the guise of a bug fix',
660
+ '- **Dismissing test failures as "flaky" or "pre-existing" without reading the test code and the handler it exercises.** A test that fails consistently is broken, not flaky. Investigate the root cause before classifying.',
536
661
  '',
537
662
  '### Scope',
538
663
  '',