cc-codeconductor 0.5.0 → 1.0.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 (174) hide show
  1. package/README.md +95 -95
  2. package/dist/cli/errors.d.ts +65 -0
  3. package/dist/core/compilation/compile-checker.d.ts +51 -0
  4. package/dist/core/config/codeconductor-config.d.ts +42 -0
  5. package/dist/core/config/config-loader.d.ts +11 -0
  6. package/dist/core/filesystem/credential-guard.d.ts +18 -0
  7. package/dist/core/goal/goal-planner.d.ts +8 -0
  8. package/dist/core/goal/goal-state.d.ts +15 -0
  9. package/dist/core/loop/git-stats.d.ts +13 -0
  10. package/dist/core/loop/loop-engine.d.ts +79 -0
  11. package/dist/core/memory/episodic-store.d.ts +6 -0
  12. package/dist/core/memory/operational-state.d.ts +6 -0
  13. package/dist/core/orchestrator/runtime-orchestrator.d.ts +25 -0
  14. package/dist/core/planner/product-planner.d.ts +18 -0
  15. package/dist/core/presets/package-paths.d.ts +4 -0
  16. package/dist/core/product-graph/graph-store.d.ts +11 -0
  17. package/dist/core/product-graph/paths.d.ts +18 -0
  18. package/dist/core/verification/verification-runner.d.ts +57 -0
  19. package/dist/domain/loop/loop-state.d.ts +74 -0
  20. package/dist/domain/product/entities.d.ts +11 -0
  21. package/dist/index.d.ts +15 -0
  22. package/dist/index.js +21820 -15579
  23. package/dist/library.js +2595 -0
  24. package/dist/utils/result.d.ts +36 -0
  25. package/dist/validation/schemas.d.ts +3660 -0
  26. package/package.json +15 -2
  27. package/policy.yml +12 -11
  28. package/presets/agy/AGENTS.md +11 -5
  29. package/presets/agy/gates/pre-commit/GATE.md +136 -0
  30. package/presets/agy/skills/cc-fix/SKILL.md +2 -2
  31. package/presets/agy/skills/cc-tdd-cycle/SKILL.md +11 -0
  32. package/presets/agy/workflows/cc-api-contract.md +12 -0
  33. package/presets/agy/workflows/cc-ask.md +55 -0
  34. package/presets/agy/workflows/cc-clarify.md +33 -0
  35. package/presets/agy/workflows/cc-council.md +31 -7
  36. package/presets/agy/workflows/cc-db-migration.md +22 -9
  37. package/presets/agy/workflows/cc-explore.md +37 -0
  38. package/presets/agy/workflows/cc-feature.md +41 -19
  39. package/presets/agy/workflows/cc-fix.md +50 -23
  40. package/presets/agy/workflows/cc-handoff.md +42 -0
  41. package/presets/agy/workflows/cc-iterative.md +128 -0
  42. package/presets/agy/workflows/cc-openspec.md +13 -0
  43. package/presets/agy/workflows/cc-pagespeed.md +12 -0
  44. package/presets/agy/workflows/cc-prototype.md +39 -0
  45. package/presets/agy/workflows/cc-refactor.md +12 -0
  46. package/presets/agy/workflows/cc-review.md +12 -0
  47. package/presets/agy/workflows/cc-scorecard.md +12 -0
  48. package/presets/agy/workflows/cc-tdd-cycle.md +24 -0
  49. package/presets/agy/workflows/cc-test-plan.md +12 -0
  50. package/presets/agy/workflows/cc-triage.md +35 -0
  51. package/presets/claude/CLAUDE.md +64 -0
  52. package/presets/claude/commands/cc/api-contract.md +12 -0
  53. package/presets/claude/commands/cc/ask.md +55 -0
  54. package/presets/claude/commands/cc/clarify.md +32 -0
  55. package/presets/claude/commands/cc/council.md +87 -0
  56. package/presets/claude/commands/cc/db-migration.md +22 -9
  57. package/presets/claude/commands/cc/explore.md +36 -0
  58. package/presets/claude/commands/cc/feature.md +49 -22
  59. package/presets/claude/commands/cc/fix.md +74 -20
  60. package/presets/claude/commands/cc/handoff.md +44 -0
  61. package/presets/claude/commands/cc/iterative.md +132 -0
  62. package/presets/claude/commands/cc/openspec.md +25 -0
  63. package/presets/claude/commands/cc/pagespeed.md +12 -0
  64. package/presets/claude/commands/cc/prototype.md +38 -0
  65. package/presets/claude/commands/cc/refactor.md +152 -1
  66. package/presets/claude/commands/cc/review.md +78 -16
  67. package/presets/claude/commands/cc/scorecard.md +12 -0
  68. package/presets/claude/commands/cc/tdd-cycle.md +53 -3
  69. package/presets/claude/commands/cc/test-plan.md +12 -0
  70. package/presets/claude/commands/cc/triage.md +34 -0
  71. package/presets/claude/gates/pre-commit/GATE.md +136 -0
  72. package/presets/claude/settings.json +8 -46
  73. package/presets/codex/AGENTS.md +6 -6
  74. package/presets/codex/commands/cc-ask.md +55 -0
  75. package/presets/codex/gates/pre-commit/GATE.md +136 -0
  76. package/presets/cursor/AGENTS.md +6 -6
  77. package/presets/cursor/agents/business-agent.md +44 -0
  78. package/presets/cursor/agents/continuous-architect.md +37 -0
  79. package/presets/cursor/agents/docs.md +1 -0
  80. package/presets/cursor/agents/goal-planner.md +1 -1
  81. package/presets/cursor/agents/impact-analyst.md +43 -0
  82. package/presets/cursor/agents/orchestrator.md +6 -6
  83. package/presets/cursor/commands/cc/api-contract.md +12 -0
  84. package/presets/cursor/commands/cc/ask.md +55 -0
  85. package/presets/cursor/commands/cc/clarify.md +32 -0
  86. package/presets/cursor/commands/cc/council.md +87 -0
  87. package/presets/cursor/commands/cc/db-migration.md +22 -9
  88. package/presets/cursor/commands/cc/explore.md +36 -0
  89. package/presets/cursor/commands/cc/feature.md +41 -19
  90. package/presets/cursor/commands/cc/fix.md +47 -20
  91. package/presets/cursor/commands/cc/handoff.md +41 -0
  92. package/presets/cursor/commands/cc/iterative.md +133 -0
  93. package/presets/cursor/commands/cc/openspec.md +22 -7
  94. package/presets/cursor/commands/cc/pagespeed.md +12 -0
  95. package/presets/cursor/commands/cc/prototype.md +38 -0
  96. package/presets/cursor/commands/cc/refactor.md +12 -0
  97. package/presets/cursor/commands/cc/review.md +12 -0
  98. package/presets/cursor/commands/cc/scorecard.md +12 -0
  99. package/presets/cursor/commands/cc/tdd-cycle.md +24 -0
  100. package/presets/cursor/commands/cc/test-plan.md +12 -0
  101. package/presets/cursor/commands/cc/triage.md +34 -0
  102. package/presets/cursor/gates/pre-commit/GATE.md +136 -0
  103. package/presets/cursor/rules/orchestration.mdc +1 -1
  104. package/presets/opencode/agents/architect.md +22 -1
  105. package/presets/opencode/agents/complexity-auditor.md +16 -1
  106. package/presets/opencode/agents/contract-builder.md +17 -1
  107. package/presets/opencode/agents/devil.md +158 -0
  108. package/presets/opencode/agents/docs.md +19 -1
  109. package/presets/opencode/agents/goal-planner.md +32 -2
  110. package/presets/opencode/agents/implementer.md +32 -2
  111. package/presets/opencode/agents/orchestrator.md +79 -12
  112. package/presets/opencode/agents/planner.md +61 -0
  113. package/presets/opencode/agents/repo-explorer.md +16 -0
  114. package/presets/opencode/agents/reviewer.md +33 -3
  115. package/presets/opencode/agents/security-reviewer.md +31 -1
  116. package/presets/opencode/agents/task-coach.md +69 -1
  117. package/presets/opencode/agents/tester.md +18 -1
  118. package/presets/opencode/commands/cc-api-contract.md +12 -0
  119. package/presets/opencode/commands/cc-ask.md +55 -0
  120. package/presets/opencode/commands/cc-clarify.md +31 -0
  121. package/presets/opencode/commands/cc-council.md +87 -0
  122. package/presets/opencode/commands/cc-db-migration.md +22 -9
  123. package/presets/opencode/commands/cc-explore.md +35 -0
  124. package/presets/opencode/commands/cc-feature.md +41 -19
  125. package/presets/opencode/commands/cc-fix.md +50 -23
  126. package/presets/opencode/commands/cc-handoff.md +40 -0
  127. package/presets/opencode/commands/cc-iterative.md +127 -0
  128. package/presets/opencode/commands/cc-openspec.md +13 -0
  129. package/presets/opencode/commands/cc-pagespeed.md +12 -0
  130. package/presets/opencode/commands/cc-prototype.md +37 -0
  131. package/presets/opencode/commands/cc-refactor.md +12 -0
  132. package/presets/opencode/commands/cc-review.md +12 -0
  133. package/presets/opencode/commands/cc-scorecard.md +12 -0
  134. package/presets/opencode/commands/cc-tdd-cycle.md +24 -0
  135. package/presets/opencode/commands/cc-test-plan.md +12 -0
  136. package/presets/opencode/commands/cc-triage.md +33 -0
  137. package/presets/opencode/gates/pre-commit/GATE.md +136 -0
  138. package/presets/opencode/prompts/v0.1.0/DEPRECATED.md +11 -0
  139. package/presets/opencode/prompts/v0.2.0/DEPRECATED.md +11 -0
  140. package/presets/opencode/prompts/v0.3.0/DEPRECATED.md +11 -0
  141. package/presets/opencode/prompts/v0.4.0/DEPRECATED.md +11 -0
  142. package/presets/opencode/prompts/v0.5.0/goal-planner.md +1 -1
  143. package/presets/opencode/prompts/v0.5.0/orchestrator.md +6 -6
  144. package/presets/opencode/prompts/v0.6.0/implementer.md +35 -0
  145. package/presets/opencode/prompts/v0.6.0/planner.md +36 -0
  146. package/presets/opencode/prompts/v0.6.0/reviewer.md +40 -0
  147. package/presets/opencode/prompts/v1.0.0/README.md +47 -0
  148. package/presets/opencode/prompts/v1.0.0/architect.md +259 -0
  149. package/presets/opencode/prompts/v1.0.0/complexity-auditor.md +116 -0
  150. package/presets/opencode/prompts/v1.0.0/contract-builder.md +120 -0
  151. package/presets/opencode/prompts/v1.0.0/devil.md +169 -0
  152. package/presets/opencode/prompts/v1.0.0/docs.md +229 -0
  153. package/presets/opencode/prompts/v1.0.0/goal-planner.md +123 -0
  154. package/presets/opencode/prompts/v1.0.0/implementer.md +228 -0
  155. package/presets/opencode/prompts/v1.0.0/orchestrator.md +474 -0
  156. package/presets/opencode/prompts/v1.0.0/planner.md +72 -0
  157. package/presets/opencode/prompts/v1.0.0/repo-explorer.md +147 -0
  158. package/presets/opencode/prompts/v1.0.0/reviewer.md +295 -0
  159. package/presets/opencode/prompts/v1.0.0/security-reviewer.md +170 -0
  160. package/presets/opencode/prompts/v1.0.0/task-coach.md +235 -0
  161. package/presets/opencode/prompts/v1.0.0/tester.md +298 -0
  162. package/presets/seo-hotel/settings.json +0 -17
  163. package/src/presets/manifests/agy.yml +2 -2
  164. package/src/presets/manifests/claude.yml +2 -2
  165. package/src/presets/manifests/codex.yml +2 -2
  166. package/src/presets/manifests/cursor.yml +2 -2
  167. package/src/presets/manifests/gemini.yml +2 -2
  168. package/src/presets/manifests/opencode.yml +2 -2
  169. package/src/presets/models/agy.yml +93 -66
  170. package/src/presets/models/claude.yml +79 -53
  171. package/src/presets/models/codex.yml +79 -54
  172. package/src/presets/models/cursor.yml +72 -58
  173. package/src/presets/models/gemini.yml +79 -53
  174. package/src/presets/models/opencode.yml +72 -46
