omniconductor 0.3.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 (118) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/LICENSE +219 -0
  3. package/NOTICE +11 -0
  4. package/README.md +526 -0
  5. package/THIRD_PARTY_NOTICES.md +31 -0
  6. package/TRADEMARKS.md +26 -0
  7. package/VISION.md +106 -0
  8. package/adapters/README.md +121 -0
  9. package/adapters/claude/README.md +102 -0
  10. package/adapters/claude/SUPPORTED-FEATURES.md +66 -0
  11. package/adapters/claude/hookify-templates/.recipe-scoped +9 -0
  12. package/adapters/claude/hookify-templates/README.md +93 -0
  13. package/adapters/claude/hookify-templates/block-completion-claim-without-push.local.md.template +56 -0
  14. package/adapters/claude/hookify-templates/block-direct-push-protected-branch.local.md.template +18 -0
  15. package/adapters/claude/hookify-templates/block-force-push-protected-branch.local.md.template +42 -0
  16. package/adapters/claude/hookify-templates/block-server-secret-in-client.local.md.template +36 -0
  17. package/adapters/claude/hookify-templates/warn-any-type-added.local.md.template +44 -0
  18. package/adapters/claude/hookify-templates/warn-commit-without-pre-commit-review.local.md.template +52 -0
  19. package/adapters/claude/hookify-templates/warn-console-direct.local.md.template +55 -0
  20. package/adapters/claude/hookify-templates/warn-create-table-without-access-control.local.md.template +35 -0
  21. package/adapters/claude/hookify-templates/warn-current-work-without-remaining-tasks.local.md.template +36 -0
  22. package/adapters/claude/hookify-templates/warn-gh-pr-create-without-pre-merge-review.local.md.template +38 -0
  23. package/adapters/claude/hookify-templates/warn-hardcoded-text-without-i18n-key.local.md.template +21 -0
  24. package/adapters/claude/hookify-templates/warn-on-gh-pr-merge.local.md.template +33 -0
  25. package/adapters/claude/hookify-templates/warn-plan-spec-without-remaining-tasks.local.md.template +44 -0
  26. package/adapters/claude/hookify-templates/warn-raw-hex-instead-of-token.local.md.template +21 -0
  27. package/adapters/claude/hookify-templates/warn-security-definer-without-search-path.local.md.template +30 -0
  28. package/adapters/claude/hookify-templates/warn-stop-commit-without-current-work.local.md.template +47 -0
  29. package/adapters/claude/hookify-templates/warn-user-manual-completion.local.md.template +40 -0
  30. package/adapters/claude/transform-spec.md +140 -0
  31. package/adapters/claude/transform.sh +1169 -0
  32. package/adapters/codex/README.md +87 -0
  33. package/adapters/codex/SUPPORTED-FEATURES.md +66 -0
  34. package/adapters/codex/transform-spec.md +90 -0
  35. package/adapters/codex/transform.sh +748 -0
  36. package/adapters/copilot/README.md +88 -0
  37. package/adapters/copilot/SUPPORTED-FEATURES.md +73 -0
  38. package/adapters/copilot/transform-spec.md +111 -0
  39. package/adapters/copilot/transform.sh +757 -0
  40. package/adapters/cursor/README.md +87 -0
  41. package/adapters/cursor/SUPPORTED-FEATURES.md +90 -0
  42. package/adapters/cursor/transform-spec.md +124 -0
  43. package/adapters/cursor/transform.sh +731 -0
  44. package/adapters/gemini/README.md +93 -0
  45. package/adapters/gemini/SUPPORTED-FEATURES.md +80 -0
  46. package/adapters/gemini/transform-spec.md +102 -0
  47. package/adapters/gemini/transform.sh +844 -0
  48. package/adapters/windsurf/README.md +93 -0
  49. package/adapters/windsurf/SUPPORTED-FEATURES.md +67 -0
  50. package/adapters/windsurf/transform-spec.md +99 -0
  51. package/adapters/windsurf/transform.sh +727 -0
  52. package/bin/omniconductor.js +130 -0
  53. package/core/README.md +64 -0
  54. package/core/anti-patterns/README.md +142 -0
  55. package/core/anti-patterns/dynamic-system-prompt.md +113 -0
  56. package/core/anti-patterns/frequent-rule-file-edit.md +83 -0
  57. package/core/anti-patterns/large-file-read-no-range.md +90 -0
  58. package/core/anti-patterns/no-sub-agent-dispatch.md +89 -0
  59. package/core/anti-patterns/single-monolithic-rule-file.md +99 -0
  60. package/core/anti-patterns/skill-eager-load.md +83 -0
  61. package/core/anti-patterns/tool-call-spam.md +93 -0
  62. package/core/docs-templates/CURRENT_WORK.md +64 -0
  63. package/core/docs-templates/INDEX.md +57 -0
  64. package/core/docs-templates/PLANS.md +44 -0
  65. package/core/docs-templates/README.md +40 -0
  66. package/core/docs-templates/REMAINING_TASKS.md +43 -0
  67. package/core/docs-templates/TASKS.md +51 -0
  68. package/core/docs-templates/specs/_example.md +121 -0
  69. package/core/hooks/README.md +62 -0
  70. package/core/hooks/pretool-agent-routing.sh.template +97 -0
  71. package/core/hooks/pretool-commit-current-work-check.sh.template +103 -0
  72. package/core/hooks/pretool-commit-test-coverage-check.sh.template +116 -0
  73. package/core/hooks/pretool-large-file-read-guard.sh.template +117 -0
  74. package/core/hooks/stop-cache-hit-baseline-check.sh.template +133 -0
  75. package/core/hooks/stop-r6-review-check.sh.template +80 -0
  76. package/core/hooks/stop-session-log-check.sh.template +101 -0
  77. package/core/hooks/stop-trajectory-log.sh.template +96 -0
  78. package/core/memory-pattern/EXAMPLES.md +114 -0
  79. package/core/memory-pattern/README.md +133 -0
  80. package/core/recipes/README.md +46 -0
  81. package/core/recipes/auto-mock-data.md +82 -0
  82. package/core/recipes/branch-strategy.md +100 -0
  83. package/core/recipes/coding-conventions.md +123 -0
  84. package/core/recipes/database-discipline.md +65 -0
  85. package/core/recipes/debugging.md +143 -0
  86. package/core/recipes/design-system.md +30 -0
  87. package/core/recipes/i18n.md +118 -0
  88. package/core/recipes/monorepo.md +101 -0
  89. package/core/recipes/self-improvement.md +61 -0
  90. package/core/recipes/tdd.md +128 -0
  91. package/core/recipes/web-mobile-parity.md +87 -0
  92. package/core/reflector/SCHEDULING.md +83 -0
  93. package/core/reflector/prune-lessons.sh +105 -0
  94. package/core/reflector/reflect-brief.md +11 -0
  95. package/core/reflector/reflect.command.md +13 -0
  96. package/core/reflector/run-weekly.sh +54 -0
  97. package/core/reflector/trajectory-log.sh +55 -0
  98. package/core/roles/README.md +61 -0
  99. package/core/roles/builder.md +75 -0
  100. package/core/roles/designer.md +93 -0
  101. package/core/roles/helper.md +70 -0
  102. package/core/roles/planner.md +123 -0
  103. package/core/roles/reflector.md +72 -0
  104. package/core/roles/reviewer.md +104 -0
  105. package/core/roles/scribe.md +89 -0
  106. package/core/universal-rules/README.md +71 -0
  107. package/core/universal-rules/meta-discipline.md +292 -0
  108. package/core/universal-rules/operations.md +162 -0
  109. package/core/universal-rules/quality-gates.md +191 -0
  110. package/core/universal-rules/spec-as-you-go.md +123 -0
  111. package/core/universal-rules/workflow.md +153 -0
  112. package/core/workflow/PHASES.md +134 -0
  113. package/core/workflow/README.md +56 -0
  114. package/docs/MANUAL-INSTALL.md +456 -0
  115. package/package.json +52 -0
  116. package/tools/check-framework-purity.sh +91 -0
  117. package/tools/measure-tokens.sh +169 -0
  118. package/tools/validate-adapter-output.sh +611 -0
