ultimate-pi 0.13.0 → 0.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.
Files changed (39) hide show
  1. package/{.pi → .agents}/skills/ccc/SKILL.md +1 -7
  2. package/.agents/skills/ccc/references/settings.md +126 -0
  3. package/.agents/skills/harness-debate-plan/SKILL.md +61 -21
  4. package/.agents/skills/harness-orchestration/SKILL.md +1 -1
  5. package/.pi/agents/harness/planning/plan-adversary.md +2 -2
  6. package/.pi/agents/harness/planning/plan-evaluator.md +3 -1
  7. package/.pi/agents/harness/planning/review-integrator.md +4 -2
  8. package/.pi/extensions/debate-orchestrator.ts +39 -435
  9. package/.pi/extensions/harness-debate-tools.ts +519 -0
  10. package/.pi/extensions/harness-plan-approval.ts +41 -17
  11. package/.pi/extensions/harness-run-context.ts +18 -0
  12. package/.pi/extensions/lib/debate-bus-core.ts +434 -0
  13. package/.pi/extensions/lib/debate-bus-state.ts +58 -0
  14. package/.pi/extensions/lib/harness-spawn-budget.ts +5 -25
  15. package/.pi/extensions/lib/plan-approval/dialog.ts +33 -272
  16. package/.pi/extensions/lib/plan-approval/format-plan.ts +12 -85
  17. package/.pi/extensions/lib/plan-approval/plan-review.ts +6 -6
  18. package/.pi/extensions/lib/plan-approval/render.ts +6 -0
  19. package/.pi/extensions/lib/plan-approval/validate.ts +1 -1
  20. package/.pi/extensions/lib/plan-debate-envelope.ts +2 -0
  21. package/.pi/extensions/lib/plan-debate-gate.ts +155 -0
  22. package/.pi/extensions/lib/plan-debate-id.ts +39 -0
  23. package/.pi/extensions/lib/plan-debate-lane.ts +220 -0
  24. package/.pi/extensions/lib/plan-debate-round-status.ts +94 -0
  25. package/.pi/extensions/lib/plan-debate-write-guard.ts +20 -0
  26. package/.pi/extensions/lib/plan-messenger.ts +276 -0
  27. package/.pi/extensions/lib/plan-review-integrator-rules.ts +119 -0
  28. package/.pi/extensions/lib/plan-scope-guard.ts +89 -0
  29. package/.pi/harness/agents.manifest.json +7 -7
  30. package/.pi/prompts/harness-plan.md +22 -12
  31. package/CHANGELOG.md +18 -0
  32. package/THIRD_PARTY_NOTICES.md +1 -1
  33. package/package.json +3 -3
  34. package/.agents/skills/ck-search/SKILL.md +0 -23
  35. package/.agents/skills/cocoindex-search/SKILL.md +0 -35
  36. package/.agents/skills/obsidian-bases/SKILL.md +0 -299
  37. package/.agents/skills/obsidian-markdown/SKILL.md +0 -237
  38. package/.pi/extensions/lib/plan-approval/fallback.ts +0 -50
  39. /package/{.pi → .agents}/skills/ccc/references/management.md +0 -0
@@ -11,16 +11,10 @@ description: "This skill should be used when code search, file/directory summary
11
11
 
12
12
  The agent owns the `ccc` lifecycle for the current project — initialization, indexing, and searching. Do not ask the user to perform these steps; handle them automatically.
13
13
 
14
- - **Initialization**: If `ccc search` or `ccc index` fails with an initialization error (e.g., "Not in an initialized project directory"), run `bash "$UP_PKG/.pi/scripts/harness-cocoindex-bootstrap.sh"` from the project root (or `ccc init` + `ccc index` when not in ultimate-pi harness), then retry the original command.
14
+ - **Initialization**: If `ccc search` or `ccc index` fails with an initialization error (e.g., "Not in an initialized project directory"), run `ccc init` from the project root directory, then `ccc index` to build the index, then retry the original command.
15
15
  - **Index freshness**: Keep the index up to date by running `ccc index` (or `ccc search --refresh`) when the index may be stale — e.g., at the start of a session, or after making significant code changes (new files, refactors, renamed modules). There is no need to re-index between consecutive searches if no code was changed in between.