package/README.md CHANGED
@@ -13,93 +13,55 @@ contracts, task cards, and risk-based routing.
13
13
  >
14
14
  > ## Current Scope
15
15
  >
16
- > What works today:
16
+ > Canonical matrix: [docs/current-status.md](docs/current-status.md).
17
+ > Published package is **0.5.0**. The next documented release is **v1.0.0**
18
+ > (Product OS). This repository: `bun run dev …` (not `npx`) while iterating.
19
+ >
20
+ > Published in 0.5.0:
17
21
  >
18
22
  > - `npx cc-codeconductor init` — detects project stack, writes
19
23
  > `.codeconductor/config.yml`, copies `council.yml` and `policy.yml` into
20
24
  > `.codeconductor/presets/`
21
- > - `npx cc-codeconductor install council --target <opencode|claude|codex|agy|all>`
22
- > generates and writes preset files; supports `--global` to install to
23
- > `~/.opencode/`, `~/.claude/`, `~/.codex/`, `~/.agents/`
24
- > - `npx cc-codeconductor install lsp --target <opencode|claude|codex|gemini|cursor|agy|all>`
25
- > installs LSP servers and configures AI coding tools; auto-detects project
26
- > languages or use `--lang` to override
27
- > - `npx cc-codeconductor detect` detects project stack and recommends presets
28
- > - `npx cc-codeconductor doctor`validates configuration and installed runner
29
- > directories
30
- > - `npx cc-codeconductor update` re-applies the council preset for the configured
31
- > target
32
- > - `npx cc-codeconductor seo audit --url <url>` runs a comprehensive SEO audit
33
- > on a single page (meta tags, schema.org, GEO readiness) and generates a
34
- > markdown report
35
- > - `npx cc-codeconductor seo audit --sitemap <url>` — batch audits all URLs from
36
- > a sitemap.xml with rate limiting and SSRF prevention
37
- > - `npx cc-codeconductor seo llms --sitemap <url>` — generates a `llms.txt` file
38
- > for AI-search readiness from sitemap content
39
- > - `npx cc-codeconductor help` (alias: `cc-help`) shows preset inventory
40
- > (skills, subagents, commands) for the active or specified target
41
- > - `npx cc-codeconductor debt-harvest` (alias: `harvest`) — scans source files
42
- > for `// defer` comments and writes `.codeconductor/debt-ledger.md`
43
- > - `npx cc-codeconductor goal "<objective>"` (alias: `cc-goal`) — decomposes an
44
- > objective into a dependency-ordered task graph, writes
45
- > `.codeconductor/current-goal.yml`
46
- > - `/cc-pagespeed --url <url>` — audits web performance using the PageSpeed
47
- > Insights API; applies the 80/20 principle to produce a prioritized report of
48
- > Core Web Vitals (LCP, TBT, CLS, FCP, TTFB) with framework-specific fixes;
49
- > requires `PAGESPEED_API_KEY` env var for full CrUX field data (optional but
50
- > recommended)
51
- > - `npx cc-codeconductor install preset --target <opencode|claude|codex|agy|all>` —
52
- > installs the full preset (agents, prompts, skills, commands, settings) for the
53
- > chosen runner; use `--locale=es` to inject Spanish-aware instructions into
54
- > agent files, or rely on the locale saved during `init`
55
- > - **Stack-specific presets (v0.4.0)**: `ts-next-drizzle`, `spring-kotlin-jpa`,
56
- > `laravel-tall`, `python-data-api` — bundle `architect` + `implementer`
57
- > contracts tuned to a single framework so `install preset` drops in the right
58
- > defaults for that stack.
59
- > - **9 specialized skills (v0.4.0)**: `drizzle-schema-architect`,
60
- > `tailwind-responsive-auditor`, `seo-analytics-injector`,
61
- > `jpa-nplusone-detector`, `spring-auth-auditor`, `livewire-alpine-bridge`,
62
- > `fastapi-pydantic-strict`, `tdd-mutation-tester`, `auth-token-inspector` —
63
- > loaded automatically by the matching preset.
64
- > - **Workflow Loop Core (v0.4.0)** — 8-phase pipeline
65
- > (`intake → structure → design → test → implement → validate → council →
66
- > compact`) with operational guardrails (wall-clock timeout, max files
67
- > modified, max lines changed) and human-in-the-loop STOP gates after Design
68
- > and Council Verdict.
69
- > - **Council consensus v0.4.0** — agent confidence thresholds
70
- > (`< 0.6` per-agent or `< 0.7` average escalates) and a `complianceVeto`
71
- > channel that overrides majority the same way `securityVeto` does.
72
- > - **Goal orchestration (v0.4.0)** — `goal` planner writes
73
- > `.codeconductor/current-goal.yml`; the orchestrator delegates tasks in
74
- > dependency order and blocks dependents when a prerequisite is `blocked`.
75
- > - **Memory compression + escalation emitter (v0.4.0)** — Phase 5 memory index
76
- > + token budget hook keeps inter-agent context below the configured budget;
77
- > the loop controller emits escalation reports when guardrails fire.
78
- > - **Parallel subagents (v0.4.0)** — risk-based routing policy v0.4.0 enables
79
- > parallel execution for eligible agent sequences (architect + implementer
80
- > pattern, council verdict fan-out).
81
- > - Manual presets for OpenCode, Claude Code, and Codex
82
- > - Versioned Agent Contracts
83
- > - Routing Policy documentation
84
- > - Task Card, Scorecard, and workflow templates
85
- > - Spring Boot/Kotlin and Python/Django workflow guidance
25
+ > - `npx cc-codeconductor install council --target <opencode|claude|codex|agy|all>`
26
+ > - `npx cc-codeconductor install preset --target <opencode|claude|codex|gemini|cursor|agy|all>`
27
+ > - `npx cc-codeconductor install lsp --target <…>`
28
+ > - `npx cc-codeconductor detect` / `doctor` / `update`
29
+ > - `npx cc-codeconductor seo audit` / `seo llms` (SSRF-guarded fetch)
30
+ > - `npx cc-codeconductor help` / `cc-help`
31
+ > - `npx cc-codeconductor debt-harvest` (alias: `harvest`)
32
+ > - `npx cc-codeconductor ccep …` CCEP is the canonical consumer workflow loop
33
+ > - `npx cc-codeconductor openspec …` — OpenSpec is a **delivery loop** and the
34
+ > backlog tool (`validate` / `scan` / `plan` / `status` / `next`)
35
+ > - `npx cc-codeconductor scorecard …`
36
+ > - Slash commands after `install preset`prefer `/cc-iterative`, `/cc-triage`,
37
+ > `/cc-handoff`; `/cc-openspec` runs the OpenSpec loop
38
+ > - `/cc-pagespeed --url <url>` — PageSpeed Insights / Core Web Vitals after
39
+ > `install preset`; `PAGESPEED_API_KEY` is optional but recommended for CrUX
40
+ > field data (see [docs/pagespeed-usage.md](docs/pagespeed-usage.md))
41
+ > - Stack-specific skill selection (`ts-next-drizzle`, `spring-kotlin-jpa`,
42
+ > `laravel-tall`, `python-data-api`)
43
+ > - Council consensus: confidence thresholds + `securityVeto` / `complianceVeto`
86
44
  >
