@soleri/forge 5.13.0 → 5.14.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.
package/dist/lib.d.ts CHANGED
@@ -11,3 +11,4 @@ export { patchIndexTs, patchClaudeMdContent } from './patching.js';
11
11
  export type { AgentConfig, AgentConfigInput, SetupTarget, ScaffoldResult, ScaffoldPreview, AgentInfo, InstallKnowledgeResult, AddDomainResult, } from './types.js';
12
12
  export { AgentConfigSchema, SETUP_TARGETS } from './types.js';
13
13
  export { generateExtensionsIndex, generateExampleOp } from './templates/extensions.js';
14
+ export { generateClaudeMdTemplate } from './templates/claude-md-template.js';
package/dist/lib.js CHANGED
@@ -10,4 +10,5 @@ export { addDomain } from './domain-manager.js';
10
10
  export { patchIndexTs, patchClaudeMdContent } from './patching.js';
11
11
  export { AgentConfigSchema, SETUP_TARGETS } from './types.js';
12
12
  export { generateExtensionsIndex, generateExampleOp } from './templates/extensions.js';
13
+ export { generateClaudeMdTemplate } from './templates/claude-md-template.js';
13
14
  //# sourceMappingURL=lib.js.map
package/dist/lib.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"lib.js","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AAC3F,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAWnE,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"lib.js","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AAC3F,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAWnE,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACvF,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC"}
@@ -47,30 +47,16 @@ export function generateClaudeMdTemplate(config) {
47
47
  `On every new session: ${bt}${toolPrefix}_core op:register params:{ projectPath: "." }${bt}`,
48
48
  '',
49
49
  ];
50
- // ─── Curated Facade Table ──────────────────────────────
51
- mdLines.push('## Key Operations', '', `Full list: ${bt}${toolPrefix}_core op:admin_tool_list${bt}`, '', '| Need | Facade | Op |', '|------|--------|----|');
52
- // Essential
53
- mdLines.push(`| Health check | ${bt}${toolPrefix}_core${bt} | ${bt}health${bt} |`, `| Search all | ${bt}${toolPrefix}_core${bt} | ${bt}search${bt} |`, `| Identity | ${bt}${toolPrefix}_core${bt} | ${bt}identity${bt} |`);
54
- // Domain-specific (3 rows per domain)
50
+ // ─── Compact Facade Table ───────────────────────────────
51
+ mdLines.push('## Essential Tools', `<!-- ${toolPrefix}:tools -->`, '', '| Facade | Key Ops |', '|--------|---------|', `| ${bt}${toolPrefix}_core${bt} | ${bt}health${bt}, ${bt}search${bt}, ${bt}identity${bt}, ${bt}register${bt}, ${bt}activate${bt} |`);
52
+ // Domain facades — one row per domain
55
53
  for (const d of config.domains) {
56
54
  const toolName = `${toolPrefix}_${d.replace(/-/g, '_')}`;
57
- mdLines.push(`| ${d} patterns | ${bt}${toolName}${bt} | ${bt}get_patterns${bt} |`, `| Search ${d} | ${bt}${toolName}${bt} | ${bt}search${bt} |`, `| Capture ${d} | ${bt}${toolName}${bt} | ${bt}capture${bt} |`);
55
+ mdLines.push(`| ${bt}${toolName}${bt} | ${bt}get_patterns${bt}, ${bt}search${bt}, ${bt}capture${bt} |`);
58
56
  }
59
- // Knowledge & Search
60
- mdLines.push(`| Intelligent search | ${bt}${toolPrefix}_core${bt} | ${bt}search_intelligent${bt} |`, `| Quick capture | ${bt}${toolPrefix}_core${bt} | ${bt}capture_quick${bt} |`, `| Batch capture | ${bt}${toolPrefix}_core${bt} | ${bt}capture_knowledge${bt} |`);
61
- // Memory
62
- mdLines.push(`| Memory search | ${bt}${toolPrefix}_core${bt} | ${bt}memory_search${bt} |`, `| Memory capture | ${bt}${toolPrefix}_core${bt} | ${bt}memory_capture${bt} |`, `| Session capture | ${bt}${toolPrefix}_core${bt} | ${bt}session_capture${bt} |`);
63
- // Planning
64
- mdLines.push(`| Create plan | ${bt}${toolPrefix}_core${bt} | ${bt}create_plan${bt} |`, `| Approve plan | ${bt}${toolPrefix}_core${bt} | ${bt}approve_plan${bt} |`, `| Update task | ${bt}${toolPrefix}_core${bt} | ${bt}update_task${bt} |`, `| Complete plan | ${bt}${toolPrefix}_core${bt} | ${bt}complete_plan${bt} |`);
65
- // Orchestration
66
- mdLines.push(`| Orchestrate plan | ${bt}${toolPrefix}_core${bt} | ${bt}orchestrate_plan${bt} |`, `| Orchestrate execute | ${bt}${toolPrefix}_core${bt} | ${bt}orchestrate_execute${bt} |`, `| Orchestrate complete | ${bt}${toolPrefix}_core${bt} | ${bt}orchestrate_complete${bt} |`);
67
- // Brain & Control
68
- mdLines.push(`| Brain stats | ${bt}${toolPrefix}_core${bt} | ${bt}brain_stats${bt} |`, `| Brain feedback | ${bt}${toolPrefix}_core${bt} | ${bt}brain_feedback${bt} |`, `| Route intent | ${bt}${toolPrefix}_core${bt} | ${bt}route_intent${bt} |`, `| Get behavior rules | ${bt}${toolPrefix}_core${bt} | ${bt}get_behavior_rules${bt} |`, `| Morph mode | ${bt}${toolPrefix}_core${bt} | ${bt}morph${bt} |`);
69
- // Admin
70
- mdLines.push(`| Admin health | ${bt}${toolPrefix}_core${bt} | ${bt}admin_health${bt} |`, `| Tool list | ${bt}${toolPrefix}_core${bt} | ${bt}admin_tool_list${bt} |`);
71
- // Governance
72
- mdLines.push(`| Governance dashboard | ${bt}${toolPrefix}_core${bt} | ${bt}governance_dashboard${bt} |`, `| Governance policy | ${bt}${toolPrefix}_core${bt} | ${bt}governance_policy${bt} |`);
73
- mdLines.push('');
57
+ // Engine facades — compact, grouped by concern
58
+ mdLines.push(`| ${bt}${toolPrefix}_core${bt} (vault) | ${bt}search_intelligent${bt}, ${bt}capture_knowledge${bt}, ${bt}capture_quick${bt}, ${bt}search_feedback${bt} |`, `| ${bt}${toolPrefix}_core${bt} (memory) | ${bt}memory_search${bt}, ${bt}memory_capture${bt}, ${bt}session_capture${bt} |`, `| ${bt}${toolPrefix}_core${bt} (planning) | ${bt}create_plan${bt}, ${bt}approve_plan${bt}, ${bt}plan_split${bt}, ${bt}plan_reconcile${bt}, ${bt}plan_complete_lifecycle${bt} |`, `| ${bt}${toolPrefix}_core${bt} (orchestrate) | ${bt}orchestrate_plan${bt}, ${bt}orchestrate_execute${bt}, ${bt}orchestrate_complete${bt} |`, `| ${bt}${toolPrefix}_core${bt} (brain) | ${bt}brain_stats${bt}, ${bt}brain_feedback${bt}, ${bt}rebuild_vocabulary${bt} |`, `| ${bt}${toolPrefix}_core${bt} (control) | ${bt}route_intent${bt}, ${bt}morph${bt}, ${bt}get_behavior_rules${bt} |`, `| ${bt}${toolPrefix}_core${bt} (loop) | ${bt}loop_start${bt}, ${bt}loop_iterate${bt}, ${bt}loop_status${bt}, ${bt}loop_cancel${bt} |`, `| ${bt}${toolPrefix}_core${bt} (governance) | ${bt}governance_dashboard${bt}, ${bt}governance_policy${bt}, ${bt}governance_proposals${bt} |`, `| ${bt}${toolPrefix}_core${bt} (admin) | ${bt}admin_health${bt}, ${bt}admin_tool_list${bt}, ${bt}admin_diagnostic${bt} |`);
59
+ mdLines.push('', `> Full list: ${bt}${toolPrefix}_core op:admin_tool_list${bt}`, '');
74
60
  // ─── Shared Behavioral Rules ───────────────────────────