16
16
  - **Installation**: If `ccc` itself is not found (command not found), refer to [management.md](references/management.md) for installation instructions and inform the user.
17
17
 
18
- ### ultimate-pi harness
19
-
20
- - **Parent / main agents:** follow ownership above (`ccc index` when stale after large edits).
21
- - **`harness/planning/scout-semantic`:** use **`ccc search` only** — the harness runs incremental `ccc index` before subagent spawns. Never run `ccc index`, `ccc init`, or `ccc search --refresh` in scouts.
22
- - **Lane contract:** graphify = callers/communities/architecture; `ccc` = implementation-by-meaning (chunks). Do not use `ccc` for “who calls X” — use `graphify explain` / `graphify path`.
23
-
24
18
  ## Searching the Codebase
25
19
 
26
20
  To perform a semantic search:
@@ -0,0 +1,126 @@
1
+ # ccc Settings
2
+
3
+ Configuration lives in two YAML files, both created automatically by `ccc init`.
4
+
5
+ ## User-Level Settings (`~/.cocoindex_code/global_settings.yml`)
6
+
7
+ Shared across all projects. Controls the embedding model and extra environment variables for the daemon.
8
+
9
+ ```yaml
10
+ embedding:
11
+ provider: sentence-transformers # or "litellm" (default when provider is omitted)
12
+ model: Snowflake/snowflake-arctic-embed-xs
13
+ device: mps # optional: cpu, cuda, mps (auto-detected if omitted)
14
+ min_interval_ms: 300 # optional: pace LiteLLM embedding requests to reduce 429s; defaults to 5 for LiteLLM
15
+
16
+ envs: # extra environment variables for the daemon
17
+ OPENAI_API_KEY: your-key # only needed if not already in the shell environment
18
+ ```
19
+
20
+ ### Fields
21
+
22
+ | Field | Description |
23
+ |-------|-------------|
24
+ | `embedding.provider` | `sentence-transformers` for local models, `litellm` (or omit) for cloud/remote models |
25
+ | `embedding.model` | Model identifier — format depends on provider (see examples below) |
26
+ | `embedding.device` | Optional. `cpu`, `cuda`, or `mps`. Auto-detected if omitted. Only relevant for `sentence-transformers`. |
27
+ | `embedding.min_interval_ms` | Optional. Minimum delay between LiteLLM embedding requests in milliseconds. Defaults to `5` for LiteLLM and is ignored by `sentence-transformers`. Set explicitly to override the default. |
28
+ | `envs` | Key-value map of environment variables injected into the daemon. Use for API keys not already in the shell environment. |
29
+
30
+ ### Embedding Model Examples
31
+
32
+ **Local (sentence-transformers, no API key needed):**
33
+
34
+ ```yaml
35
+ embedding:
36
+ provider: sentence-transformers
37
+ model: Snowflake/snowflake-arctic-embed-xs # default, lightweight
38
+ ```
39
+
40
+ ```yaml
41
+ embedding:
42
+ provider: sentence-transformers
43
+ model: nomic-ai/CodeRankEmbed # better code retrieval, needs GPU (~1 GB VRAM)
44
+ ```
45
+
46
+ **Ollama (local):**
47
+
48
+ ```yaml
49
+ embedding:
50
+ model: ollama/nomic-embed-text
51
+ ```
52
+
53
+ **OpenAI:**
54
+
55
+ ```yaml
56
+ embedding:
57
+ model: text-embedding-3-small
58
+ min_interval_ms: 300
59
+ envs:
60
+ OPENAI_API_KEY: your-api-key
61
+ ```
62
+
63
+ **Gemini:**
64
+
65
+ ```yaml
66
+ embedding:
67
+ model: gemini/gemini-embedding-001
68
+ envs:
69
+ GEMINI_API_KEY: your-api-key
70
+ ```
71
+
72
+ **Voyage (code-optimized):**
73
+
74
+ ```yaml
75
+ embedding:
76
+ model: voyage/voyage-code-3
77
+ envs:
78
+ VOYAGE_API_KEY: your-api-key
79
+ ```
80
+
81
+ For the full list of supported cloud providers and model identifiers, see [LiteLLM Embedding Models](https://docs.litellm.ai/docs/embedding/supported_embedding).
82
+
83
+ ### Important
84
+
85
+ Switching embedding models changes vector dimensions — you must re-index after changing the model:
86
+
87
+ ```bash
88
+ ccc reset && ccc index
89
+ ```
90
+
91
+ ## Project-Level Settings (`<project>/.cocoindex_code/settings.yml`)
92
+
93
+ Per-project. Controls which files to index. Created by `ccc init` and automatically added to `.gitignore`.
94
+
95
+ ```yaml
96
+ include_patterns:
97
+ - "**/*.py"
98
+ - "**/*.js"
99
+ - "**/*.ts"
100
+ # ... (sensible defaults for 28+ file types)
101
+
102
+ exclude_patterns:
103
+ - "**/.*" # hidden directories
104
+ - "**/__pycache__"
105
+ - "**/node_modules"
106
+ - "**/dist"
107
+ # ...
108
+
109
+ language_overrides:
110
+ - ext: inc # treat .inc files as PHP
111
+ lang: php
112
+ ```
113
+
114
+ ### Fields
115
+
116
+ | Field | Description |
117
+ |-------|-------------|
118
+ | `include_patterns` | Glob patterns for files to index. Defaults cover common languages (Python, JS/TS, Rust, Go, Java, C/C++, C#, SQL, Shell, Markdown, PHP, Lua, etc.). |
119
+ | `exclude_patterns` | Glob patterns for files/directories to skip. Defaults exclude hidden dirs, `node_modules`, `dist`, `__pycache__`, `vendor`, etc. |
120
+ | `language_overrides` | List of `{ext, lang}` pairs to override language detection for specific file extensions. |
121
+
122
+ ### Editing Tips
123
+
124
+ - To index additional file types, append glob patterns to `include_patterns` (e.g. `"**/*.proto"`).
125
+ - To exclude a directory, append to `exclude_patterns` (e.g. `"**/generated"`).
126
+ - After editing, run `ccc index` to re-index with the new settings.
@@ -1,44 +1,84 @@
1
1
  ---
2
2
  name: harness-debate-plan
3
- description: Plan-phase Review Gate debate — assemble rounds, token caps, bus envelopes for parent orchestrator.
3
+ description: Plan-phase Review Gate debate — pi-messenger threads, lane YAML, bus tools for parent orchestrator.
4
4
  ---
5
5
 
6
6
  # harness-debate-plan
7
7
 
8
- Use when running **Phase 5** of `/harness-plan` — four Review Gate rounds on the plan debate bus.
8
+ Use when running **Phase 5** of `/harness-plan` — four Review Gate rounds with **pi-messenger-style** turn-taking (claims → rebuttals → integrate), then bus submission.
9
9
 
10
10
  ## Open
11
11
 
12
12
  ```
13
- /harness-debate-open plan-<run_id>
13
+ harness_debate_open({})
14
14
  ```
15
15
 
16
+ - Debate id is always `plan-<run_id>` (tool normalizes wrong ids).
17
+ - Creates `.pi/harness/runs/<run_id>/debate-messenger/` (`inbox/<Agent>/`, `threads/round-N/transcript.jsonl`).
18
+
16
19
  Budget profile **plan**: `max_rounds=4`, `round_token_cap=2000`, `debate_global_cap=12000`.
17
20
 
18
- ## Per-round spawn order
21
+ ## Per-round spawn order (P1 sequential lanes)
22
+
23
+ 1. Round-specific lane spawns (write lane YAML with `write_harness_yaml`)
24
+ 2. `plan-evaluator` → lane artifact + `harness_messenger_post` (claims)
25
+ 3. `harness_messenger_read_round` → spawn `plan-adversary` with transcript
26
+ 4. `plan-adversary` → lane artifact + `harness_messenger_post` (rebuttals with `in_reply_to`)
27
+ 5. R1: `hypothesis-validator` first (blind — no decomposition/PlanPacket in prompt)
28
+ 6. R4: `sprint-contract-auditor` required before integrator
29
+ 7. `review-integrator` → integrator draft + `harness_messenger_post` (`integrate`)
30
+ 8. `harness_debate_submit_round({ round_index, integrator_draft })` — **only** path for `review-round-r{N}.yaml`
31
+
32
+ | Round | Extra lane artifacts |
33
+ |-------|----------------------|
34
+ | 1 | `hypothesis-validation-r1.yaml` |
35
+ | 4 | `sprint-audit-r4.yaml` (required) |
19
36
 
20
- 1. Round-specific extras (R1: `hypothesis-validator` first, blind)
21
- 2. `plan-evaluator`
22
- 3. `plan-adversary`
23
- 4. R4: `sprint-contract-auditor` (required)
24
- 5. `review-integrator`
37
+ ## Lane artifacts (auto-applied on subagent complete)
25
38
 
26
- ## Artifacts (YAML)
39
+ When a debate lane subagent finishes, the harness **automatically** writes lane YAML and posts messenger messages (evaluator claims, adversary rebuttals). Look for `harness-debate-next-step` in the transcript.
27
40
 
28
- | Agent | Output path |
29
- |-------|-------------|
30
- | hypothesis-validator | `artifacts/hypothesis-validation-r{N}.yaml` |
31
- | plan-evaluator | `artifacts/validation-turn-r{N}.yaml` |
32
- | plan-adversary | `artifacts/adversary-brief-r{N}.yaml` |
33
- | sprint-contract-auditor | `artifacts/sprint-audit-r{N}.yaml` |
34
- | review-integrator | `artifacts/review-round-r{N}.yaml` |
41
+ | Agent | Output path | Messenger |
42
+ |-------|-------------|-----------|
43
+ | hypothesis-validator | `artifacts/hypothesis-validation-r{N}.yaml` | — |
44
+ | plan-evaluator | `artifacts/validation-turn-r{N}.yaml` | `claim` |
45
+ | plan-adversary | `artifacts/adversary-brief-r{N}.yaml` | `rebuttal` |
46
+ | sprint-contract-auditor | `artifacts/sprint-audit-r{N}.yaml` (R4) | optional |
47
+ | review-integrator | *(integrator draft → `harness_debate_submit_round` only)* | `integrate` (on submit) |
35
48
 
36
- ## Bus envelope
49
+ Fallback: `harness_debate_apply_lane({ lane, content, round_index? })` if auto-apply missed fenced YAML.
37
50
 
38
- Load `review-round-r{N}.yaml`, validate, then `buildPlanReviewRoundEnvelope` (`.pi/extensions/lib/plan-debate-envelope.ts`) `/harness-debate-round '<json>'`.
51
+ Resume after stop: `harness_debate_round_status({ round_index: N })` then run the listed `next_tool`.
39
52
 
40
- Plan participants only. `StackResearchAgent` uses `artifacts/stack.yaml` claims — no spawn.
53
+ ## Messenger tools
54
+
55
+ ```typescript
56
+ harness_messenger_post({
57
+ round_index: 1,
58
+ from: "PlanEvaluatorAgent",
59
+ kind: "claim",
60
+ body: "...",
61
+ claim_ids: ["c1", "c2"],
62
+ to: ["broadcast"],
63
+ })
64
+ harness_messenger_post({
65
+ round_index: 1,
66
+ from: "PlanAdversaryAgent",
67
+ kind: "rebuttal",
68
+ in_reply_to: ["c1"],
69
+ body: "...",
70
+ })
71
+ harness_messenger_read_round({ round_index: 1 }) // for next spawn prompt
72
+ ```
73
+
74
+ ## Integrator + bus
75
+
76
+ `harness_debate_submit_round` validates messenger thread + integrator rules (`review_gate_ready` false when checks fail without `disputes[]`), writes `review-round-r{N}.yaml`, emits bus `kind: round`.
77
+
78
+ `StackResearchAgent` uses `artifacts/stack.yaml` claims — no spawn.
41
79
 
42
80
  ## Close
43
81
 
44
- After round 4: `/harness-debate-consensus`. Do not `approve_plan` on `policy_decision: block`.
82
+ After round 4: `harness_debate_consensus`. `approve_plan` is **hard-gated** on lane files, messenger, 4 bus rounds, and consensus not `block`.
83
+
84
+ Do not `approve_plan` on `policy_decision: block`. On `human_required` → `ask_user` first.
@@ -36,7 +36,7 @@ LIMIT 30
36
36
  1. **Parallel `tasks`** — one `subagent({ tasks: [...] })` for scouts, decompose+hypothesis, or review fan-in; subprocesses run in parallel upstream.
37
37
  2. **Blocking calls** — each `subagent` returns when the subprocess exits; no `get_subagent_result` polling.
38
38
  3. **Compact handoffs** — pass scout/decompose JSON only; never paste full subprocess message logs into the next spawn.
39
- 4. **Spawn caps** — bridge enforces **8** active + **12** total harness spawns per session. Do **not** pass `timeoutMs` unless the user wants a cap — subprocesses wait for natural exit (`PI_SUBAGENT_TIMEOUT_MS` optional env backstop only).
39
+ 4. **No spawn cap** — harness subagent spawns are unlimited per session (active count is telemetry only). Do **not** pass `timeoutMs` unless the user wants a cap — subprocesses wait for natural exit (`PI_SUBAGENT_TIMEOUT_MS` optional env backstop only).
40
40
 
41
41
  ## Command → agent
42
42
 
@@ -9,10 +9,10 @@ max_turns: 12
9
9
 
10
10
  You are **plan-adversary** — break the plan with reproducible counterexamples.
11
11
 
12
- Engage failed/warn checks from the same round's `plan-evaluator` first, then independent attacks. Cite `work_item_id` / `phase_id`.
12
+ Engage failed/warn checks from the same round's `plan-evaluator` first (parent provides evaluator YAML + messenger **claims**). Rebut specific `claim_ids` from the thread — parent posts your `rebuttal` with `in_reply_to`.
13
13
 
14
14
  ## Output
15
15
 
16
16
  Valid **YAML only** — `PlanAdversaryBrief` (`.pi/harness/specs/plan-adversary-brief.schema.json`).
17
17
 
18
- Bus label: `PlanAdversarysubagent`.
18
+ Bus label: `PlanAdversaryAgent`.
@@ -15,4 +15,6 @@ Parent passes `debate_round_focus`: `spec` | `wbs` | `schedule` | `quality`.
15
15
 
16
16
  Valid **YAML only** — `PlanValidationTurn` (`.pi/harness/specs/plan-validation-turn.schema.json`). Fail if `dag_validation.status === "fail"`.
17
17
 
18
- Bus label: `PlanEvaluatorsubagent`.
18
+ Include `claim_ids[]` in your summary for parent to post as messenger **claims** before spawning adversary.
19
+
20
+ Bus label: `PlanEvaluatorAgent`.
@@ -18,6 +18,8 @@ Valid **YAML only** — `PlanReviewRoundDraft` (`.pi/harness/specs/plan-review-r
18
18
  - `review_gate_ready` boolean
19
19
  - `participants`, `claims`, `rebuttals`, `evidence_refs`, `token_usage`, `severity_scores`
20
20
 
21
- Parent runs `buildPlanReviewRoundEnvelope` `/harness-debate-round`.
21
+ Parent passes `harness_messenger_read_round` transcript + lane YAML. After your YAML draft, parent calls `harness_messenger_post` (`kind: integrate`) then `harness_debate_submit_round` — you do not write `review-round-r*.yaml`.
22
22
 
23
- Bus label: `ReviewIntegratorsubagent`.
23
+ Set `review_gate_ready: false` when evaluator checks fail unless `disputes[]` documents open tension.
24
+
25
+ Bus label: `ReviewIntegratorAgent`.