87
- > See [docs/v0.4.0-release-notes.md](docs/v0.4.0-release-notes.md) for the
88
- > full v0.4.0 feature breakdown.
45
+ > Documented as **v1.0.0** (in this repo, not in published 0.5.0):
89
46
  >
90
- > What does not exist yet:
47
+ > - `goal` / `ingest` / `product` / `orchestrate` / `impact` / `verify`
48
+ > - Product graph in `.codeconductor/product-graph.json`
49
+ > - See [docs/v1.0.0-release-notes.md](docs/v1.0.0-release-notes.md)
50
+ >
51
+ > Experimental (library only, not a CLI runtime):
91
52
  >
92
- > - Runtime sandbox enforcement
93
- > - Policy compiler
94
- > - Automated agent evaluation
95
- > - Safe Merger
53
+ > - `runWorkflowPipeline()` 8-phase loop in `src/core/pipeline/workflow-loop.ts`
54
+ >
55
+ > What does not exist yet:
96
56
  >
97
- > Security note:
57
+ > - Runtime sandbox / OS-level isolation
58
+ > - Policy compiler / uniform target enforcement
59
+ > - Full stack-specific asset pruning
98
60
  >
99
- > CodeConductor currently provides declarative policies and documented
100
- > guardrails. It does not yet enforce OS-level isolation, shell sandboxing, or
101
- > runtime permission boundaries by itself. Treat all agent execution as
102
- > dependent on the capabilities and limitations of the target tool.
61
+ > Security note: policies are declarative. Agent execution depends on the
62
+ > target runner. `install preset --target cursor` overwrites runner command
63
+ > dirs; maintainer-only stubs (`cc-self-review`, `cc-update-preset-models`)
64
+ > are skipped so this repo can dogfood `install preset`.
103
65
 