@@ -0,0 +1,89 @@
1
+ ---
2
+ anti_pattern_id: no-sub-agent-dispatch
3
+ name: "No sub-agent dispatch — large work runs in main thread"
4
+ type: anti-pattern
5
+ severity: MEDIUM
6
+ hit_rate_impact: "indirect: main-thread context bloat, output-token spike"
7
+ detection_method:
8
+ - measure-tokens (sub-agent dispatches per session vs total tool calls)
9
+ - session JSONL size > 100MB on a non-trivial project
10
+ applies_to: ["claude-code", "tools-with-native-sub-agent"]
11
+ linked_rules:
12
+ - meta-discipline (5.3 sub-agent dispatch discipline, 7 flat-with-leader)
13
+ ---
14
+
15
+ # Anti-Pattern 04 — No sub-agent dispatch
16
+
17
+ ## 1. What it is
18
+
19
+ The orchestrator handles every task — multi-file refactors, large file generations, verbose test runs, repository searches — directly in the main thread, never dispatching to a role agent. All output, intermediate reasoning, and tool results accumulate in the leader's context.
20
+
21
+ ```
22
+ # WRONG — 30 Reads + 12 Edits + 8 Bash test runs in main thread
23
+ Main thread: "Let me audit all 24 page components for the redesign..."
24
+ Read page-1.tsx (full)
25
+ Read page-2.tsx (full)
26
+ ... (22 more)
27
+ Edit page-1.tsx
28
+ ... (23 more)
29
+ Bash npm test (verbose output)
30
+ Bash npm run build (verbose output)
31
+ ```
32
+
33
+ By the end of the task the main-thread context holds the full text of 24 files plus build/test output — easily 100K+ tokens that linger for the rest of the session.
34
+
35
+ ## 2. Why it kills cache
36
+
37
+ Sub-agent isolation is the cleanest known mechanism for context hygiene on tools that support it:
38
+
39
+ - The dispatched role gets a fresh context, does the work, and returns a *summary* (typically 0.5-2K tokens).
40
+ - The main thread accumulates only the summary, not the verbose intermediate state.
41
+ - The cacheable prefix in the main thread stays small.
42
+
43
+ Without dispatch:
44
+ - Verbose test/build output (often 5-15K tokens) lives in main-thread history forever.
45
+ - 24-file refactor leaves 24 file bodies in main-thread cache-read on every subsequent turn.
46
+ - Cache-write per turn climbs as the conversation continues — cache hit rate stays high but the *absolute size* of cached content compounds.
47
+
48
+ **Reference data** (Conductor P1.5 baseline): the two largest sessions (219MB + 187MB) both contained heavy in-thread work; smaller sessions with active dispatch use stayed under 70MB. Avg dispatches/session = 104.6. The recommended P2 target is -25% dispatch *frequency* (batch related work) but the *anti-pattern* of zero dispatch is far more costly than over-dispatch.
49
+
50
+ ## 3. Detection
51
+
52
+ **Quantitative**:
53
+ - Sub-agent dispatches / session = 0 on multi-feature work → red flag
54
+ - Total tool calls / dispatches ratio > 200 → main-thread-heavy
55
+
56
+ ```bash
57
+ # Reference command via measure-tokens.sh:
58
+ bash tools/measure-tokens.sh --latest | grep -E 'dispatches|tool calls'
59
+ ```
60
+
61
+ **Symptom**: session JSONL grows past 100MB; latency per turn climbs noticeably as the session ages.
62
+
63
+ ## 4. Fix / Alternative
64
+
65
+ **Per `meta-discipline.md` §7 (flat-with-leader topology)**: orchestrator dispatches role agents. Roles never dispatch each other.
66
+
67
+ Rules of thumb (when to dispatch):
68
+ - Multi-file refactor (3+ files cross-cutting) → builder role
69
+ - Verbose test/build runs → helper role with `output_format=summary`
70
+ - Repository-wide search across an unfamiliar codebase → explorer role
71
+ - Long-form documentation generation → scribe role
72
+ - Anything expected to take > 2 min wall clock → background dispatch
73
+
74
+ Dispatch brief budget: ≤ 2K tokens (per `meta-discipline.md` §5.3). Reference files by path, do NOT paste content.
75
+
76
+ **Single-Agent Mode fallback**: tools that lack native sub-agents (Cursor, Copilot, Gemini, Codex, Windsurf) cannot use this fix. Conductor's `core/universal-rules/meta-discipline.md` §6.6 records this honestly. On those tools, mitigate with:
77
+ - Aggressive auto-compact at ~70% context
78
+ - Aggressive Grep-before-Read discipline
79
+ - Output-redirect to file (run verbose tools with `> /tmp/log` and tail-Read only the last N lines)
80
+
81
+ ## 5. Severity rating
82
+
83
+ **MEDIUM** — significant but tool-conditional. On Claude Code with native sub-agents, dispatch hygiene is the difference between a 65MB and a 220MB session JSONL. On tools without sub-agents, the rule degrades to compaction discipline.
84
+
85
+ | Pattern | Main-thread context after 50 turns | Cost |
86
+ |---|---|---|
87
+ | All work in main thread | 100-200K tokens accumulated | high — every subsequent turn re-reads all of it |
88
+ | Dispatch verbose work to roles | 10-20K tokens (summaries only) | low — main thread stays lean |
89
+ | Dispatch + structured-summary return | 5-10K tokens | optimal |
@@ -0,0 +1,99 @@
1
+ ---
2
+ anti_pattern_id: single-monolithic-rule-file
3
+ name: "Monolithic rule file — every rule in one auto-loaded document"
4
+ type: anti-pattern
5
+ severity: HIGH
6
+ hit_rate_impact: "direct cache-write bloat; -20% effective hit benefit"
7
+ detection_method:
8
+ - measure CLAUDE.md (or equivalent) line count — > 500 lines is suspect
9
+ - check for `paths:` / `globs:` / `applyTo:` frontmatter usage
10
+ applies_to: ["all-tools"]
11
+ linked_rules:
12
+ - meta-discipline (5.6 touched-file rule scoping)
13
+ ---
14
+
15
+ # Anti-Pattern 03 — Single monolithic rule file
16
+
17
+ ## 1. What it is
18
+
19
+ The project loads a single oversized rule file at session start — coding conventions, branch strategy, deployment notes, troubleshooting matrix, document map, full feature specs, all bundled in one document — instead of splitting into path-scoped bundles that load only when relevant files are touched.
20
+
21
+ ```markdown
22
+ # WRONG — 1,800-line CLAUDE.md auto-loaded every session
23
+ # Includes:
24
+ # - Workflow rules (relevant always)
25
+ # - Payment-provider webhook setup (relevant only when touching billing/)
26
+ # - Email templates (relevant only when touching email/)
27
+ # - Database migration log (relevant only when touching db/)
28
+ # - Bank-aggregator integration notes (relevant only when touching that area/)
29
+ # - Post-mortems from 6 months ago
30
+ ```
31
+
32
+ Every turn carries the entire payload — including 1,400 lines that have nothing to do with the current task.
33
+
34
+ ## 2. Why it kills cache
35
+
36
+ The file IS cacheable, so cache hit rate stays high. The damage is on a different axis: **cache-write inflation**.
37
+
38
+ - Every session start writes the full prefix. Cache-write costs 1.25× input.
39
+ - If the prefix is 25K tokens (mostly irrelevant), every new session pays 31K-token cache-write before any work begins.
40
+ - The per-turn cache-read cost stays 0.1×, but the absolute number of read tokens scales with prefix size, so total cost still climbs linearly with prefix bloat.
41
+
42
+ Conductor's P1.5 baseline shows avg cache-write per session = 27.4M tokens. The P2 target is -30% (to ~19M) — most of that reduction comes from splitting the monolithic file.
43
+
44
+ ## 3. Detection
45
+
46
+ ```bash
47
+ # Find oversized rule files
48
+ wc -l CLAUDE.md AGENT.md GEMINI.md .codex/codex.md 2>/dev/null | \
49
+ awk '$1 > 500 { print }'
50
+ ```
51
+
52
+ **Code-level signal**: grep for `paths:` / `globs:` / `applyTo:` frontmatter inside rule files. Zero matches across the rules dir = monolithic anti-pattern.
53
+
54
+ ```bash
55
+ grep -lE '^paths:|^globs:|^applyTo:' .claude/rules/*.md .cursor/rules/*.mdc 2>/dev/null | wc -l
56
+ ```
57
+
58
+ **Session-level signal**: same uncached input + cache-write delta across a session of unrelated tasks (e.g., billing work and i18n work both pull the whole rule body).
59
+
60
+ ## 4. Fix / Alternative
61
+
62
+ **Split by domain + scope by path** (per `meta-discipline.md` §5.6).
63
+
64
+ The reference project keeps a thin top-level pointer file and 5-7 path-scoped rule files:
65
+
66
+ ```
67
+ .claude/rules/
68
+ ├── workflow.md (always loaded)
69
+ ├── spec-as-you-go.md (always loaded)
70
+ ├── quality-gates.md (always loaded)
71
+ ├── operations.md (always loaded)
72
+ ├── meta-discipline.md (always loaded)
73
+ ├── coding-conventions.md (paths: apps/**/*.{ts,tsx})
74
+ ├── branch-strategy.md (paths: .git*, ci/**)
75
+ ├── i18n.md (paths: **/i18n/**, **/translations.ts)
76
+ └── billing.md (paths: **/stripe/**, **/billing/**)
77
+ ```
78
+
79
+ Five always-loaded universal bundles ≈ 6K tokens (Conductor v0.2 reference figure). Path-scoped bundles only contribute when the touched-file glob matches.
80
+
81
+ **Tool-specific frontmatter**:
82
+ - Claude Code: `paths:` (matches Read/Edit/Write target)
83
+ - Cursor: `globs:` in `.mdc`
84
+ - Copilot: `applyTo:` in `.instructions.md`
85
+ - Gemini / Codex: no native scoping → keep per-domain files small and link them by reference inside the main rule doc.
86
+
87
+ **The "5-bundle floor"**: per Conductor `core/universal-rules/README.md`, the minimum auto-load is 5 universal-rule files totaling ~6K tokens. Anything beyond that should be path-scoped or recipe-installed (opt-in).
88
+
89
+ ## 5. Severity rating
90
+
91
+ **HIGH** — directly multiplies every other cost. A 30K monolithic prefix turns every per-turn cache-read into 3K tokens billed (vs 600 for a 6K floor).
92
+
93
+ | Rule strategy | Auto-load size | Per-100-turn cache-read |
94
+ |---|---|---|
95
+ | Monolithic single file | 25-30K | 250-300K tokens |
96
+ | 5-bundle floor + path-scoped | 6K | 60K tokens |
97
+ | Recipe opt-in only when touched | varies | adds 1-3K per matching turn |
98
+
99
+ The 5-bundle + scoped recipe strategy delivers ~80% reduction in steady-state cache-read cost.
@@ -0,0 +1,83 @@
1
+ ---
2
+ anti_pattern_id: skill-eager-load
3
+ name: "Skill / MCP eager-load — every helper injected at session start"
4
+ type: anti-pattern
5
+ severity: MEDIUM
6
+ hit_rate_impact: "+ context bloat (200-600 tokens per skill, compounds)"
7
+ detection_method:
8
+ - count auto-loaded skills / MCP servers at session start
9
+ - measure-tokens cache-write delta when skills are added
10
+ applies_to: ["claude-code", "any-tool-with-skill-or-MCP-system"]
11
+ linked_rules:
12
+ - meta-discipline (5.2 hidden injection awareness, 5.5 tool description compression)
13
+ ---
14
+
15
+ # Anti-Pattern 07 — Skill / MCP eager-load
16
+
17
+ ## 1. What it is
18
+
19
+ Every available skill or MCP server is registered to load eagerly at session start, regardless of whether the current task triggers it. Skill descriptions, tool schemas, and (worst case) full skill bodies enter the cacheable prefix.
20
+
21
+ ```yaml
22
+ # WRONG — 30+ skills auto-loaded with full bodies
23
+ skills:
24
+ - frontend-design # 2K tokens, used in 5% of tasks
25
+ - email-template # 1.5K tokens, used in 2% of tasks
26
+ - payment-webhook # 2K tokens, used in 1% of tasks
27
+ - playwright-debugging # 3K tokens, used in 10% of tasks
28
+ - ... (26 more)
29
+ ```
30
+
31
+ In the originating project, certain Read paths trigger automatic skill injection:
32
+ - `<web-app>/app/**` Read → `next-cache-components` + `next-forge` + `nextjs` (~600 tokens hidden cost per Read)
33
+ - `src/components/**/*.tsx` Write → `react-best-practices` (~200 tokens)
34
+
35
+ If the orchestrator does 50 Reads under those paths in a session, that is 30K tokens of hidden skill injection — none of which the current task may need.
36
+
37
+ ## 2. Why it kills cache
38
+
39
+ Two failure modes:
40
+
41
+ - **Prefix bloat**: lazy-loaded skill *descriptions* are usually small (~50 tokens each), but eager-loaded skill *bodies* are 1-3K each. 30 eager-loaded skills = 30-90K tokens of always-cached prefix.
42
+ - **Hidden multiplier on Reads**: path-triggered skill injection happens *per Read*, not once per session. The hidden cost compounds with Anti-Pattern 02 (large-file Read).
43
+
44
+ Per `meta-discipline.md` §5.2: "Some tools auto-inject skill / library docs when certain file paths are touched. These injections add hidden tokens (often 200-600 per Read)."
45
+
46
+ Reference numbers (originating workspace's `token-economy.md`):
47
+ - `<web-app>/app/**` Read: ~600 tokens auto-inject
48
+ - `src/components/**/*.tsx` Write: ~200 tokens auto-inject
49
+
50
+ In a 50-Read session those modifiers alone account for 10-30K tokens of cache-write churn that has no relationship to the user's task.
51
+
52
+ ## 3. Detection
53
+
54
+ **Skill registry inspection**: at session start, count active skills with full body loaded vs description-only.
55
+
56
+ **Session JSONL signal**: search for skill body content appearing repeatedly in tool-call results.
57
+
58
+ **Symptom**: large uncached input + cache-write on the very first turn (before any user message has been processed) → eager-load weight.
59
+
60
+ ## 4. Fix / Alternative
61
+
62
+ **Three layers of mitigation**:
63
+
64
+ 1. **Description-only skill loading** (per `meta-discipline.md` §5.5): the registry exposes skill names + 1-line descriptions. The skill body loads only when the skill is invoked. On Claude Code, the `Skill` tool already implements this pattern — abuse comes from explicit eager-load configuration.
65
+
66
+ 2. **Path-scoped auto-injection** (per `meta-discipline.md` §5.6): when a tool offers path-triggered skills, ensure the path glob is *narrow*. The reference project pays for `<web-app>/app/**` triggering 3 skills because that glob is broad. Narrowing to `<web-app>/app/api/**/route.ts` (Next.js route handlers only) reduces trigger frequency by ~80%.
67
+
68
+ 3. **MCP gateway / lazy-load proxy**: when many MCP servers are registered, route them through a lazy-loading proxy so only the tool *names* enter the prefix, with full schemas fetched on first use. Reference: `meta-discipline.md` §5.5.
69
+
70
+ **Conductor's deferred-tool pattern**: this session uses `ToolSearch` to fetch tool schemas only when needed. That is the canonical example — tool names are visible in system reminders, but invoking a tool requires fetching its schema first. The same principle generalizes to skills.
71
+
72
+ **Cache-position fix**: even when a skill *must* be loaded, position it inside the cacheable prefix (above the cache_control boundary) so subsequent Reads under that path benefit from cache-read pricing (0.1×) rather than fresh injection cost. See `docs/PROMPT-CACHING-GUIDE.md`.
73
+
74
+ ## 5. Severity rating
75
+
76
+ **MEDIUM** — magnitude depends entirely on how many skills are eager-loaded and how broad the path triggers are. A project with 5 eager skills and tight path globs is fine. A project with 30 eager skills and a top-level `**/*` trigger is severe.
77
+
78
+ | Configuration | Cache-write impact | Verdict |
79
+ |---|---|---|
80
+ | Description-only registry, lazy-fetch | minimal | optimal |
81
+ | 5-10 eager skills, narrow path triggers | 5-10K | acceptable |
82
+ | 30+ eager skills, broad triggers | 30-90K | refactor |
83
+ | MCP server fully loaded, no gateway | varies, often 10K+ | mitigate via gateway |
@@ -0,0 +1,93 @@
1
+ ---
2
+ anti_pattern_id: tool-call-spam
3
+ name: "Tool-call spam — Read repetition where Grep / batched ops would do"
4
+ type: anti-pattern
5
+ severity: MEDIUM
6
+ hit_rate_impact: "indirect: tool-call inflation, output-token spike, latency"
7
+ detection_method:
8
+ - measure-tokens (tool calls / turn > 1.5)
9
+ - session JSONL inspection for repeated Reads of the same file
10
+ applies_to: ["all-tools-with-Read-Grep"]
11
+ linked_rules:
12
+ - meta-discipline (5.1 read discipline)
13
+ - quality-gates (verify-after-changes)
14
+ ---
15
+
16
+ # Anti-Pattern 06 — Tool-call spam
17
+
18
+ ## 1. What it is
19
+
20
+ The orchestrator (or a role) calls many small tools in serial — repeated Reads on the same file, separate Reads instead of one Grep, sequential Bash calls instead of one chained command — when a smaller number of higher-leverage calls would suffice.
21
+
22
+ ```
23
+ # WRONG — 5 Reads to find one config value
24
+ Read("config/a.ts") ; not here
25
+ Read("config/b.ts") ; not here
26
+ Read("config/c.ts") ; found!
27
+ Read("config/c.ts") ; re-read for context
28
+ Read("config/c.ts") ; re-read after edit
29
+
30
+ # WRONG — 4 Bash calls instead of 1 chained
31
+ Bash("git status")
32
+ Bash("git diff")
33
+ Bash("git log -5")
34
+ Bash("git branch --show-current")
35
+
36
+ # RIGHT
37
+ Grep("MAX_RETRIES", path="config/", -n=true, -A=3, -B=1)
38
+ Bash("git status; git diff; git log -5; git branch --show-current")
39
+ ```
40
+
41
+ ## 2. Why it kills cache
42
+
43
+ Two failure modes compound:
44
+
45
+ - **Per-call overhead**: every tool call adds the call's request + response to the conversation (cache-write next turn) plus invocation latency. Small tool calls have a high *fixed* cost relative to the information returned.
46
+ - **Output-token spike**: high tool-call density usually correlates with the model narrating each step ("Now I'll read X…", "That didn't have it, let me check Y…"). Conductor's P1.5 baseline shows output tokens dominate cost (avg 667/turn, top turns 12K-19.7K), and tool-call spam is a primary cause.
47
+
48
+ Reference numbers (Conductor P1.5):
49
+ - Avg tool calls / turn = **0.61** (project baseline; well-disciplined)
50
+ - P2 target = **0.43** (-30% reduction)
51
+ - Anti-pattern threshold = **> 1.5/turn** sustained
52
+
53
+ Per the baseline notes: "On average, 61% of turns contain at least one tool call. Total 22,917 tool calls across 37,763 turns." A session at 1.5/turn would have 56K tool calls, doubling tool-overhead cost.
54
+
55
+ ## 3. Detection
56
+
57
+ ```bash
58
+ # Tool calls per turn (uses bundled measure-tokens.sh)
59
+ bash tools/measure-tokens.sh --latest | grep -E 'tool calls'
60
+ ```
61
+
62
+ **Code-level signal** in session JSONL:
63
+ ```bash
64
+ # Count repeated Reads on the same file
65
+ grep '"name":"Read"' <session>.jsonl | \
66
+ grep -oE '"file_path":"[^"]+"' | sort | uniq -c | sort -rn | head
67
+ # Any file Read > 3 times = candidate for batching / Grep substitution
68
+ ```
69
+
70
+ **Self-check (LLM)**: at any point in a turn where the third sequential Read on the same file is about to happen, stop and ask: "would Grep with -A/-B context have found this in one call?"
71
+
72
+ ## 4. Fix / Alternative
73
+
74
+ **Three principles** (per `meta-discipline.md` §5.1):
75
+
76
+ 1. **Grep before Read** for symbol / value lookup. Use `-A` / `-B` / `-C` for surrounding context.
77
+ 2. **Range Read** when 50+ contiguous lines are genuinely needed (Anti-Pattern 02 fix).
78
+ 3. **Batch independent Bash calls** with `;` or `&&` chaining when they don't depend on each other.
79
+
80
+ **Parallel-tool-calls rule**: when independent calls can run in parallel (e.g., `git status`, `git diff`, `git log` — none depends on the other's output), issue them in a single response with multiple tool invocations rather than serially across N turns.
81
+
82
+ **Reference**: the originating workspace's `coding-conventions.md` codifies a Pre-Commit Checklist that runs typecheck + tests + build + review *in parallel where possible*. The same parallelism principle applies inside any single turn's tool calls.
83
+
84
+ ## 5. Severity rating
85
+
86
+ **MEDIUM** — degrades efficiency without breaking correctness. A 2× tool-call density doubles latency and increases output-token cost ~40-60% (the model narrates more). Hit rate is unaffected directly, but session JSONL size grows faster.
87
+
88
+ | Pattern | Tool calls / turn | Output tokens / turn | Verdict |
89
+ |---|---|---|---|
90
+ | Disciplined (Conductor baseline) | 0.6 | 670 | optimal |
91
+ | Acceptable | 0.8 - 1.2 | 700 - 900 | tolerable |
92
+ | Spam threshold | > 1.5 | > 1000 | refactor |
93
+ | Severe | > 2.5 | > 1500 | active intervention |
@@ -0,0 +1,64 @@
1
+ # CURRENT WORK — `<your-project>`
2
+
3
+ > **What this is**: session continuity log. Updated EVERY session. Read FIRST every session start.
4
+ > Lean (~150 lines). When it grows past, archive older sessions to `docs/sessions/<date>.md`.
5
+
6
+ > **Status (P0 placeholder)**: replace this entire file with your project's first entry on first install. P1 will provide a more developed starter template.
7
+
8
+ ---
9
+
10
+ ## Session log
11
+
12
+ ### 2026-MM-DD — Session N
13
+
14
+ **In progress**:
15
+ - (current task with file paths)
16
+
17
+ **Just completed**:
18
+ - (last task shipped)
19
+
20
+ **Issues / blockers**:
21
+ - (anything stuck)
22
+
23
+ **Next session should start with**:
24
+ - (concrete first action)
25
+
26
+ ---
27
+
28
+ ### Template for new entries
29
+
30
+ Copy and paste at the top of the section above:
31
+
32
+ ```
33
+ ### YYYY-MM-DD — Session NN
34
+
35
+ **In progress**:
36
+ - ...
37
+
38
+ **Just completed**:
39
+ - ...
40
+
41
+ **Issues / blockers**:
42
+ - ...
43
+
44
+ **Next session should start with**:
45
+ - ...
46
+ ```
47
+
48
+ ---
49
+
50
+ ## Project-level state (persistent across sessions)
51
+
52
+ > Things that don't change every session but that any session needs to know.
53
+
54
+ - **Current phase**: (e.g., "P3 — Implementation")
55
+ - **Active branch**: (e.g., `feature/billing-live-activation`)
56
+ - **Active feature flags**: (e.g., `IAP_ENABLED=false`, `AI_GATEWAY_ENABLED=true`)
57
+ - **Known blockers**: (e.g., "payment-provider live activation pending business registration approval")
58
+ - **Reference docs**: (links to `docs/PLANS.md`, `docs/REMAINING_TASKS.md`, `docs/specs/`)
59
+
60
+ ---
61
+
62
+ ## Session continuity rule
63
+
64
+ CRITICAL: maintain CURRENT_WORK.md with in-progress tasks, issues, next steps for instant session resume. Never end a session without updating this file.
@@ -0,0 +1,57 @@
1
+ # INDEX — `<your-project>` document map
2
+
3
+ > **What this is**: a single page that points to every other doc in `docs/`. Update when you add a doc.
4
+
5
+ > **Status (P0 placeholder)**: customize on first install. P1 will provide a more developed example.
6
+
7
+ ---
8
+
9
+ ## Top-level docs
10
+
11
+ | Doc | Purpose | Read frequency |
12
+ |---|---|---|
13
+ | `CURRENT_WORK.md` | Session continuity | Every session |
14
+ | `REMAINING_TASKS.md` | Launch readiness dashboard | Per milestone |
15
+ | `PLANS.md` | Phase roadmap | Per quarter |
16
+ | `TASKS.md` | Active phase task tracker | Per task |
17
+ | `INDEX.md` | This file — document map | When adding new doc |
18
+
19
+ ## Architecture
20
+
21
+ | Doc | Purpose |
22
+ |---|---|
23
+ | `architecture/README.md` | System architecture overview |
24
+ | `architecture/<adr>.md` | Per-decision ADRs |
25
+
26
+ ## Specs (per area)
27
+
28
+ | Doc | Area |
29
+ |---|---|
30
+ | `specs/_example.md` | Template — DO NOT edit; copy + rename |
31
+ | `specs/auth.md` | Authentication / authorization |
32
+ | `specs/billing.md` | Payment / subscription |
33
+ | `specs/email.md` | Email infrastructure |
34
+ | `specs/<area>.md` | (add per area) |
35
+
36
+ ## Sessions (archive)
37
+
38
+ | Doc | Purpose |
39
+ |---|---|
40
+ | `sessions/<date>.md` | Archived `CURRENT_WORK.md` content when it grew too long |
41
+
42
+ ## Reference / legal / compliance
43
+
44
+ | Doc | Purpose |
45
+ |---|---|
46
+ | `legal/<doc>.md` | Legal copy (privacy, terms, etc.) |
47
+ | `compliance/<doc>.md` | Audit / compliance notes |
48
+
49
+ ---
50
+
51
+ ## How to use
52
+
53
+ When you create a new doc under `docs/`, add a row to the appropriate table in this file. If the table doesn't exist, create it.
54
+
55
+ When a doc is archived or deleted, REMOVE its row (don't strikethrough — just delete).
56
+
57
+ This file is the LANDING PAGE for any new contributor. Keep it scannable in 30 seconds.
@@ -0,0 +1,44 @@
1
+ # PLANS — `<your-project>`
2
+
3
+ > **What this is**: long-term phase roadmap. Strategic — what major work remains and in what order.
4
+ > Updated infrequently (per quarter / major milestone).
5
+
6
+ > **Status (P0 placeholder)**: replace contents on first install.
7
+
8
+ ---
9
+
10
+ ## Phase summary
11
+
12
+ | Phase | Name | Status | Target |
13
+ |---|---|---|---|
14
+ | **P0** | Foundation | ✅ done | YYYY-MM-DD |
15
+ | **P1** | (e.g., Core auth + onboarding) | ⏳ in progress | YYYY-MM-DD |
16
+ | **P2** | (e.g., Billing + payment) | ⏳ planned | YYYY-MM-DD |
17
+ | **P3** | (e.g., Mobile parity) | ⏳ planned | YYYY-MM-DD |
18
+ | **P4** | (e.g., Public launch) | ⏳ planned | YYYY-MM-DD |
19
+
20
+ ---
21
+
22
+ ## Phase detail template
23
+
24
+ For each phase, document below with sections:
25
+
26
+ ```
27
+ ## P<n> — <name>
28
+
29
+ **Goal**: one sentence.
30
+
31
+ **Deliverables**:
32
+ - [ ] item 1
33
+ - [ ] item 2
34
+
35
+ **Stop condition**: what proves the phase is done.
36
+
37
+ **Risks**: known unknowns and mitigations.
38
+ ```
39
+
40
+ ---
41
+
42
+ ## Pause discipline
43
+
44
+ If priorities shift mid-phase, pause without guilt. Document the pause reason in `docs/CURRENT_WORK.md`. PLANS.md is a target, not a contract.
@@ -0,0 +1,40 @@
1
+ # `core/docs-templates/` — Universal doc template skeletons
2
+
3
+ Tool-agnostic markdown templates that every CONDUCTOR-installed project gets at `docs/<file>.md`. The same files install regardless of which AI coding tool drives the project — adapters do NOT transform these (they are already universal).
4
+
5
+ ## What lives here
6
+
7
+ | Template | Installed at | Purpose |
8
+ |---|---|---|
9
+ | `CURRENT_WORK.md` | `docs/CURRENT_WORK.md` | Session continuity. Always-load on session start. Lean (~150 lines max). |
10
+ | `REMAINING_TASKS.md` | `docs/REMAINING_TASKS.md` | Launch readiness dashboard / open scope. |
11
+ | `PLANS.md` | `docs/PLANS.md` | Long-term phase roadmap. |
12
+ | `TASKS.md` | `docs/TASKS.md` | Phase completion tracker. |
13
+ | `INDEX.md` | `docs/INDEX.md` | Document map — pointer to every other doc in `docs/`. |
14
+ | `specs/_example.md` | `docs/specs/_example.md` | Spec template. User renames + duplicates per area (e.g., `auth.md`, `billing.md`). |
15
+
16
+ ## Why these are universal
17
+
18
+ - They are plain markdown.
19
+ - They reference no tool-specific syntax.
20
+ - The same workflow phase definitions reference them regardless of tool.
21
+ - The `Read first every session` instruction in adapter outputs always points to `docs/CURRENT_WORK.md`.
22
+
23
+ ## Why they aren't transformed by adapters
24
+
25
+ Unlike `core/universal-rules/*` (which adapters re-emit with tool-specific front-matter), the doc templates are READ by every tool's chat session as plain markdown. No transformation needed.
26
+
27
+ The adapter's job is just to COPY them into the target project's `docs/` directory if they don't already exist (idempotent — never overwrite).
28
+
29
+ ## Status (P0 foundation)
30
+
31
+ All template files are PLACEHOLDERS. P1 fills them with starter content sanitized from the reference adopter.
32
+
33
+ ## Authoring guidance for P1
34
+
35
+ Each template should:
36
+ - Have a clear "What this is" header at the top.
37
+ - Use ATX headings.
38
+ - Include 1-2 example entries the user can immediately replace.
39
+ - Be SHORT (~30-100 lines). These are templates; the user grows them.
40
+ - Have NO project-specific names. Use generic placeholders (`<your-project>`, `<your-area>`).
@@ -0,0 +1,43 @@
1
+ # REMAINING TASKS — `<your-project>`
2
+
3
+ > **What this is**: open scope dashboard. Things that need to ship before launch / before next milestone.
4
+ > Updated when scope changes. NOT a daily task tracker (that's TASKS.md).
5
+
6
+ > **Status (P0 placeholder)**: replace contents on first install. P1 fills with a more developed example.
7
+
8
+ ---
9
+
10
+ ## Launch readiness
11
+
12
+ | Area | Status | Owner | Blocker |
13
+ |---|---|---|---|
14
+ | Auth flow | ⚠️ partial | (you) | (e.g., social login pending) |
15
+ | Billing | ⏳ planned | (you) | (e.g., payment-provider live activation) |
16
+ | Email infra | ✅ done | — | — |
17
+ | Mobile parity | ⚠️ partial | (you) | (e.g., iOS push notifications pending) |
18
+ | (add rows per area) | | | |
19
+
20
+ ---
21
+
22
+ ## Cross-cutting tasks
23
+
24
+ - [ ] (e.g., "i18n sync — propagate pricing copy across 8 locales")
25
+ - [ ] (e.g., "audit all `console.error` → migrate to `logError()`")
26
+ - [ ] (e.g., "verify CSP headers on production")
27
+
28
+ ---
29
+
30
+ ## Deferred (post-launch)
31
+
32
+ - [ ] (e.g., "bank-aggregator integration")
33
+ - [ ] (e.g., "Spring Boot microservices migration")
34
+ - [ ] (e.g., "GUI installer")
35
+
36
+ ---
37
+
38
+ ## How to use this file
39
+
40
+ - One row per launch-blocking area.
41
+ - Update status when it changes (⏳ planned / ⚠️ partial / ✅ done / ❌ blocked).
42
+ - When all areas are ✅, you're launch-ready.
43
+ - When a blocker resolves, mention it in `docs/CURRENT_WORK.md` session log.
@@ -0,0 +1,51 @@
1
+ # TASKS — `<your-project>`
2
+
3
+ > **What this is**: phase completion tracker. Per-phase task list with concrete work items.
4
+ > Updated as tasks complete.
5
+
6
+ > **Status (P0 placeholder)**: replace contents on first install.
7
+
8
+ ---
9
+
10
+ ## Active phase: P<n> — <name>
11
+
12
+ ### Tasks
13
+
14
+ - [ ] **Task 1** — short description
15
+ - File paths: `<web-app>/...`, `packages/shared/...`
16
+ - Stop condition: what proves done
17
+ - Owner / agent: (e.g., `@builder` Opus / human)
18
+ - [ ] **Task 2** — short description
19
+ - File paths:
20
+ - Stop condition:
21
+ - Owner / agent:
22
+ - [ ] **Task 3** — short description
23
+ - File paths:
24
+ - Stop condition:
25
+ - Owner / agent:
26
+
27
+ ---
28
+
29
+ ## Task entry template
30
+
31
+ ```
32
+ - [ ] **Task <n>** — <short description>
33
+ - File paths: <list of paths to read/edit>
34
+ - Stop condition: <what proves done>
35
+ - Owner / agent: <e.g., @builder Opus / @helper Sonnet / human>
36
+ ```
37
+
38
+ ---
39
+
40
+ ## Completed (last 10)
41
+
42
+ - [x] (move completed items here, newest at top)
43
+ - [x] (older completed items archive to `docs/sessions/<phase>.md` when this section grows past 10)
44
+
45
+ ---
46
+
47
+ ## How this differs from `REMAINING_TASKS.md`
48
+
49
+ - `REMAINING_TASKS.md` = high-level launch readiness dashboard (areas, not individual tasks).
50
+ - `TASKS.md` = current phase's discrete tasks with file paths and stop conditions.
51
+ - `CURRENT_WORK.md` = today's session: what's in progress right now.