75
61
  mdLines.push(...getSharedRules(toolPrefix));
76
62
  // ─── Hook Packs (conditional) ──────────────────────────
@@ -1 +1 @@
1
- {"version":3,"file":"claude-md-template.js","sourceRoot":"","sources":["../../src/templates/claude-md-template.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,wBAAwB,CAAC,MAAmB;IAC1D,MAAM,UAAU,GAAG,MAAM,CAAC,EAAE,CAAC;IAC7B,MAAM,MAAM,GAAG,GAAG,MAAM,CAAC,EAAE,OAAO,CAAC;IACnC,MAAM,EAAE,GAAG,GAAG,CAAC;IAEf,MAAM,OAAO,GAAa;QACxB,QAAQ,MAAM,MAAM;QACpB,EAAE;QACF,KAAK,MAAM,CAAC,IAAI,OAAO;QACvB,EAAE;QAEF,0DAA0D;QAC1D,MAAM,MAAM,CAAC,IAAI,EAAE;QACnB,EAAE;QACF,aAAa,MAAM,CAAC,IAAI,EAAE;QAC1B,gBAAgB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QAC3C,aAAa,MAAM,CAAC,IAAI,IAAI,WAAW,EAAE;QACzC,EAAE;QACF,MAAM,CAAC,WAAW;QAClB,EAAE;QACF,iBAAiB;QACjB,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;QACzC,EAAE;QAEF,0DAA0D;QAC1D,eAAe;QACf,EAAE;QACF,yBAAyB,MAAM,CAAC,IAAI,QAAQ,EAAE,GAAG,UAAU,gDAAgD,EAAE,EAAE;QAC/G,6BAA6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QAAQ,OAAO,IAAI,CAAC;IAC7B,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,KAAK;QACL,4BAA4B,MAAM,CAAC,IAAI,GAAG;QAC1C,gDAAgD;QAChD,KAAK;QACL,gDAAgD;QAChD,YAAY;QACZ,GAAG,WAAW;QACd,kBAAkB;QAClB,GAAG;QACH,EAAE;QACF,+CAA+C;QAC/C,aAAa,MAAM,IAAI;QACvB,GAAG;KACJ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED,SAAS,eAAe,CAAC,OAAiB,EAAE,MAAmB;IAC7D,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM;QAAE,OAAO;IAEtC,mDAAmD;IACnD,oEAAoE;IACpE,yDAAyD;IACzD,OAAO,CAAC,IAAI,CACV,eAAe,EACf,EAAE,EACF,oFAAoF,EACpF,EAAE,EACF,oBAAoB,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EACjD,EAAE,EACF,wEAAwE,EACxE,uDAAuD,EACvD,EAAE,CACH,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"claude-md-template.js","sourceRoot":"","sources":["../../src/templates/claude-md-template.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,wBAAwB,CAAC,MAAmB;IAC1D,MAAM,UAAU,GAAG,MAAM,CAAC,EAAE,CAAC;IAC7B,MAAM,MAAM,GAAG,GAAG,MAAM,CAAC,EAAE,OAAO,CAAC;IACnC,MAAM,EAAE,GAAG,GAAG,CAAC;IAEf,MAAM,OAAO,GAAa;QACxB,QAAQ,MAAM,MAAM;QACpB,EAAE;QACF,KAAK,MAAM,CAAC,IAAI,OAAO;QACvB,EAAE;QAEF,0DAA0D;QAC1D,MAAM,MAAM,CAAC,IAAI,EAAE;QACnB,EAAE;QACF,aAAa,MAAM,CAAC,IAAI,EAAE;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,EAAE,EACF,oBAAoB,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EACjD,EAAE,EACF,wEAAwE,EACxE,uDAAuD,EACvD,EAAE,CACH,CAAC;AACJ,CAAC"}
@@ -1,14 +1,9 @@
1
1
  /**
2
2
  * Shared behavioral rules that every Soleri agent ships with.
3
3
  *
4
- * These rules are agent-agnostic and mirror the quality of Salvador's
5
- * hand-crafted CLAUDE.md behavioral sections. They cover:
6
- * - Vault-first knowledge protocol
7
- * - Planning enforcement (two-gate approval)
8
- * - Output formatting (plan metadata tables, drift reports)
9
- * - Knowledge capture discipline
10
- * - Intent routing
11
- * - Session lifecycle
4
+ * Mirrors the structure and quality of Salvador's global CLAUDE.md.
5
+ * Uses HTML comment section markers, MANDATORY keywords, compact
6
+ * formatting, and complete lifecycle documentation.
12
7
  */
13
8
  /** Returns markdown lines for all shared behavioral sections. */
14
9
  export declare function getSharedRules(toolPrefix: string): string[];
@@ -1,14 +1,9 @@
1
1
  /**
2
2
  * Shared behavioral rules that every Soleri agent ships with.
3
3
  *
4
- * These rules are agent-agnostic and mirror the quality of Salvador's
5
- * hand-crafted CLAUDE.md behavioral sections. They cover:
6
- * - Vault-first knowledge protocol
7
- * - Planning enforcement (two-gate approval)
8
- * - Output formatting (plan metadata tables, drift reports)
9
- * - Knowledge capture discipline
10
- * - Intent routing
11
- * - Session lifecycle
4
+ * Mirrors the structure and quality of Salvador's global CLAUDE.md.
5
+ * Uses HTML comment section markers, MANDATORY keywords, compact
6
+ * formatting, and complete lifecycle documentation.
12
7
  */
13
8
  /** Returns markdown lines for all shared behavioral sections. */
14
9
  export function getSharedRules(toolPrefix) {
@@ -16,41 +11,42 @@ export function getSharedRules(toolPrefix) {
16
11
  return [
17
12
  // ─── Vault-First Protocol ────────────────────────────────
18
13
  '## Vault as Source of Truth',
14
+ `<!-- ${toolPrefix}:vault-protocol -->`,
19
15
  '',
20
- 'Before every decision — planning, design, architecture, problem-solving — consult the vault.',
16
+ '- **MANDATORY**: Consult the vault BEFORE every decision — planning, design, architecture, patterns, problem-solving.',
17
+ `- Lookup order: 1) VAULT (${bt}${toolPrefix}_core op:search_intelligent${bt}) → 2) MEMORY (${bt}${toolPrefix}_core op:memory_search${bt}) → 3) CODEBASE → 4) WEB/TRAINING.`,
18
+ '- If the vault has a pattern, follow it. If it has an anti-pattern, avoid it.',
19
+ `- Persist lessons: call ${bt}${toolPrefix}_core op:capture_knowledge${bt} — don't just promise "I will remember this".`,
20
+ '- Exceptions: runtime errors with stack traces → codebase first; user explicitly asks to search web.',
21
21
  '',
22
- '**Lookup order:**',
23
- `1. Vault — ${bt}${toolPrefix}_core op:search_intelligent params:{ query: "..." }${bt}`,
24
- '2. Codebase — only if vault has nothing',
25
- '3. Web / training knowledge — last resort',
26
- '',
27
- 'If the vault has a pattern, follow it. If it has an anti-pattern, avoid it.',
28
- '',
29
- // ─── Planning Enforcement ────────────────────────────────
22
+ // ─── Planning ────────────────────────────────────────────
30
23
  '## Planning',
24
+ `<!-- ${toolPrefix}:planning -->`,
31
25
  '',
32
- 'For multi-step tasks, use the planning system. **Never skip gates.**',
33
- '',
34
- '**Lifecycle:**',
35
- `${bt}draft → approved (Gate 1) tasks approved (Gate 2) → executing → reconciling → completed${bt}`,
26
+ `- Use ${bt}${toolPrefix}_core op:create_plan${bt} before writing ANY code. Show the plan, wait for approval.`,
27
+ `- Two-gate approval: Gate 1 (${bt}op:approve_plan${bt}), Gate 2 (${bt}op:plan_split${bt}). Never skip either.`,
28
+ '- Wait for explicit "yes" / "approve" before proceeding past each gate.',
29
+ `- After execution: ${bt}op:plan_reconcile${bt} (drift report) then ${bt}op:plan_complete_lifecycle${bt} (knowledge capture, archive).`,
30
+ '- Never let a plan stay in `executing` or `reconciling` state without reminding the user.',
31
+ '- On session start: check for plans in `executing`/`reconciling` state and remind.',
32
+ '- Exceptions: read-only operations, user says "just do it", single-line fixes.',
36
33
  '',
37
- '**Sequence:**',
38
- `1. Create: ${bt}${toolPrefix}_core op:create_plan params:{ objective: "...", scope: "...", tasks: [...] }${bt}`,
39
- `2. Approve plan (Gate 1): ${bt}${toolPrefix}_core op:approve_plan params:{ planId: "..." }${bt}`,
40
- `3. Split tasks (Gate 2): ${bt}${toolPrefix}_core op:plan_split params:{ planId: "..." }${bt}`,
41
- `4. Track: ${bt}${toolPrefix}_core op:update_task params:{ planId: "...", taskId: "...", status: "completed" }${bt}`,
42
- `5. Reconcile: ${bt}${toolPrefix}_core op:plan_reconcile params:{ planId: "..." }${bt}`,
43
- `6. Complete: ${bt}${toolPrefix}_core op:plan_complete_lifecycle params:{ planId: "..." }${bt}`,
34
+ '### Lifecycle States',
44
35
  '',
45
- 'Wait for explicit user approval before proceeding past each gate.',
46
- 'Check activation response for recovered plans in `executing` state — remind the user.',
36
+ '| State | Expires | Next Action |',
37
+ '|-------|---------|-------------|',
38
+ `| ${bt}draft${bt} | 30 min | ${bt}${toolPrefix}_core op:create_plan${bt} (iterate) |`,
39
+ `| ${bt}approved${bt} | 30 min | ${bt}${toolPrefix}_core op:plan_split${bt} |`,
40
+ `| ${bt}executing${bt} | Never | ${bt}${toolPrefix}_core op:plan_reconcile${bt} |`,
41
+ `| ${bt}reconciling${bt} | Never | ${bt}${toolPrefix}_core op:plan_complete_lifecycle${bt} |`,
42
+ `| ${bt}completed${bt} | — | Done |`,
47
43
  '',
48
- '**Exceptions:** Read-only operations, user says "just do it", single-line fixes.',
44
+ '### Plan Presentation',
49
45
  '',
50
- // ─── Output Formatting ───────────────────────────────────
51
- '## Output Formatting',
46
+ 'Every plan summary MUST include this format:',
52
47
  '',
53
- '**Plan metadata** — always show at top of every plan summary:',
48
+ '```',
49
+ '## Plan: [Short Title]',
54
50
  '',
55
51
  '| Field | Value |',
56
52
  '|-------|-------|',
@@ -58,35 +54,105 @@ export function getSharedRules(toolPrefix) {
58
54
  '| **Check ID** | {checkId} |',
59
55
  '| **Grade** | {grade} ({score}/100) |',
60
56
  '| **Status** | {status} |',
57
+ '| **Lifecycle** | {lifecycleStatus} |',
61
58
  '',
62
- '**Drift reports:**',
59
+ '**Objective:** [One sentence]',
63
60
  '',
61
+ '**Scope:**',
62
+ '| Included | Excluded |',
63
+ '|----------|----------|',
64
+ '| item 1 | item 1 |',
65
+ '',
66
+ '**Approach:**',
67
+ '| Step | Task |',
68
+ '|------|------|',
69
+ '| 1 | Description |',
70
+ '```',
71
+ '',
72
+ 'Without visible IDs, users cannot resume, reference, or approve plans.',
73
+ '',
74
+ '### Drift Report',
75
+ '',
76
+ '```',
64
77
  '| Field | Value |',
65
78
  '|-------|-------|',
66
79
  '| **Accuracy** | {accuracyScore}/100 |',
67
80
  '| **Drift Items** | {count} |',
68
81
  '',
69
- '| Type | Description | Impact |',
70
- '|------|-------------|--------|',
71
- '| skipped | ... | medium |',
82
+ '| Type | Description | Impact | Rationale |',
83
+ '|------|-------------|--------|-----------|',
84
+ '| skipped | ... | medium | ... |',
85
+ '```',
86
+ '',
87
+ // ─── Output Formatting ───────────────────────────────────
88
+ '## Output Formatting',
89
+ `<!-- ${toolPrefix}:output-formatting -->`,
90
+ '',
91
+ '**MANDATORY**: Present tool outputs in human-readable format, NOT raw JSON.',
92
+ '',
93
+ '**Tasks** — show as numbered table:',
94
+ '```',
95
+ '| # | Type | Task | Complexity |',
96
+ '|---|------|------|------------|',
97
+ '| 1 | Impl | ... | High |',
98
+ '```',
99
+ '',
100
+ '**Completion** — show outcome, knowledge captured count, archive path.',
101
+ '',
102
+ '**Status lines** — `Persisted: X plans, Y tasks, Z checks` / `Recovered: X plans, Y tasks`',
103
+ '',
104
+ // ─── Clean Commits ───────────────────────────────────────
105
+ '## Clean Commits',
106
+ `<!-- ${toolPrefix}:clean-commits -->`,
107
+ '',
108
+ '**MANDATORY**: No AI attribution in commit messages.',
109
+ '',
110
+ 'Blocked patterns:',
111
+ '- `Co-Authored-By: Claude` (any variant)',
112
+ '- `noreply@anthropic.com`',
113
+ '- `Generated with Claude`, `AI-generated`',
114
+ '- Any mention of `Anthropic`, `Claude Opus`, `Claude Sonnet`, `Claude Haiku`',
115
+ '',
116
+ 'Use conventional commits:',
117
+ '```',
118
+ 'feat: add user authentication',
119
+ 'fix: resolve login timeout issue',
120
+ 'refactor: simplify data fetching logic',
121
+ '```',
72
122
  '',
73
123
  // ─── Knowledge Capture ───────────────────────────────────
74
124
  '## Knowledge Capture',
125
+ `<!-- ${toolPrefix}:knowledge-capture -->`,
75
126
  '',
76
- "When learning something that should persist, capture it — don't just promise to remember.",
127
+ "**MANDATORY**: Persist lessons, don't just promise them.",
77
128
  '',
78
- `- Domain knowledge: ${bt}${toolPrefix}_core op:capture_quick params:{ title: "...", description: "..." }${bt}`,
79
- `- Batch capture: ${bt}${toolPrefix}_core op:capture_knowledge params:{ entries: [...] }${bt}`,
80
- `- Intelligent search: ${bt}${toolPrefix}_core op:search_intelligent params:{ query: "..." }${bt}`,
129
+ 'When you learn something that should persist:',
130
+ '1. **DON\'T** just say "I will remember this"',
131
+ `2. **DO** call ${bt}${toolPrefix}_core op:capture_knowledge${bt} to persist to vault`,
132
+ "3. **DO** update relevant files if it's a behavioral change",
133
+ '',
134
+ '| Type | Tool | Persists To |',
135
+ '|------|------|-------------|',
136
+ `| Patterns/Anti-patterns | ${bt}${toolPrefix}_core op:capture_knowledge${bt} | vault |`,
137
+ `| Quick capture | ${bt}${toolPrefix}_core op:capture_quick${bt} | vault |`,
138
+ `| Session summaries | ${bt}${toolPrefix}_core op:session_capture${bt} | memory |`,
139
+ '',
140
+ // ─── Work Task Routing ───────────────────────────────────
141
+ '## Work Task Routing',
142
+ `<!-- ${toolPrefix}:task-routing -->`,
143
+ '',
144
+ 'Use the orchestration layer for ALL work tasks:',
145
+ `- ${bt}${toolPrefix}_core op:orchestrate_plan${bt} → vault + brain + structured plan.`,
146
+ `- ${bt}${toolPrefix}_core op:orchestrate_execute${bt} → execution tracking.`,
147
+ `- ${bt}${toolPrefix}_core op:orchestrate_complete${bt} → epilogue (vault, session).`,
148
+ '',
149
+ 'The orchestrator handles vault lookup, brain recommendations, and knowledge capture automatically.',
81
150
  '',
82
151
  // ─── Intent Detection ────────────────────────────────────
83
152
  '## Intent Detection',
153
+ `<!-- ${toolPrefix}:intent-detection -->`,
84
154
  '',
85
- 'A UserPromptSubmit hook auto-classifies prompts. When you see a `[MODE-NAME]` indicator:',
86
- '',
87
- `1. Call ${bt}${toolPrefix}_core op:route_intent params:{ prompt: "<user message>" }${bt}`,
88
- '2. Follow the returned behavior rules',
89
- '3. Briefly acknowledge mode changes',
155
+ `**Semantic-First**: Analyze user MEANING before calling ${bt}route_intent${bt}.`,
90
156
  '',
91
157
  '| Signal | Intent |',
92
158
  '|--------|--------|',
@@ -97,22 +163,41 @@ export function getSharedRules(toolPrefix) {
97
163
  '| Improvement requested ("make it faster") | IMPROVE |',
98
164
  '| Ready to ship ("deploy", "release") | DELIVER |',
99
165
  '',
100
- // ─── Session Lifecycle ───────────────────────────────────
101
- '## Session Lifecycle',
166
+ `Use ${bt}${toolPrefix}_core op:route_intent${bt} only to CONFIRM your analysis or when meaning is unclear.`,
102
167
  '',
103
- 'A PreCompact hook calls `session_capture` before context compaction.',
104
- `Manual capture: ${bt}${toolPrefix}_core op:session_capture params:{ summary: "..." }${bt}`,
168
+ // ─── Validation Loop ─────────────────────────────────────
169
+ '## Iterative Validation Loop',
170
+ `<!-- ${toolPrefix}:validation-loop -->`,
105
171
  '',
106
- // ─── Orchestration ───────────────────────────────────────
107
- '## Orchestration',
172
+ `- When a user gives a **work task**, start a loop: ${bt}${toolPrefix}_core op:loop_start params:{ prompt: "<task>", mode: "custom" }${bt}`,
173
+ '- Do NOT start loops for: questions, explanations, status checks, git operations, exploration, simple one-line fixes.',
108
174
  '',
109
- 'For complex workflows, use the orchestration layer instead of manual planning:',
175
+ '| Mode | Tool | Target | Max Iter |',
176
+ '|------|------|--------|----------|',
177
+ `| ${bt}plan-iteration${bt} | ${bt}${toolPrefix}_core op:create_plan${bt} | grade >= A | 10 |`,
178
+ `| ${bt}custom${bt} | user-defined | promise-based | 20 |`,
110
179
  '',
111
- `1. Plan: ${bt}${toolPrefix}_core op:orchestrate_plan params:{ prompt: "...", projectPath: "." }${bt}`,
112
- `2. Execute: ${bt}${toolPrefix}_core op:orchestrate_execute params:{ planId: "..." }${bt}`,
113
- `3. Complete: ${bt}${toolPrefix}_core op:orchestrate_complete params:{ planId: "..." }${bt}`,
180
+ // ─── Brain-Informed Work ─────────────────────────────────
181
+ '## Brain-Informed Work',
182
+ `<!-- ${toolPrefix}:brain -->`,
114
183
  '',
115
- 'The orchestrator handles vault lookup, brain recommendations, and knowledge capture automatically.',
184
+ '- Brain patterns surface at session start. For relevant patterns, pull rules just-in-time from the vault.',
185
+ '- Brain tells you **which** patterns matter (names + strength scores). Vault tells you **what** they are (rules, examples).',
186
+ "- Pull only what's relevant to the current task — don't load everything at session start.",
187
+ '',
188
+ // ─── Cross-Project Memory ────────────────────────────────
189
+ '## Cross-Project Memory',
190
+ `<!-- ${toolPrefix}:cross-project -->`,
191
+ '',
192
+ `- Use ${bt}crossProject: true${bt} in ${bt}${toolPrefix}_core op:memory_search${bt} for patterns across related projects.`,
193
+ `- Promote universal patterns to global pool with ${bt}${toolPrefix}_core op:memory_promote_to_global${bt}.`,
194
+ '',
195
+ // ─── Session Lifecycle ───────────────────────────────────
196
+ '## Session Lifecycle',
197
+ `<!-- ${toolPrefix}:session -->`,
198
+ '',
199
+ 'A PreCompact hook calls `session_capture` before context compaction.',
200
+ `Manual capture: ${bt}${toolPrefix}_core op:session_capture params:{ summary: "..." }${bt}`,
116
201
  '',
117
202
  ];
118
203
  }
@@ -1 +1 @@
1
- {"version":3,"file":"shared-rules.js","sourceRoot":"","sources":["../../src/templates/shared-rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,iEAAiE;AACjE,MAAM,UAAU,cAAc,CAAC,UAAkB;IAC/C,MAAM,EAAE,GAAG,GAAG,CAAC;IAEf,OAAO;QACL,4DAA4D;QAC5D,6BAA6B;QA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"version": "5.14.0",
4
4
  "description": "Scaffold AI agents that learn, remember, and grow with you.",
5
5
  "keywords": [
6
6
  "agent",
package/src/lib.ts CHANGED
@@ -20,3 +20,4 @@ export type {
20
20
  } from './types.js';
21
21
  export { AgentConfigSchema, SETUP_TARGETS } from './types.js';
22
22
  export { generateExtensionsIndex, generateExampleOp } from './templates/extensions.js';
23
+ export { generateClaudeMdTemplate } from './templates/claude-md-template.js';
@@ -54,84 +54,38 @@ export function generateClaudeMdTemplate(config: AgentConfig): string {
54
54
  '',
55
55
  ];
56
56
 
57
- // ─── Curated Facade Table ──────────────────────────────
57
+ // ─── Compact Facade Table ───────────────────────────────
58
58
  mdLines.push(
59
- '## Key Operations',
59
+ '## Essential Tools',
60
+ `<!-- ${toolPrefix}:tools -->`,
60
61
  '',
61
- `Full list: ${bt}${toolPrefix}_core op:admin_tool_list${bt}`,
62
- '',
63
- '| Need | Facade | Op |',
64
- '|------|--------|----|',
65
- );
66
-
67
- // Essential
68
- mdLines.push(
69
- `| Health check | ${bt}${toolPrefix}_core${bt} | ${bt}health${bt} |`,
70
- `| Search all | ${bt}${toolPrefix}_core${bt} | ${bt}search${bt} |`,
71
- `| Identity | ${bt}${toolPrefix}_core${bt} | ${bt}identity${bt} |`,
62
+ '| Facade | Key Ops |',
63
+ '|--------|---------|',
64
+ `| ${bt}${toolPrefix}_core${bt} | ${bt}health${bt}, ${bt}search${bt}, ${bt}identity${bt}, ${bt}register${bt}, ${bt}activate${bt} |`,
72
65
  );
73
66
 
74
- // Domain-specific (3 rows per domain)
67
+ // Domain facades one row per domain
75
68
  for (const d of config.domains) {
76
69
  const toolName = `${toolPrefix}_${d.replace(/-/g, '_')}`;
77
70
  mdLines.push(
78
- `| ${d} patterns | ${bt}${toolName}${bt} | ${bt}get_patterns${bt} |`,
79
- `| Search ${d} | ${bt}${toolName}${bt} | ${bt}search${bt} |`,
80
- `| Capture ${d} | ${bt}${toolName}${bt} | ${bt}capture${bt} |`,
71
+ `| ${bt}${toolName}${bt} | ${bt}get_patterns${bt}, ${bt}search${bt}, ${bt}capture${bt} |`,
81
72
  );
82
73
  }
83
74
 
84
- // Knowledge & Search
85
- mdLines.push(
86
- `| Intelligent search | ${bt}${toolPrefix}_core${bt} | ${bt}search_intelligent${bt} |`,
87
- `| Quick capture | ${bt}${toolPrefix}_core${bt} | ${bt}capture_quick${bt} |`,
88
- `| Batch capture | ${bt}${toolPrefix}_core${bt} | ${bt}capture_knowledge${bt} |`,
89
- );
90
-
91
- // Memory
92
- mdLines.push(
93
- `| Memory search | ${bt}${toolPrefix}_core${bt} | ${bt}memory_search${bt} |`,
94
- `| Memory capture | ${bt}${toolPrefix}_core${bt} | ${bt}memory_capture${bt} |`,
95
- `| Session capture | ${bt}${toolPrefix}_core${bt} | ${bt}session_capture${bt} |`,
96
- );
97
-
98
- // Planning
99
- mdLines.push(
100
- `| Create plan | ${bt}${toolPrefix}_core${bt} | ${bt}create_plan${bt} |`,
101
- `| Approve plan | ${bt}${toolPrefix}_core${bt} | ${bt}approve_plan${bt} |`,
102
- `| Update task | ${bt}${toolPrefix}_core${bt} | ${bt}update_task${bt} |`,
103
- `| Complete plan | ${bt}${toolPrefix}_core${bt} | ${bt}complete_plan${bt} |`,
104
- );
105
-
106
- // Orchestration
107
- mdLines.push(
108
- `| Orchestrate plan | ${bt}${toolPrefix}_core${bt} | ${bt}orchestrate_plan${bt} |`,
109
- `| Orchestrate execute | ${bt}${toolPrefix}_core${bt} | ${bt}orchestrate_execute${bt} |`,
110
- `| Orchestrate complete | ${bt}${toolPrefix}_core${bt} | ${bt}orchestrate_complete${bt} |`,
111
- );
112
-
113
- // Brain & Control
114
- mdLines.push(
115
- `| Brain stats | ${bt}${toolPrefix}_core${bt} | ${bt}brain_stats${bt} |`,
116
- `| Brain feedback | ${bt}${toolPrefix}_core${bt} | ${bt}brain_feedback${bt} |`,
117
- `| Route intent | ${bt}${toolPrefix}_core${bt} | ${bt}route_intent${bt} |`,
118
- `| Get behavior rules | ${bt}${toolPrefix}_core${bt} | ${bt}get_behavior_rules${bt} |`,
119
- `| Morph mode | ${bt}${toolPrefix}_core${bt} | ${bt}morph${bt} |`,
120
- );
121
-
122
- // Admin
123
- mdLines.push(
124
- `| Admin health | ${bt}${toolPrefix}_core${bt} | ${bt}admin_health${bt} |`,
125
- `| Tool list | ${bt}${toolPrefix}_core${bt} | ${bt}admin_tool_list${bt} |`,
126
- );
127
-
128
- // Governance
75
+ // Engine facades — compact, grouped by concern
129
76
  mdLines.push(
130
- `| Governance dashboard | ${bt}${toolPrefix}_core${bt} | ${bt}governance_dashboard${bt} |`,
131
- `| Governance policy | ${bt}${toolPrefix}_core${bt} | ${bt}governance_policy${bt} |`,
77
+ `| ${bt}${toolPrefix}_core${bt} (vault) | ${bt}search_intelligent${bt}, ${bt}capture_knowledge${bt}, ${bt}capture_quick${bt}, ${bt}search_feedback${bt} |`,
78
+ `| ${bt}${toolPrefix}_core${bt} (memory) | ${bt}memory_search${bt}, ${bt}memory_capture${bt}, ${bt}session_capture${bt} |`,
79
+ `| ${bt}${toolPrefix}_core${bt} (planning) | ${bt}create_plan${bt}, ${bt}approve_plan${bt}, ${bt}plan_split${bt}, ${bt}plan_reconcile${bt}, ${bt}plan_complete_lifecycle${bt} |`,
80
+ `| ${bt}${toolPrefix}_core${bt} (orchestrate) | ${bt}orchestrate_plan${bt}, ${bt}orchestrate_execute${bt}, ${bt}orchestrate_complete${bt} |`,
81
+ `| ${bt}${toolPrefix}_core${bt} (brain) | ${bt}brain_stats${bt}, ${bt}brain_feedback${bt}, ${bt}rebuild_vocabulary${bt} |`,
82
+ `| ${bt}${toolPrefix}_core${bt} (control) | ${bt}route_intent${bt}, ${bt}morph${bt}, ${bt}get_behavior_rules${bt} |`,
83
+ `| ${bt}${toolPrefix}_core${bt} (loop) | ${bt}loop_start${bt}, ${bt}loop_iterate${bt}, ${bt}loop_status${bt}, ${bt}loop_cancel${bt} |`,
84
+ `| ${bt}${toolPrefix}_core${bt} (governance) | ${bt}governance_dashboard${bt}, ${bt}governance_policy${bt}, ${bt}governance_proposals${bt} |`,
85
+ `| ${bt}${toolPrefix}_core${bt} (admin) | ${bt}admin_health${bt}, ${bt}admin_tool_list${bt}, ${bt}admin_diagnostic${bt} |`,
132
86
  );
133
87
 
134
- mdLines.push('');
88
+ mdLines.push('', `> Full list: ${bt}${toolPrefix}_core op:admin_tool_list${bt}`, '');
135
89
 
136
90
  // ─── Shared Behavioral Rules ───────────────────────────
137
91
  mdLines.push(...getSharedRules(toolPrefix));
@@ -1,14 +1,9 @@
1
1
  /**
2
2
  * Shared behavioral rules that every Soleri agent ships with.
3
3
  *
4
- * These rules are agent-agnostic and mirror the quality of Salvador's
5
- * hand-crafted CLAUDE.md behavioral sections. They cover:
6
- * - Vault-first knowledge protocol
7
- * - Planning enforcement (two-gate approval)
8
- * - Output formatting (plan metadata tables, drift reports)
9
- * - Knowledge capture discipline
10
- * - Intent routing
11
- * - Session lifecycle
4
+ * Mirrors the structure and quality of Salvador's global CLAUDE.md.
5
+ * Uses HTML comment section markers, MANDATORY keywords, compact
6
+ * formatting, and complete lifecycle documentation.
12
7
  */
13
8
 
14
9
  /** Returns markdown lines for all shared behavioral sections. */
@@ -18,43 +13,43 @@ export function getSharedRules(toolPrefix: string): string[] {
18
13
  return [
19
14
  // ─── Vault-First Protocol ────────────────────────────────
20
15
  '## Vault as Source of Truth',
16
+ `<!-- ${toolPrefix}:vault-protocol -->`,
21
17
  '',
22
- 'Before every decision — planning, design, architecture, problem-solving — consult the vault.',
23
- '',
24
- '**Lookup order:**',
25
- `1. Vault ${bt}${toolPrefix}_core op:search_intelligent params:{ query: "..." }${bt}`,
26
- '2. Codebase only if vault has nothing',
27
- '3. Web / training knowledge — last resort',
28
- '',
29
- 'If the vault has a pattern, follow it. If it has an anti-pattern, avoid it.',
18
+ '- **MANDATORY**: Consult the vault BEFORE every decision — planning, design, architecture, patterns, problem-solving.',
19
+ `- Lookup order: 1) VAULT (${bt}${toolPrefix}_core op:search_intelligent${bt}) → 2) MEMORY (${bt}${toolPrefix}_core op:memory_search${bt}) → 3) CODEBASE → 4) WEB/TRAINING.`,
20
+ '- If the vault has a pattern, follow it. If it has an anti-pattern, avoid it.',
21
+ `- Persist lessons: call ${bt}${toolPrefix}_core op:capture_knowledge${bt} don't just promise "I will remember this".`,
22
+ '- Exceptions: runtime errors with stack traces → codebase first; user explicitly asks to search web.',
30
23
  '',
31
24
 
32
- // ─── Planning Enforcement ────────────────────────────────
25
+ // ─── Planning ────────────────────────────────────────────
33
26
  '## Planning',
27
+ `<!-- ${toolPrefix}:planning -->`,
34
28
  '',
35
- 'For multi-step tasks, use the planning system. **Never skip gates.**',
36
- '',
37
- '**Lifecycle:**',
38
- `${bt}draft → approved (Gate 1) tasks approved (Gate 2) → executing → reconciling → completed${bt}`,
29
+ `- Use ${bt}${toolPrefix}_core op:create_plan${bt} before writing ANY code. Show the plan, wait for approval.`,
30
+ `- Two-gate approval: Gate 1 (${bt}op:approve_plan${bt}), Gate 2 (${bt}op:plan_split${bt}). Never skip either.`,
31
+ '- Wait for explicit "yes" / "approve" before proceeding past each gate.',
32
+ `- After execution: ${bt}op:plan_reconcile${bt} (drift report) then ${bt}op:plan_complete_lifecycle${bt} (knowledge capture, archive).`,
33
+ '- Never let a plan stay in `executing` or `reconciling` state without reminding the user.',
34
+ '- On session start: check for plans in `executing`/`reconciling` state and remind.',
35
+ '- Exceptions: read-only operations, user says "just do it", single-line fixes.',
39
36
  '',
40
- '**Sequence:**',
41
- `1. Create: ${bt}${toolPrefix}_core op:create_plan params:{ objective: "...", scope: "...", tasks: [...] }${bt}`,
42
- `2. Approve plan (Gate 1): ${bt}${toolPrefix}_core op:approve_plan params:{ planId: "..." }${bt}`,
43
- `3. Split tasks (Gate 2): ${bt}${toolPrefix}_core op:plan_split params:{ planId: "..." }${bt}`,
44
- `4. Track: ${bt}${toolPrefix}_core op:update_task params:{ planId: "...", taskId: "...", status: "completed" }${bt}`,
45
- `5. Reconcile: ${bt}${toolPrefix}_core op:plan_reconcile params:{ planId: "..." }${bt}`,
46
- `6. Complete: ${bt}${toolPrefix}_core op:plan_complete_lifecycle params:{ planId: "..." }${bt}`,
37
+ '### Lifecycle States',
47
38
  '',
48
- 'Wait for explicit user approval before proceeding past each gate.',
49
- 'Check activation response for recovered plans in `executing` state — remind the user.',
39
+ '| State | Expires | Next Action |',
40
+ '|-------|---------|-------------|',
41
+ `| ${bt}draft${bt} | 30 min | ${bt}${toolPrefix}_core op:create_plan${bt} (iterate) |`,
42
+ `| ${bt}approved${bt} | 30 min | ${bt}${toolPrefix}_core op:plan_split${bt} |`,
43
+ `| ${bt}executing${bt} | Never | ${bt}${toolPrefix}_core op:plan_reconcile${bt} |`,
44
+ `| ${bt}reconciling${bt} | Never | ${bt}${toolPrefix}_core op:plan_complete_lifecycle${bt} |`,
45
+ `| ${bt}completed${bt} | — | Done |`,
50
46
  '',
51
- '**Exceptions:** Read-only operations, user says "just do it", single-line fixes.',
47
+ '### Plan Presentation',
52
48
  '',
53
-
54
- // ─── Output Formatting ───────────────────────────────────
55
- '## Output Formatting',
49
+ 'Every plan summary MUST include this format:',
56
50
  '',
57
- '**Plan metadata** — always show at top of every plan summary:',
51
+ '```',
52
+ '## Plan: [Short Title]',
58
53
  '',
59
54
  '| Field | Value |',
60
55
  '|-------|-------|',
@@ -62,37 +57,110 @@ export function getSharedRules(toolPrefix: string): string[] {
62
57
  '| **Check ID** | {checkId} |',
63
58
  '| **Grade** | {grade} ({score}/100) |',
64
59
  '| **Status** | {status} |',
60
+ '| **Lifecycle** | {lifecycleStatus} |',
65
61
  '',
66
- '**Drift reports:**',
62
+ '**Objective:** [One sentence]',
67
63
  '',
64
+ '**Scope:**',
65
+ '| Included | Excluded |',
66
+ '|----------|----------|',
67
+ '| item 1 | item 1 |',
68
+ '',
69
+ '**Approach:**',
70
+ '| Step | Task |',
71
+ '|------|------|',
72
+ '| 1 | Description |',
73
+ '```',
74
+ '',
75
+ 'Without visible IDs, users cannot resume, reference, or approve plans.',
76
+ '',
77
+ '### Drift Report',
78
+ '',
79
+ '```',
68
80
  '| Field | Value |',
69
81
  '|-------|-------|',
70
82
  '| **Accuracy** | {accuracyScore}/100 |',
71
83
  '| **Drift Items** | {count} |',
72
84
  '',
73
- '| Type | Description | Impact |',
74
- '|------|-------------|--------|',
75
- '| skipped | ... | medium |',
85
+ '| Type | Description | Impact | Rationale |',
86
+ '|------|-------------|--------|-----------|',
87
+ '| skipped | ... | medium | ... |',
88
+ '```',
89
+ '',
90
+
91
+ // ─── Output Formatting ───────────────────────────────────
92
+ '## Output Formatting',
93
+ `<!-- ${toolPrefix}:output-formatting -->`,
94
+ '',
95
+ '**MANDATORY**: Present tool outputs in human-readable format, NOT raw JSON.',
96
+ '',
97
+ '**Tasks** — show as numbered table:',
98
+ '```',
99
+ '| # | Type | Task | Complexity |',
100
+ '|---|------|------|------------|',
101
+ '| 1 | Impl | ... | High |',
102
+ '```',
103
+ '',
104
+ '**Completion** — show outcome, knowledge captured count, archive path.',
105
+ '',
106
+ '**Status lines** — `Persisted: X plans, Y tasks, Z checks` / `Recovered: X plans, Y tasks`',
107
+ '',
108
+
109
+ // ─── Clean Commits ───────────────────────────────────────
110
+ '## Clean Commits',
111
+ `<!-- ${toolPrefix}:clean-commits -->`,
112
+ '',
113
+ '**MANDATORY**: No AI attribution in commit messages.',
114
+ '',
115
+ 'Blocked patterns:',
116
+ '- `Co-Authored-By: Claude` (any variant)',
117
+ '- `noreply@anthropic.com`',
118
+ '- `Generated with Claude`, `AI-generated`',
119
+ '- Any mention of `Anthropic`, `Claude Opus`, `Claude Sonnet`, `Claude Haiku`',
120
+ '',
121
+ 'Use conventional commits:',
122
+ '```',
123
+ 'feat: add user authentication',
124
+ 'fix: resolve login timeout issue',
125
+ 'refactor: simplify data fetching logic',
126
+ '```',
76
127
  '',
77
128
 
78
129
  // ─── Knowledge Capture ───────────────────────────────────
79
130
  '## Knowledge Capture',
131
+ `<!-- ${toolPrefix}:knowledge-capture -->`,
80
132
  '',
81
- "When learning something that should persist, capture it — don't just promise to remember.",
133
+ "**MANDATORY**: Persist lessons, don't just promise them.",
82
134
  '',
83
- `- Domain knowledge: ${bt}${toolPrefix}_core op:capture_quick params:{ title: "...", description: "..." }${bt}`,
84
- `- Batch capture: ${bt}${toolPrefix}_core op:capture_knowledge params:{ entries: [...] }${bt}`,
85
- `- Intelligent search: ${bt}${toolPrefix}_core op:search_intelligent params:{ query: "..." }${bt}`,
135
+ 'When you learn something that should persist:',
136
+ '1. **DON\'T** just say "I will remember this"',
137
+ `2. **DO** call ${bt}${toolPrefix}_core op:capture_knowledge${bt} to persist to vault`,
138
+ "3. **DO** update relevant files if it's a behavioral change",
139
+ '',
140
+ '| Type | Tool | Persists To |',
141
+ '|------|------|-------------|',
142
+ `| Patterns/Anti-patterns | ${bt}${toolPrefix}_core op:capture_knowledge${bt} | vault |`,
143
+ `| Quick capture | ${bt}${toolPrefix}_core op:capture_quick${bt} | vault |`,
144
+ `| Session summaries | ${bt}${toolPrefix}_core op:session_capture${bt} | memory |`,
145
+ '',
146
+
147
+ // ─── Work Task Routing ───────────────────────────────────
148
+ '## Work Task Routing',
149
+ `<!-- ${toolPrefix}:task-routing -->`,
150
+ '',
151
+ 'Use the orchestration layer for ALL work tasks:',
152
+ `- ${bt}${toolPrefix}_core op:orchestrate_plan${bt} → vault + brain + structured plan.`,
153
+ `- ${bt}${toolPrefix}_core op:orchestrate_execute${bt} → execution tracking.`,
154
+ `- ${bt}${toolPrefix}_core op:orchestrate_complete${bt} → epilogue (vault, session).`,
155
+ '',
156
+ 'The orchestrator handles vault lookup, brain recommendations, and knowledge capture automatically.',
86
157
  '',
87
158
 
88
159
  // ─── Intent Detection ────────────────────────────────────
89
160
  '## Intent Detection',
161
+ `<!-- ${toolPrefix}:intent-detection -->`,
90
162
  '',
91
- 'A UserPromptSubmit hook auto-classifies prompts. When you see a `[MODE-NAME]` indicator:',
92
- '',
93
- `1. Call ${bt}${toolPrefix}_core op:route_intent params:{ prompt: "<user message>" }${bt}`,
94
- '2. Follow the returned behavior rules',
95
- '3. Briefly acknowledge mode changes',
163
+ `**Semantic-First**: Analyze user MEANING before calling ${bt}route_intent${bt}.`,
96
164
  '',
97
165
  '| Signal | Intent |',
98
166
  '|--------|--------|',
@@ -103,24 +171,45 @@ export function getSharedRules(toolPrefix: string): string[] {
103
171
  '| Improvement requested ("make it faster") | IMPROVE |',
104
172
  '| Ready to ship ("deploy", "release") | DELIVER |',
105
173
  '',
174
+ `Use ${bt}${toolPrefix}_core op:route_intent${bt} only to CONFIRM your analysis or when meaning is unclear.`,
175
+ '',
106
176
 
107
- // ─── Session Lifecycle ───────────────────────────────────
108
- '## Session Lifecycle',
177
+ // ─── Validation Loop ─────────────────────────────────────
178
+ '## Iterative Validation Loop',
179
+ `<!-- ${toolPrefix}:validation-loop -->`,
109
180
  '',
110
- 'A PreCompact hook calls `session_capture` before context compaction.',
111
- `Manual capture: ${bt}${toolPrefix}_core op:session_capture params:{ summary: "..." }${bt}`,
181
+ `- When a user gives a **work task**, start a loop: ${bt}${toolPrefix}_core op:loop_start params:{ prompt: "<task>", mode: "custom" }${bt}`,
182
+ '- Do NOT start loops for: questions, explanations, status checks, git operations, exploration, simple one-line fixes.',
183
+ '',
184
+ '| Mode | Tool | Target | Max Iter |',
185
+ '|------|------|--------|----------|',
186
+ `| ${bt}plan-iteration${bt} | ${bt}${toolPrefix}_core op:create_plan${bt} | grade >= A | 10 |`,
187
+ `| ${bt}custom${bt} | user-defined | promise-based | 20 |`,
112
188
  '',
113
189
 
114
- // ─── Orchestration ───────────────────────────────────────
115
- '## Orchestration',
190
+ // ─── Brain-Informed Work ─────────────────────────────────
191
+ '## Brain-Informed Work',
192
+ `<!-- ${toolPrefix}:brain -->`,
193
+ '',
194
+ '- Brain patterns surface at session start. For relevant patterns, pull rules just-in-time from the vault.',
195
+ '- Brain tells you **which** patterns matter (names + strength scores). Vault tells you **what** they are (rules, examples).',
196
+ "- Pull only what's relevant to the current task — don't load everything at session start.",
116
197
  '',
117
- 'For complex workflows, use the orchestration layer instead of manual planning:',
198
+
199
+ // ─── Cross-Project Memory ────────────────────────────────
200
+ '## Cross-Project Memory',
201
+ `<!-- ${toolPrefix}:cross-project -->`,
118
202
  '',
119
- `1. Plan: ${bt}${toolPrefix}_core op:orchestrate_plan params:{ prompt: "...", projectPath: "." }${bt}`,
120
- `2. Execute: ${bt}${toolPrefix}_core op:orchestrate_execute params:{ planId: "..." }${bt}`,
121
- `3. Complete: ${bt}${toolPrefix}_core op:orchestrate_complete params:{ planId: "..." }${bt}`,
203
+ `- Use ${bt}crossProject: true${bt} in ${bt}${toolPrefix}_core op:memory_search${bt} for patterns across related projects.`,
204
+ `- Promote universal patterns to global pool with ${bt}${toolPrefix}_core op:memory_promote_to_global${bt}.`,
122
205
  '',
123
- 'The orchestrator handles vault lookup, brain recommendations, and knowledge capture automatically.',
206
+
207
+ // ─── Session Lifecycle ───────────────────────────────────
208
+ '## Session Lifecycle',
209
+ `<!-- ${toolPrefix}:session -->`,
210
+ '',
211
+ 'A PreCompact hook calls `session_capture` before context compaction.',
212
+ `Manual capture: ${bt}${toolPrefix}_core op:session_capture params:{ summary: "..." }${bt}`,
124
213
  '',
125
214
  ];
126
215
  }