104
66
  ---
105
67
 
@@ -168,7 +130,7 @@ Task Card → Risk Classification → Routing Policy → Conductor Agent → Del
168
130
  - Provider-agnostic `AgentContract` abstraction with target renderers for Claude, OpenCode, Codex, and Agy
169
131
  - Council consensus engine (`councilConsensus()`) for multi-agent governance with majority/unanimous algorithms, security veto, **compliance veto**, and **agent confidence thresholds** (v0.4.0)
170
132
  - Phase 5 runtime modules — scoped context injection, TDD history compaction, concise inter-agent messaging, and token budget enforcement in the compile-fix loop
171
- - **Workflow Loop Core (v0.4.0)** — 8-phase pipeline (`runWorkflowPipeline`) with wall-clock / files-modified / lines-changed guardrails and STOP gates at Design and Council Verdict
133
+ - **Workflow Loop Core (v0.4.0, experimental)** — 8-phase pipeline (`runWorkflowPipeline`) with wall-clock / files-modified / lines-changed guardrails and STOP gates at Design and Council Verdict (library-only; not a shipped CLI runtime)
172
134
  - **Stack-specific presets (v0.4.0)** — `ts-next-drizzle`, `spring-kotlin-jpa`, `laravel-tall`, `python-data-api`
173
135
  - **9 specialized skills (v0.4.0)** — drizzle-schema-architect, tailwind-responsive-auditor, seo-analytics-injector, jpa-nplusone-detector, spring-auth-auditor, livewire-alpine-bridge, fastapi-pydantic-strict, tdd-mutation-tester, auth-token-inspector
174
136
  - **Goal orchestration (v0.4.0)** — `goal` planner + `goal-state` writer feed the orchestrator's dependency-order delegation loop
@@ -176,6 +138,41 @@ Task Card → Risk Classification → Routing Policy → Conductor Agent → Del
176
138
 
177
139
  ---
178
140
 
141
+ ## Programmatic API
142
+
143
+ `cc-codeconductor` ships a library entry in addition to the CLI. The `bin`
144
+ commands still resolve to `dist/index.js`. Application code should import the
145
+ package root:
146
+
147
+ ```ts
148
+ import {
149
+ LoopEngine,
150
+ runLoop,
151
+ runVerification,
152
+ getNextTask,
153
+ startTask,
154
+ completeTask,
155
+ loopStateMachine,
156
+ createInitialState,
157
+ } from 'cc-codeconductor';
158
+ ```
159
+
160
+ Exported surface (stable for this minor):
161
+
162
+ - Orchestrator: `getReadyTasks`, `getNextTask`, `startTask`, `completeTask`, `goalTaskToCanonicalCard`, `buildTaskEnvelope`, `formatGoalStatus`
163
+ - Loop engine (TC3): `LoopEngine`, `runLoop`, `runLoopForProject`, `shouldRunAgentLoop`, `formatFeedback`
164
+ - Verification: `runVerification`, `gateTaskCompletion`, `validateEvidenceIds`
165
+ - Zod contracts: everything from `src/validation/schemas.ts`
166
+ - Domain loop: `createInitialState`, `loopStateMachine` and their types
167
+
168
+ `infrastructure/` and `*-internal` modules are not part of the public API.
169
+
170
+ ```bash
171
+ bun run build # CLI → dist/index.js, library → dist/library.js + .d.ts
172
+ ```
173
+
174
+ ---
175
+
179
176
  ## CLI Usage
180
177
 
181
178
  ### Install
@@ -292,7 +289,12 @@ const next = getPreset('ts-next-drizzle');
292
289
  ```
293
290
 
294
291
  `init` / `detect` identifies the stack from the project and wires the
295
- matching specialized skills automatically when you run `install preset`.
292
+ matching specialized skills onto the **generic** target workflow when you run
293
+ `install preset`. Full stack-specific asset pruning/replacement (swapping the
294
+ entire agent/command tree for a stack pack) is **not implemented yet** — the
295
+ registry and skill wiring are real; treat claims of a full stack install swap
296
+ as aspirational until that lands.
297
+
296
298
  The full set of assets for a stack-specific preset is in
297
299
  `presets/<preset-name>/agents/` — copy them manually if you need to apply a
298
300
  preset by name.
@@ -347,17 +349,19 @@ npx cc-codeconductor update --global
347
349
 
348
350
  Smart updates all currently installed target presets, council configurations, and skills (from `skills-lock.json`), preserving user edits outside managed blocks. Also validates that `AGENTS.md` and `CLAUDE.md` do not exceed the 40KB size limit.
349
351
 
350
- #### `help` — show preset inventory
352
+ #### `help` / `cc-help` distinct help contracts
351
353
 
352
354
  ```bash
353
- npx cc-codeconductor help # show inventory for active target
354
- npx cc-codeconductor help --target claude # show inventory for specific target
355
- npx cc-codeconductor cc-help # alias
356
- npx cc-codeconductor help --output json # machine-readable output
355
+ npx cc-codeconductor help # general CLI usage
356
+ npx cc-codeconductor --help # same general usage text
357
+ npx cc-codeconductor cc-help # preset inventory for active target
358
+ npx cc-codeconductor cc-help --target claude # inventory for a specific target
359
+ npx cc-codeconductor cc-help --output json # machine-readable inventory
357
360
  ```
358
361
 
359
- Lists the skills, subagents, commands, and workflows available in the active
360
- preset. Reads from `presets/<target>/` in the project root.
362
+ `help` prints the CLI command list. `cc-help` lists skills, subagents,
363
+ commands, and workflows for the active preset (or a specified `--target`).
364
+ Reads inventory from `presets/<target>/` in the project root.
361
365
 
362
366
  #### `debt-harvest` — collect deferred debt items
363
367
 
@@ -531,15 +535,11 @@ codeconductor/
531
535
 
532
536
  ## Roadmap
533
537
 
534
- | Version | Focus |
535
- | ---------- | ----------------------------------------------------------- |
536
- | **v0.2.0** | **CLI: init, detect, install, doctor, update — shipped** ✅ |
537
- | v0.3.0 | Next.js, FastAPI, generic presets, monorepo support |
538
- | **v0.4.0** | **Workflow Loop Core, stack-specific presets, 9 specialized skills, confidence thresholds + compliance veto in council consensus, goal orchestration, memory compression — shipped** ✅ |
539
- | v0.5.0 | Scorecard CLI, prompt contracts v0.5.0 (Evaluation gate, 3 new agents, Grok fallback) — shipped ✅ |
540
- | v1.0.0 | Stable contracts, stable routing, documented evaluation |
538
+ Published package: **0.5.0**. The next documented release is **v1.0.0**
539
+ (Product OS). Details: [docs/current-status.md](docs/current-status.md) and
540
+ [docs/v1.0.0-release-notes.md](docs/v1.0.0-release-notes.md).
541
541
 
542
- See [ROADMAP.md](ROADMAP.md) for details.
542
+ See [ROADMAP.md](ROADMAP.md) for historical notes.
543
543
 
544
544
  ---
545
545
 
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Exit codes as per CLI contract
3
+ */
4
+ export declare const ExitCode: {
5
+ readonly SUCCESS: 0;
6
+ readonly VALIDATION_ERROR: 1;
7
+ readonly UNSAFE_OPERATION: 2;
8
+ readonly UNSUPPORTED_PROJECT: 3;
9
+ readonly CONFIG_CONFLICT: 4;
10
+ readonly CREDENTIAL_LEAK: 5;
11
+ };
12
+ export type ExitCodeType = (typeof ExitCode)[keyof typeof ExitCode];
13
+ /**
14
+ * Base error class for CLI errors
15
+ */
16
+ export declare class CliError extends Error {
17
+ readonly code: ExitCodeType;
18
+ readonly details?: unknown | undefined;
19
+ constructor(message: string, code: ExitCodeType, details?: unknown | undefined);
20
+ }
21
+ /**
22
+ * Validation error - invalid arguments, malformed config, Zod validation failure
23
+ */
24
+ export declare class ValidationError extends CliError {
25
+ constructor(message: string, details?: unknown);
26
+ }
27
+ /**
28
+ * Unsafe operation - destructive operation without --force, protected path conflict
29
+ */
30
+ export declare class UnsafeOperationError extends CliError {
31
+ constructor(message: string, details?: unknown);
32
+ }
33
+ /**
34
+ * Unsupported project - project stack not detected or not supported
35
+ */
36
+ export declare class UnsupportedProjectError extends CliError {
37
+ constructor(message: string, details?: unknown);
38
+ }
39
+ /**
40
+ * Config conflict - existing config conflicts with requested operation
41
+ */
42
+ export declare class ConfigConflictError extends CliError {
43
+ constructor(message: string, details?: unknown);
44
+ }
45
+ /**
46
+ * Credential leak - content contains secrets or API keys
47
+ */
48
+ export declare class CredentialGuardError extends CliError {
49
+ readonly matches: ReadonlyArray<{
50
+ filePath: string;
51
+ line: number;
52
+ pattern: string;
53
+ matched: string;
54
+ }>;
55
+ constructor(message: string, matches: ReadonlyArray<{
56
+ filePath: string;
57
+ line: number;
58
+ pattern: string;
59
+ matched: string;
60
+ }>, details?: unknown);
61
+ }
62
+ /**
63
+ * Map error to exit code
64
+ */
65
+ export declare function getExitCode(error: unknown): ExitCodeType;
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Compile Check — runs a build command via Bun.spawn, captures output,
3
+ * parses errors, and returns structured results for re-injection.
4
+ */
5
+ export interface CompileError {
6
+ file: string;
7
+ line?: number;
8
+ column?: number;
9
+ code: string;
10
+ message: string;
11
+ raw: string;
12
+ }
13
+ export interface CompileResult {
14
+ success: boolean;
15
+ exitCode: number;
16
+ stdout: string;
17
+ stderr: string;
18
+ errors: CompileError[];
19
+ durationMs: number;
20
+ timedOut: boolean;
21
+ }
22
+ export interface CompileCheckOptions {
23
+ /**
24
+ * Shell command to run (string or pre-split args). Default: `tsc --noEmit`.
25
+ * Must be a project-trusted compile command from config, never unsanitized CLI input.
26
+ */
27
+ command?: string | string[];
28
+ /** Working directory. Default: process.cwd() */
29
+ cwd?: string;
30
+ /** Timeout in milliseconds. Default: 120 000 (2 min) */
31
+ timeoutMs?: number;
32
+ }
33
+ /**
34
+ * Tokenize a shell command string, respecting single and double quotes.
35
+ *
36
+ * Exported so other modules that must spawn configured commands (e.g. the
37
+ * regression checklist) can avoid invoking a shell entirely.
38
+ */
39
+ export declare function tokenizeCommand(cmd: string): string[];
40
+ export declare function isAllowlistedCompileCommand(command: string | string[]): boolean;
41
+ /** Allowlisted commands that actually run a test suite (`bun test`, `npm test`, …). */
42
+ export declare function isAllowlistedTestCommand(command: string | string[]): boolean;
43
+ /**
44
+ * Parse compile stderr output into structured CompileError[].
45
+ * Tries TypeScript format first, then ESLint, then generic.
46
+ */
47
+ export declare function parseCompileErrors(stderr: string): CompileError[];
48
+ /**
49
+ * Run a compile check via Bun.spawn with configurable timeout.
50
+ */
51
+ export declare function runCompileCheck(options?: CompileCheckOptions): Promise<CompileResult>;
@@ -0,0 +1,42 @@
1
+ /**
2
+ * CodeConductor configuration interface
3
+ */
4
+ export interface CodeConductorConfig {
5
+ version: string;
6
+ project: {
7
+ name: string;
8
+ profile?: string;
9
+ };
10
+ defaults: {
11
+ target: 'opencode' | 'claude' | 'codex' | 'gemini' | 'cursor' | 'agy';
12
+ overwrite: boolean;
13
+ locale: 'en' | 'es';
14
+ };
15
+ presets: {
16
+ council: {
17
+ enabled: boolean;
18
+ version: string;
19
+ };
20
+ };
21
+ safety: {
22
+ destructiveCommands: string[];
23
+ secretPatterns: string[];
24
+ compileCheck?: {
25
+ enabled: boolean;
26
+ command?: string;
27
+ timeoutMs?: number;
28
+ };
29
+ };
30
+ loop?: {
31
+ enabled?: boolean;
32
+ maxIterations?: number;
33
+ maxTokenBudget?: number;
34
+ };
35
+ }
36
+ /**
37
+ * Default configuration.
38
+ * `safety.secretPatterns` references `DEFAULT_SECRET_PATTERNS` from
39
+ * credential-guard.ts so there is a single source of truth for default
40
+ * credential patterns.
41
+ */
42
+ export declare const DEFAULT_CONFIG: CodeConductorConfig;
@@ -0,0 +1,11 @@
1
+ import { ValidationError } from '../../cli/errors';
2
+ import { type Result } from '../../utils/result';
3
+ import type { CodeConductorConfig } from './codeconductor-config';
4
+ /**
5
+ * Load configuration from project root
6
+ */
7
+ export declare function loadConfig(projectRoot: string): Promise<Result<CodeConductorConfig, ValidationError>>;
8
+ /**
9
+ * Check if config exists
10
+ */
11
+ export declare function configExists(projectRoot: string): Promise<boolean>;
@@ -0,0 +1,18 @@
1
+ import type { CodeConductorConfig } from '../config/codeconductor-config';
2
+ /**
3
+ * Default keyword patterns. Empty by design: built-in detection is handled by
4
+ * the high-confidence signatures in `safety.ts`, which match provider-specific
5
+ * credential shapes instead of generic keyword assignments. Keyword matching
6
+ * remains available as an opt-in via project `secretPatterns`.
7
+ */
8
+ export declare const DEFAULT_SECRET_PATTERNS: string[];
9
+ /**
10
+ * Load opt-in keyword patterns by merging sources in priority order:
11
+ * 1. CodeConductorConfig.safety.secretPatterns (highest — user/project overrides)
12
+ * 2. policy.yml secretPatterns (declarative policy)
13
+ * 3. DEFAULT_SECRET_PATTERNS (empty — see above)
14
+ *
15
+ * These are additive to the always-on high-confidence signatures.
16
+ * Note: policy.yml loading is async, so this function is async.
17
+ */
18
+ export declare function loadCredentialPatterns(config?: CodeConductorConfig): Promise<ReadonlyArray<string>>;
@@ -0,0 +1,8 @@
1
+ import type { GoalGraphInput } from '../../validation/schemas';
2
+ /**
3
+ * Pure function: objective string → GoalGraph
4
+ *
5
+ * Matches the objective against built-in templates (auth, crud, search,
6
+ * notification, migration) or falls back to a generic 4-task chain.
7
+ */
8
+ export declare function planGoal(objective: string): GoalGraphInput;
@@ -0,0 +1,15 @@
1
+ import { type GoalGraphInput } from '../../validation/schemas';
2
+ import { type Result } from '../../utils/result';
3
+ /**
4
+ * Write a goal graph to .codeconductor/current-goal.yml
5
+ */
6
+ export declare function writeGoal(projectRoot: string, graph: GoalGraphInput): Promise<Result<void, Error>>;
7
+ /**
8
+ * Load and validate a goal graph from .codeconductor/current-goal.yml
9
+ */
10
+ export declare function loadGoal(projectRoot: string): Promise<Result<GoalGraphInput, Error>>;
11
+ /**
12
+ * Mark a task as blocked in the goal graph.
13
+ * Loads the graph, finds the task by ID, sets status to 'blocked', and writes back.
14
+ */
15
+ export declare function markTaskBlocked(projectRoot: string, taskId: string, reason: string): Promise<Result<void, Error>>;
@@ -0,0 +1,13 @@
1
+ /** Shared TTL so loop iterations do not spawn git on every tick. */
2
+ export declare const GIT_STATS_CACHE_TTL_MS = 3000;
3
+ export interface GitChangeStats {
4
+ readonly filesModified: number;
5
+ readonly linesChanged: number;
6
+ }
7
+ export type GitStatsReader = (cwd: string) => Promise<GitChangeStats>;
8
+ export declare function resetGitStatsCache(): void;
9
+ export declare function fetchGitChangeStats(cwd: string): Promise<GitChangeStats>;
10
+ export declare function readGitChangeStats(cwd: string, options?: {
11
+ readonly now?: number;
12
+ readonly fetch?: GitStatsReader;
13
+ }): Promise<GitChangeStats>;
@@ -0,0 +1,79 @@
1
+ import { type CompileError, type CompileResult } from '../compilation/compile-checker';
2
+ import { type LoopState, type TddState } from '../../domain/loop/loop-state';
3
+ import { type GitStatsReader } from './git-stats';
4
+ import { type Result } from '../../utils/result';
5
+ export interface LoopConfig {
6
+ maxIterations?: number;
7
+ maxTokenBudget?: number;
8
+ buildCommand?: string;
9
+ cwd?: string;
10
+ maxWallClockSeconds?: number;
11
+ maxFilesModified?: number;
12
+ maxLinesChanged?: number;
13
+ gitStats?: GitStatsReader;
14
+ }
15
+ export interface EscalationReport {
16
+ readonly taskTitle: string;
17
+ readonly iterationsAttempted: number;
18
+ readonly errorHistory: readonly (readonly CompileError[])[];
19
+ readonly attemptedFixes: readonly string[];
20
+ readonly originalContext: string;
21
+ readonly recommendedAction: string;
22
+ }
23
+ export interface LoopResult {
24
+ readonly success: boolean;
25
+ readonly iterations: number;
26
+ readonly totalErrors: number;
27
+ readonly finalPhase: LoopState['phase'];
28
+ readonly escalationReport?: EscalationReport;
29
+ readonly errorHistory: readonly (readonly CompileError[])[];
30
+ }
31
+ export type GuardrailHit = {
32
+ readonly kind: 'timeout';
33
+ readonly elapsedSeconds: number;
34
+ readonly limit: number;
35
+ } | {
36
+ readonly kind: 'files';
37
+ readonly count: number;
38
+ readonly limit: number;
39
+ } | {
40
+ readonly kind: 'lines';
41
+ readonly count: number;
42
+ readonly limit: number;
43
+ };
44
+ /**
45
+ * Shared wall-clock / git-diff budget checks for compile-fix and the 8-phase pipeline.
46
+ */
47
+ export declare class LoopEngine {
48
+ private readonly limits;
49
+ readonly startedAt: number;
50
+ constructor(limits: {
51
+ readonly maxWallClockSeconds?: number;
52
+ readonly maxFilesModified?: number;
53
+ readonly maxLinesChanged?: number;
54
+ readonly cwd?: string;
55
+ }, gitStats?: GitStatsReader, startedAt?: number);
56
+ private readonly gitStats;
57
+ evaluate(scope?: 'time' | 'all'): Promise<GuardrailHit | null>;
58
+ }
59
+ export declare function formatFeedback(errors: readonly CompileError[]): string;
60
+ export type GenerateFn = (feedback?: string) => Promise<{
61
+ tokenUsage: number;
62
+ } | void>;
63
+ export type CompileCheckFn = () => Promise<CompileResult>;
64
+ export declare function runLoop(generateFn: GenerateFn, compileCheckFn: CompileCheckFn, config?: LoopConfig, taskTitle?: string, originalTask?: string): Promise<LoopResult>;
65
+ /** implement / test agent phases that must run the compile-fix engine. */
66
+ export declare function shouldRunAgentLoop(type?: string, agentType?: string, phase?: string): boolean;
67
+ /**
68
+ * Apply runner-captured TDD suite evidence to the domain TDD machine.
69
+ * Hand-written evidence files fail closed via `loadTddSuiteEvidence`.
70
+ */
71
+ export declare function advanceTddPhase(projectRoot: string, taskId: string, state: TddState, evidenceId: string): Promise<Result<{
72
+ state: TddState;
73
+ result: 'CONTINUE' | 'TERMINATE';
74
+ }, Error>>;
75
+ export declare function runLoopForProject(projectRoot: string, options: {
76
+ readonly taskTitle: string;
77
+ readonly allowCompileCheck?: boolean;
78
+ readonly originalTask?: string;
79
+ }): Promise<LoopResult>;
@@ -0,0 +1,6 @@
1
+ import { type ProductEventInput } from '../../validation/schemas';
2
+ import { type Result } from '../../utils/result';
3
+ export declare function appendEvent(projectRoot: string, event: Omit<ProductEventInput, 'id'> & {
4
+ id?: string;
5
+ }): Promise<Result<ProductEventInput, Error>>;
6
+ export declare function listEvents(projectRoot: string, since?: string, type?: ProductEventInput['type']): Promise<Result<ProductEventInput[], Error>>;
@@ -0,0 +1,6 @@
1
+ import { type OperationalStateInput } from '../../validation/schemas';
2
+ import { type Result } from '../../utils/result';
3
+ export declare function loadOperationalState(projectRoot: string): Promise<Result<OperationalStateInput, Error>>;
4
+ export declare function saveOperationalState(projectRoot: string, state: OperationalStateInput): Promise<Result<void, Error>>;
5
+ export declare function setActiveTask(projectRoot: string, taskId: string, agent?: string): Promise<Result<void, Error>>;
6
+ export declare function clearActiveTask(projectRoot: string, taskId: string): Promise<Result<void, Error>>;
@@ -0,0 +1,25 @@
1
+ import type { CanonicalTaskCardInput, GoalGraphInput, GoalTaskInput, OperationalStateInput } from '../../validation/schemas';
2
+ import { type Result } from '../../utils/result';
3
+ import type { CommandEnvelopeInput } from '../../validation/schemas';
4
+ /**
5
+ * Undo a task status change and restore the operational state captured before
6
+ * it. Used when a later step fails, so a task is never left half-transitioned.
7
+ * The original failure is returned, annotated when the undo itself fails.
8
+ */
9
+ export declare function rollbackTaskStatus(projectRoot: string, graph: GoalGraphInput, task: GoalTaskInput, previousStatus: GoalTaskInput['status'], previousState: OperationalStateInput, cause: Error): Promise<Result<never, Error>>;
10
+ export declare function getReadyTasks(graph: GoalGraphInput): GoalTaskInput[];
11
+ export declare function goalTaskToCanonicalCard(task: GoalTaskInput & {
12
+ targetFiles?: string[];
13
+ agentType?: string;
14
+ evidenceRequired?: string[];
15
+ }, objective: string): CanonicalTaskCardInput;
16
+ export declare function buildTaskEnvelope(card: CanonicalTaskCardInput, projectRoot: string, projectName: string): CommandEnvelopeInput;
17
+ export interface OrchestratorNextResult {
18
+ task: CanonicalTaskCardInput;
19
+ envelope: CommandEnvelopeInput;
20
+ readyCount: number;
21
+ }
22
+ export declare function getNextTask(projectRoot: string, projectName: string): Promise<Result<OrchestratorNextResult, Error>>;
23
+ export declare function startTask(projectRoot: string, taskId: string, agent?: string): Promise<Result<void, Error>>;
24
+ export declare function completeTask(projectRoot: string, taskId: string, evidenceIds?: string[]): Promise<Result<void, Error>>;
25
+ export declare function formatGoalStatus(graph: GoalGraphInput): string;
@@ -0,0 +1,18 @@
1
+ import type { GoalGraphInput, GoalTaskInput, ProductGraphInput } from '../../validation/schemas';
2
+ export declare function inferEvidenceRequired(task: GoalTaskInput): string[];
3
+ export interface ProductGoalGraph extends GoalGraphInput {
4
+ productEnriched: boolean;
5
+ impactPreview?: {
6
+ components: string[];
7
+ requirements: string[];
8
+ };
9
+ }
10
+ export declare function planProductGoal(objective: string, graph?: ProductGraphInput): ProductGoalGraph;
11
+ export declare function enrichGoalWithProduct(graph: GoalGraphInput, productGraph?: ProductGraphInput): GoalGraphInput & {
12
+ enrichedTasks: Array<GoalTaskInput & {
13
+ targetFiles: string[];
14
+ agentType: string;
15
+ evidenceRequired: string[];
16
+ }>;
17
+ };
18
+ export declare function scoreTaskPriority(task: GoalTaskInput, graph?: ProductGraphInput): number;
@@ -0,0 +1,4 @@
1
+ export declare const PACKAGE_ROOT: string;
2
+ export declare const SRC_PRESETS_DIR: string;
3
+ export declare const ROOT_PRESETS_DIR: string;
4
+ export declare const POLICY_PATH: string;
@@ -0,0 +1,11 @@
1
+ import type { ProductNodeType } from '../../domain/product/entities';
2
+ import { type ProductGraphInput, type ProductGraphNodeInput, type ProductGraphEdgeInput } from '../../validation/schemas';
3
+ import { type Result } from '../../utils/result';
4
+ export declare function loadGraph(projectRoot: string): Promise<Result<ProductGraphInput, Error>>;
5
+ export declare function saveGraph(projectRoot: string, graph: ProductGraphInput): Promise<Result<void, Error>>;
6
+ export declare function upsertNode(graph: ProductGraphInput, node: ProductGraphNodeInput): ProductGraphInput;
7
+ export declare function linkNodes(graph: ProductGraphInput, edge: ProductGraphEdgeInput): ProductGraphInput;
8
+ export declare function queryNodes(graph: ProductGraphInput, type?: ProductNodeType, textFilter?: string): ProductGraphNodeInput[];
9
+ export declare function findPath(graph: ProductGraphInput, fromId: string, toId: string): string[] | null;
10
+ export declare function countByType(graph: ProductGraphInput): Record<string, number>;
11
+ export declare function getNeighbors(graph: ProductGraphInput, nodeId: string, relation?: ProductGraphEdgeInput['relation']): ProductGraphNodeInput[];