ultimate-pi 0.12.0 → 0.13.1

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 (31) hide show
  1. package/.agents/skills/ccc/SKILL.md +136 -0
  2. package/.agents/skills/ccc/references/management.md +110 -0
  3. package/.agents/skills/ccc/references/settings.md +126 -0
  4. package/.agents/skills/harness-orchestration/SKILL.md +4 -4
  5. package/.pi/PACKAGING.md +1 -0
  6. package/.pi/SYSTEM.md +21 -20
  7. package/.pi/agents/harness/planning/scout-graphify.md +2 -0
  8. package/.pi/agents/harness/planning/scout-semantic.md +13 -6
  9. package/.pi/extensions/harness-run-context.ts +5 -0
  10. package/.pi/extensions/harness-subagents.ts +16 -5
  11. package/.pi/extensions/lib/harness-cocoindex-refresh.ts +49 -0
  12. package/.pi/extensions/lib/harness-subagent-policy.ts +5 -1
  13. package/.pi/extensions/lib/harness-subagents-bridge.ts +9 -63
  14. package/.pi/harness/docs/adrs/0033-parent-orchestrated-planning.md +1 -1
  15. package/.pi/prompts/harness-plan.md +10 -5
  16. package/.pi/prompts/harness-setup.md +15 -11
  17. package/.pi/scripts/README.md +1 -0
  18. package/.pi/scripts/harness-cli-verify.sh +24 -14
  19. package/.pi/scripts/harness-cocoindex-bootstrap.sh +182 -0
  20. package/.pi/scripts/harness-verify.mjs +10 -0
  21. package/.pi/skills/ast-grep/SKILL.md +2 -2
  22. package/CHANGELOG.md +16 -0
  23. package/THIRD_PARTY_NOTICES.md +7 -0
  24. package/package.json +3 -2
  25. package/vendor/pi-subagents/LICENSE +21 -0
  26. package/vendor/pi-subagents/UPSTREAM_PIN.md +11 -0
  27. package/vendor/pi-subagents/src/agents.ts +357 -0
  28. package/vendor/pi-subagents/src/subagents.ts +1463 -0
  29. package/.agents/skills/ck-search/SKILL.md +0 -99
  30. package/.agents/skills/obsidian-bases/SKILL.md +0 -299
  31. package/.agents/skills/obsidian-markdown/SKILL.md +0 -237
@@ -12,6 +12,7 @@ import {
12
12
  type HarnessSubagentsOptions,
13
13
  type SpawnAuthForward,
14
14
  } from "../../../vendor/pi-subagents/src/subagents.js";
15
+ import { refreshHarnessCocoindexIndex } from "./harness-cocoindex-refresh.js";
15
16
  import { captureHarnessEvent } from "./harness-posthog.js";
16
17
  import {
17
18
  checkHarnessSpawnBudget,
@@ -32,37 +33,6 @@ import {
32
33
  const spawnBudget = createSpawnBudgetState();
33
34
  let lastSessionId = "harness";
34
35
 
35
- function maskApiKey(key: string | undefined): string | undefined {
36
- if (!key) return undefined;
37
- if (key.length <= 12) return "***";
38
- return `${key.slice(0, 7)}…${key.slice(-4)}`;
39
- }
40
-
41
- // #region agent log
42
- function agentDebugLog(
43
- hypothesisId: string,
44
- location: string,
45
- message: string,
46
- data: Record<string, unknown>,
47
- ): void {
48
- fetch("http://127.0.0.1:7928/ingest/a5d40896-34cb-4f12-97db-df7ada0b22f0", {
49
- method: "POST",
50
- headers: {
51
- "Content-Type": "application/json",
52
- "X-Debug-Session-Id": "e762d5",
53
- },
54
- body: JSON.stringify({
55
- sessionId: "e762d5",
56
- hypothesisId,
57
- location,
58
- message,
59
- data,
60
- timestamp: Date.now(),
61
- }),
62
- }).catch(() => {});
63
- }
64
- // #endregion
65
-
66
36
  async function resolveHarnessSpawnAuth(
67
37
  ctx: ExtensionContext,
68
38
  agent: AgentConfig,
@@ -72,43 +42,11 @@ async function resolveHarnessSpawnAuth(
72
42
  : undefined;
73
43
  const concrete = resolveConcreteSubagentModel(ctx.cwd, parentModel, agent);
74
44
  if (!concrete) {
75
- // #region agent log
76
- agentDebugLog(
77
- "D",
78
- "harness-subagents-bridge.ts:resolveHarnessSpawnAuth",
79
- "no concrete model",
80
- {
81
- agent: agent.name,
82
- agentModel: agent.model,
83
- parentModel: parentModel
84
- ? `${parentModel.provider}/${parentModel.id}`
85
- : undefined,
86
- },
87
- );
88
- // #endregion
89
45
  return undefined;
90
46
  }
91
47
  const apiKey = await ctx.modelRegistry.getApiKeyForProvider(
92
48
  concrete.provider,
93
49
  );
94
- // #region agent log
95
- agentDebugLog(
96
- "F",
97
- "harness-subagents-bridge.ts:resolveHarnessSpawnAuth",
98
- "concrete subprocess auth",
99
- {
100
- agent: agent.name,
101
- parentModel: parentModel
102
- ? `${parentModel.provider}/${parentModel.id}`
103
- : undefined,
104
- concreteModel: concrete.modelRef,
105
- routerProfile: concrete.routerProfile,
106
- routerTier: concrete.routerTier,
107
- apiKey: maskApiKey(apiKey),
108
- usable: isUsableApiKey(apiKey),
109
- },
110
- );
111
- // #endregion
112
50
  if (!isUsableApiKey(apiKey)) return undefined;
113
51
  return {
114
52
  provider: concrete.provider,
@@ -145,6 +83,14 @@ export function createHarnessSubagentsExtension(
145
83
  if (!pre.ok) {
146
84
  return { ok: false, message: pre.message };
147
85
  }
86
+ if (phase === "plan" || phase === "execute") {
87
+ const refreshMsg = refreshHarnessCocoindexIndex(ctx.cwd);
88
+ if (refreshMsg?.includes("continuing")) {
89
+ // warn-only path; do not block spawn
90
+ } else if (refreshMsg) {
91
+ return { ok: false, message: refreshMsg };
92
+ }
93
+ }
148
94
  }
149
95
  return { ok: true };
150
96
  },
@@ -19,7 +19,7 @@
19
19
  ### Positive
20
20
 
21
21
  - Full plan visible in parent session; editor `plan-review.md` path surfaced from parent.
22
- - Specialized scouts (graphify, ast-grep, ck) run in parallel with clear JSON contracts.
22
+ - Specialized scouts (graphify, ast-grep, cocoindex `ccc`) run in parallel with clear JSON contracts.
23
23
  - Pre-approval adversary separate from post-run `harness/adversary`.
24
24
 
25
25
  ### Negative
@@ -30,8 +30,9 @@ Read **harness-debate-plan** skill before Review Gate rounds.
30
30
 
31
31
  1. Use `subagent` with `agentScope: "both"` and parallel `tasks` where lanes are independent.
32
32
  2. Each `subagent` call blocks until subprocesses finish — batch parallel scouts in one `tasks` array.
33
- 3. Cap: **12** harness subagent invocations per parent session (extension-enforced).
34
- 4. Compact task text: embed `HarnessSpawnContext` JSON + lane-specific instructions only.
33
+ 3. Do **not** set `timeoutMs` unless the user explicitly requests a cap — subagents run until natural completion (optional backstop: `PI_SUBAGENT_TIMEOUT_MS`).
34
+ 4. Cap: **12** harness subagent invocations per parent session (extension-enforced).
35
+ 5. Compact task text: embed `HarnessSpawnContext` JSON + lane-specific instructions only.
35
36
 
36
37
  ## Step 0 — Parse `$ARGUMENTS`
37
38
 
@@ -44,19 +45,23 @@ Read **harness-debate-plan** skill before Review Gate rounds.
44
45
 
45
46
  Use `[HarnessActivePlan]` / `[HarnessRunContext]` only. On revise: preserve `plan_id` / `task_id`. Canonical paths: `plan-packet.yaml`, `research-brief.yaml`, `artifacts/*.yaml`.
46
47
 
48
+ ## Phase 0 — Semantic index (automatic)
49
+
50
+ Do **not** run `ccc index` or `ccc search --refresh`. The harness runs incremental `ccc index` before subagent spawns. Proceed directly to Phase 1 scouts.
51
+
47
52
  ## Phase 1 — Parallel scouts
48
53
 
49
54
  ```json
50
55
  {
51
56
  "agentScope": "both",
52
57
  "tasks": [
53
- { "agent": "harness/planning/scout-graphify", "task": "<HarnessSpawnContext + graphify lane>", "timeoutMs": 90000 },
54
- { "agent": "harness/planning/scout-structure", "task": "<HarnessSpawnContext + structure lane>", "timeoutMs": 90000 }
58
+ { "agent": "harness/planning/scout-graphify", "task": "<HarnessSpawnContext + graphify lane>" },
59
+ { "agent": "harness/planning/scout-structure", "task": "<HarnessSpawnContext + structure lane>" }
55
60
  ]
56
61
  }
57
62
  ```
58
63
 
59
- Add `harness/planning/scout-semantic` to `tasks` unless `--quick`. Require graphify + structure success.
64
+ Add `harness/planning/scout-semantic` to `tasks` unless `--quick`. Require graphify + structure success. Semantic lane uses `ccc search` only (see `scout-semantic` agent).
60
65
 
61
66
  ## Phase 2 & 3 — Decompose + hypothesis (parallel)
62
67
 
@@ -156,7 +156,7 @@ bash "$UP_PKG/.pi/scripts/harness-cli-verify.sh"
156
156
 
157
157
  **Required (script must exit 0):** scrapling + harness-web smoke, ctx7, biome, ast-grep (`sg`), sentrux (when harness manifest present).
158
158
 
159
- **Warnings allowed:** gh (if not authenticated), agent-browser (if OS libs need manual `sudo apt-get install`), ck (empty corpus on tiny repos).
159
+ **Warnings allowed:** gh (if not authenticated), agent-browser (if OS libs need manual `sudo apt-get install`), cocoindex-code (empty corpus on tiny repos; first `[full]` install downloads local embedding model).
160
160
 
161
161
  If the script reports **agent-browser shared library errors** on Linux/WSL, run the fix it prints, then re-verify:
162
162
 
@@ -232,20 +232,24 @@ if [ ! -f .pi/harness/browser.json ]; then
232
232
  fi
233
233
  ```
234
234
 
235
- ### 2.4 — ck-search (Semantic Code Search)
235
+ ### 2.4 — CocoIndex Code (semantic code search)
236
+
237
+ Offline semantic search via [CocoIndex Code](https://cocoindex.io/cocoindex-code/) (`ccc`). **CLI only** — do not register `ccc mcp` in harness setup (MCP defaults to refresh-before-search and is slower).
236
238
 
237
239
  ```bash
238
- if ! command -v ck &>/dev/null || [ "$FORCE" = "true" ]; then
239
- npm install -g @beaconbay/ck-search
240
- fi
240
+ command -v uv &>/dev/null || curl -LsSf https://astral.sh/uv/install.sh | sh
241
+ export PATH="$HOME/.local/bin:$PATH"
242
+ uv tool install 'cocoindex-code[full]' # or: pipx install 'cocoindex-code[full]'
243
+ bash "$UP_PKG/.pi/scripts/harness-cocoindex-bootstrap.sh"
244
+ # Rebuild index: bash "$UP_PKG/.pi/scripts/harness-cocoindex-bootstrap.sh" --force
245
+ ccc status
241
246
  ```
242
247
 
243
- Verify: `ck --version`
248
+ **Indexing before scouts is automatic:** `harness-subagents` runs incremental `ccc index` before plan/execute subagent batches. Agents use `ccc search` only.
244
249
 
245
- Register as MCP server (if Claude MCP available):
246
- ```bash
247
- claude mcp list 2>/dev/null && claude mcp add ck-search -s user -- ck --serve || echo "MCP not available — ck will be used as CLI only"
248
- ```
250
+ **First install:** `[full]` pulls sentence-transformers + torch (~hundreds of MB–1GB+). Run bootstrap once; do not run `ccc index` inside scouts.
251
+
252
+ Verify: `ccc doctor` and `ccc search --limit 3 "export function"` (no `--refresh`).
249
253
 
250
254
  ### 2.5 — biome (Lint + Format Gate)
251
255
 
@@ -666,7 +670,7 @@ Output summary table:
666
670
  | scrapling / harness-web | ✓/✗ | Auth: yes/no |
667
671
  | ctx7 | ✓/✗ | Login: yes/no |
668
672
  | agent-browser | ✓/✗ | Config: .pi/harness/browser.json |
669
- | ck-search | ✓/✗ | MCP: registered/CLI-only |
673
+ | cocoindex-code | ✓/✗ | `ccc status`; index auto-refreshed before harness scouts |
670
674
  | biome | ✓/✗ | Project config: found/default |
671
675
  | ast-grep | ✓/✗ | AST-aware code search (`sg`)
672
676
  | gh CLI | ✓/✗ | Auth: yes/no |
@@ -21,6 +21,7 @@ From **Typescript extensions**, use `resolveHarnessScript()` / `getHarnessPackag
21
21
  | Action | Command |
22
22
  |--------|---------|
23
23
  | Graphify bootstrap | `bash "$UP_PKG/.pi/scripts/harness-graphify-bootstrap.sh"` |
24
+ | CocoIndex Code bootstrap | `bash "$UP_PKG/.pi/scripts/harness-cocoindex-bootstrap.sh"` |
24
25
  | CLI tool install + smoke tests | `bash "$UP_PKG/.pi/scripts/harness-cli-verify.sh"` |
25
26
  | Deterministic harness checks | `node "$UP_PKG/.pi/scripts/harness-verify.mjs"` |
26
27
  | Sentrux rules bootstrap (harness-setup) | `node "$UP_PKG/.pi/scripts/harness-sentrux-bootstrap.mjs"` |
@@ -231,22 +231,32 @@ verify_ctx7() {
231
231
  fi
232
232
  }
233
233
 
234
- verify_ck() {
235
- log "[ck-search]"
236
- npm_global_install "@beaconbay/ck-search" "ck" || { fail "ck-search npm install"; return; }
237
- if ! ck --version &>/dev/null; then
238
- fail "ck --version failed"
234
+ verify_cocoindex() {
235
+ log "[cocoindex-code]"
236
+ local _bootstrap
237
+ _bootstrap="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)/harness-cocoindex-bootstrap.sh"
238
+ if [ ! -f "$_bootstrap" ]; then
239
+ fail "harness-cocoindex-bootstrap.sh missing"
239
240
  return
240
241
  fi
241
- # Fast grep-mode smoke (no embedding model download)
242
- local ck_target="."
243
- [ -d .pi ] && ck_target=".pi"
244
- if ck -l 1 "export" "$ck_target" 2>/dev/null | head -1 | grep -q .; then
245
- pass "ck $(ck --version 2>/dev/null | head -1)"
246
- elif ck --status "$ck_target" 2>/dev/null | head -1 | grep -q .; then
247
- pass "ck $(ck --version 2>/dev/null | head -1) (index status ok)"
242
+ if [ "$FORCE" = true ]; then
243
+ bash "$_bootstrap" --force || { fail "cocoindex bootstrap --force"; return; }
244
+ else
245
+ bash "$_bootstrap" || { fail "cocoindex bootstrap"; return; }
246
+ fi
247
+ if ! command -v ccc &>/dev/null; then
248
+ fail "ccc not on PATH after bootstrap"
249
+ return
250
+ fi
251
+ if ! ccc doctor &>/dev/null; then
252
+ warn "ccc doctor reported issues (daemon/model/SQLite)"
253
+ fi
254
+ if ccc search --limit 3 "export function" 2>/dev/null | head -1 | grep -qE '\.(ts|js|py|md)|\[|score|path'; then
255
+ pass "cocoindex-code (ccc search smoke)"
256
+ elif ccc status 2>/dev/null | head -1 | grep -q .; then
257
+ pass "cocoindex-code (index present; search empty on tiny corpus)"
248
258
  else
249
- warn "ck installed but smoke search empty"
259
+ warn "cocoindex installed but smoke search empty — first [full] install downloads local embedding model"
250
260
  fi
251
261
  }
252
262
 
@@ -335,7 +345,7 @@ log ""
335
345
  verify_scrapling
336
346
  verify_ctx7
337
347
  verify_agent_browser
338
- verify_ck
348
+ verify_cocoindex
339
349
  verify_biome
340
350
  verify_sg
341
351
  verify_gh
@@ -0,0 +1,182 @@
1
+ #!/usr/bin/env bash
2
+ # harness-cocoindex-bootstrap — install CocoIndex Code (ccc), seed settings, build index.
3
+ # Non-interactive (no `ccc init` prompts). Used by harness-cli-verify and /harness-setup.
4
+
5
+ set -euo pipefail
6
+
7
+ FORCE=false
8
+ for arg in "$@"; do
9
+ case "$arg" in
10
+ --force) FORCE=true ;;
11
+ -h | --help)
12
+ echo "Usage: $0 [--force]"
13
+ echo " --force rebuild index even when cocoindex.db exists"
14
+ exit 0
15
+ ;;
16
+ *)
17
+ echo "Unknown argument: $arg" >&2
18
+ exit 2
19
+ ;;
20
+ esac
21
+ done
22
+
23
+ export PATH="${HOME}/.local/bin:${PATH}"
24
+
25
+ log() { printf '%s\n' "$*"; }
26
+ die() { printf 'error: %s\n' "$*" >&2; exit 1; }
27
+
28
+ ROOT="$(pwd)"
29
+
30
+ if ! python3 --version 2>/dev/null | grep -qE 'Python 3\.(1[0-9]|[2-9][0-9])'; then
31
+ die "Python 3.10+ required (got: $(python3 --version 2>/dev/null || echo missing))"
32
+ fi
33
+ log "✓ Python 3.10+"
34
+
35
+ cocoindex_installed() {
36
+ command -v ccc &>/dev/null && return 0
37
+ command -v uv &>/dev/null && uv tool list 2>/dev/null | grep -qE '(^|[[:space:]])cocoindex-code([[:space:]]|$)' && return 0
38
+ return 1
39
+ }
40
+
41
+ install_cocoindex() {
42
+ if command -v uv &>/dev/null; then
43
+ log "Installing cocoindex-code[full] via uv tool..."
44
+ uv tool install 'cocoindex-code[full]'
45
+ elif command -v pipx &>/dev/null; then
46
+ log "Installing cocoindex-code[full] via pipx..."
47
+ pipx install 'cocoindex-code[full]'
48
+ else
49
+ die "Need uv or pipx to install cocoindex-code[full]"
50
+ fi
51
+ export PATH="${HOME}/.local/bin:${PATH}"
52
+ command -v ccc &>/dev/null || die "ccc not on PATH after install"
53
+ }
54
+
55
+ if ! cocoindex_installed; then
56
+ install_cocoindex
57
+ fi
58
+ command -v ccc &>/dev/null || die "ccc CLI not found"
59
+ log "✓ ccc ($(command -v ccc))"
60
+
61
+ CCC_BIN="$(command -v ccc)"
62
+ CCC_PYTHON=""
63
+ if [ -f "$CCC_BIN" ]; then
64
+ CCC_PYTHON="$(sed -n '1s/^#!//p' "$CCC_BIN" | tr -d '\r')"
65
+ fi
66
+ if [ -z "$CCC_PYTHON" ] || [ ! -x "$CCC_PYTHON" ]; then
67
+ CCC_VENV="$(cd "$(dirname "$CCC_BIN")/.." && pwd)"
68
+ CCC_PYTHON="$CCC_VENV/bin/python"
69
+ fi
70
+ if [ ! -x "$CCC_PYTHON" ]; then
71
+ CCC_PYTHON="$(command -v python3)"
72
+ fi
73
+
74
+ # Seed global + project settings and merge harness exclude_patterns (non-interactive).
75
+ "$CCC_PYTHON" - <<'PY'
76
+ from __future__ import annotations
77
+
78
+ import os
79
+ import sys
80
+ from pathlib import Path
81
+
82
+ try:
83
+ import yaml
84
+ except ImportError:
85
+ print("error: PyYAML required for harness cocoindex bootstrap", file=sys.stderr)
86
+ sys.exit(1)
87
+
88
+ ROOT = Path(os.environ.get("HARNESS_COCOINDEX_ROOT", ".")).resolve()
89
+ SETTINGS_DIR = ROOT / ".cocoindex_code"
90
+ PROJECT_SETTINGS = SETTINGS_DIR / "settings.yml"
91
+ USER_DIR = Path.home() / ".cocoindex_code"
92
+ USER_SETTINGS = USER_DIR / "global_settings.yml"
93
+
94
+ HARNESS_EXCLUDES = [
95
+ "graphify-out/**",
96
+ "raw/**",
97
+ ".raw/**",
98
+ ".pi/wiki-search/**",
99
+ "vendor/**",
100
+ "node_modules/**",
101
+ "**/graph.html",
102
+ "**/*.jsonl",
103
+ ".cursor/**",
104
+ ]
105
+
106
+ DEFAULT_GLOBAL = {
107
+ "embedding": {
108
+ "provider": "sentence-transformers",
109
+ "model": "Snowflake/snowflake-arctic-embed-xs",
110
+ }
111
+ }
112
+
113
+
114
+ def load_yaml(path: Path) -> dict:
115
+ if not path.is_file():
116
+ return {}
117
+ data = yaml.safe_load(path.read_text(encoding="utf-8"))
118
+ return data if isinstance(data, dict) else {}
119
+
120
+
121
+ def save_yaml(path: Path, data: dict) -> None:
122
+ path.parent.mkdir(parents=True, exist_ok=True)
123
+ path.write_text(yaml.safe_dump(data, default_flow_style=False), encoding="utf-8")
124
+
125
+
126
+ # Global settings (offline embeddings — no LiteLLM prompt).
127
+ if not USER_SETTINGS.is_file():
128
+ save_yaml(USER_SETTINGS, DEFAULT_GLOBAL)
129
+ print(f"Created {USER_SETTINGS}")
130
+
131
+ # Project settings — minimal file with merged excludes only.
132
+ project = load_yaml(PROJECT_SETTINGS)
133
+ excludes = list(project.get("exclude_patterns") or [])
134
+ seen = set(excludes)
135
+ for pat in HARNESS_EXCLUDES:
136
+ if pat not in seen:
137
+ excludes.append(pat)
138
+ seen.add(pat)
139
+ project["exclude_patterns"] = excludes
140
+ save_yaml(PROJECT_SETTINGS, project)
141
+ print(f"Ensured project settings: {PROJECT_SETTINGS}")
142
+
143
+ # .gitignore entry (mirror ccc init behavior).
144
+ gitignore = ROOT / ".gitignore"
145
+ entry = "/.cocoindex_code/"
146
+ comment = "# CocoIndex Code (ccc)"
147
+ if (ROOT / ".git").is_dir() and gitignore.is_file():
148
+ lines = gitignore.read_text(encoding="utf-8").splitlines()
149
+ if entry not in lines:
150
+ content = gitignore.read_text(encoding="utf-8")
151
+ if content and not content.endswith("\n"):
152
+ content += "\n"
153
+ content += f"{comment}\n{entry}\n"
154
+ gitignore.write_text(content, encoding="utf-8")
155
+ elif (ROOT / ".git").is_dir():
156
+ gitignore.write_text(f"{comment}\n{entry}\n", encoding="utf-8")
157
+ PY
158
+
159
+ NEED_INDEX=true
160
+ if [ "$FORCE" = false ] && [ -f ".cocoindex_code/cocoindex.db" ]; then
161
+ NEED_INDEX=false
162
+ log "✓ Existing cocoindex.db (use --force to rebuild)"
163
+ fi
164
+
165
+ if [ "$NEED_INDEX" = true ] || [ "$FORCE" = true ]; then
166
+ log "Building semantic code index (ccc index)..."
167
+ ccc index
168
+ fi
169
+
170
+ if ccc doctor 2>/dev/null; then
171
+ log "✓ ccc doctor"
172
+ else
173
+ log "! ccc doctor reported issues (see output above)"
174
+ fi
175
+
176
+ if ccc status 2>/dev/null | head -5; then
177
+ log "✓ ccc status"
178
+ else
179
+ log "! ccc status unavailable"
180
+ fi
181
+
182
+ log "CocoIndex output: .cocoindex_code/"
@@ -202,6 +202,16 @@ async function main() {
202
202
  if (!(await fileExists(runCtxLib))) fail("missing lib/harness-run-context.ts");
203
203
  ok("lib/harness-run-context.ts");
204
204
 
205
+ const pkgJson = JSON.parse(
206
+ await readFile(join(ROOT, "package.json"), "utf-8"),
207
+ );
208
+ if (!pkgJson.files?.includes("vendor/pi-subagents")) {
209
+ fail(
210
+ 'package.json "files" must include vendor/pi-subagents (npm publish ships subagents vendor)',
211
+ );
212
+ }
213
+ ok('package.json files includes vendor/pi-subagents');
214
+
205
215
  const subagentsVendor = join(
206
216
  ROOT,
207
217
  "vendor",
@@ -23,7 +23,7 @@ Verifies with `sg --version`.
23
23
  | Task | Tool | Why |
24
24
  |------|------|-----|
25
25
  | Find code by structure/pattern | **ast-grep** (`sg`) | AST-aware — knows what is a function call vs a string |
26
- | Find code by concept/meaning | graphify / ck | Semantic search, knowledge graph |
26
+ | Find code by concept/meaning | graphify / `ccc search` | Architecture (graphify) vs implementation chunks (`ccc`) |
27
27
  | Find exact literal string | `grep` | Only tool for non-code files or exact byte match |
28
28
  | Explore architecture | graphify | Call graph, community detection |
29
29
 
@@ -319,7 +319,7 @@ Need to find code
319
319
  ├─ Structural pattern (function calls, imports, classes)? → sg -p 'pattern'
320
320
  ├─ Rewrite/codemod needed? → sg -p 'old' --rewrite 'new'
321
321
  ├─ Project-wide lint rule? → sg scan (with sgconfig.yml)
322
- ├─ Conceptual/semantic search? → graphify query or ck --hybrid
322
+ ├─ Conceptual/semantic search? → graphify query (architecture) or ccc search (implementation)
323
323
  ├─ Explore architecture? → graphify
324
324
  └─ Exact literal string in non-code? → grep
325
325
  ```
package/CHANGELOG.md CHANGED
@@ -4,6 +4,22 @@ All notable changes to this project are documented in this file.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [v0.13.1] — 2026-05-18
8
+
9
+ ### 🔧 Chores
10
+
11
+ - Consolidate vendored `ccc` skill under `.agents/skills/ccc`; remove redundant `cocoindex-search`, `ck-search`, and duplicate Obsidian skills from the package.
12
+
13
+ ## [v0.13.0] — 2026-05-18
14
+
15
+ ### ✨ Features
16
+
17
+ - **CocoIndex Code:** replace `@beaconbay/ck-search` with offline `ccc` semantic search; `harness-cocoindex-bootstrap.sh`, pre-scout incremental index in `harness-subagents-bridge`, vendored `/skill:ccc`, `cocoindex-search` skill, and `ck-search` deprecation stub.
18
+
19
+ ### 🔧 Chores
20
+
21
+ - Harness excludes for `graphify-out/`, `vendor/`, `raw/`, etc. in `.cocoindex_code/settings.yml`; `.gitignore` tracks `.cocoindex_code/`.
22
+
7
23
  ## [v0.12.0] — 2026-05-18
8
24
 
9
25
  ### ✨ Features
@@ -22,3 +22,10 @@
22
22
  - **License:** MIT ([vendor/pi-subagents/LICENSE](vendor/pi-subagents/LICENSE))
23
23
  - **Pinned revision:** See [vendor/pi-subagents/UPSTREAM_PIN.md](vendor/pi-subagents/UPSTREAM_PIN.md)
24
24
  - ultimate-pi loads it from [`vendor/pi-subagents`](vendor/pi-subagents) via [`.pi/extensions/harness-subagents.ts`](.pi/extensions/harness-subagents.ts) with harness discovery, spawn gates, and subprocess env. Maintainer refresh: `npm run vendor:sync-subagents`.
25
+
26
+ ## CocoIndex Code (CLI + skill)
27
+
28
+ - **Project:** https://github.com/cocoindex-io/cocoindex-code
29
+ - **License:** Apache-2.0
30
+ - **Install:** `uv tool install 'cocoindex-code[full]'` (see `/harness-setup` §2.4)
31
+ - ultimate-pi vendors the upstream agent skill at [`.agents/skills/ccc/`](.agents/skills/ccc/) and bootstraps indexes via [`.pi/scripts/harness-cocoindex-bootstrap.sh`](.pi/scripts/harness-cocoindex-bootstrap.sh). Replaces deprecated `@beaconbay/ck-search`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ultimate-pi",
3
- "version": "0.12.0",
3
+ "version": "0.13.1",
4
4
  "description": "Ultimate AI coding harness for pi.dev — extensible skills, Obsidian wiki knowledge layer, compressed context, deterministic output",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -67,13 +67,14 @@
67
67
  "README.md",
68
68
  "THIRD_PARTY_NOTICES.md",
69
69
  "vendor/pi-model-router",
70
+ "vendor/pi-subagents",
70
71
  "vendor/pi-vcc"
71
72
  ],
72
73
  "peerDependencies": {
73
74
  "@earendil-works/pi-coding-agent": "*"
74
75
  },
75
76
  "scripts": {
76
- "check:ts": "tsc --noEmit --target ES2023 --lib ES2023 --moduleResolution nodenext --module nodenext --skipLibCheck .pi/extensions/custom-system-prompt.ts .pi/lib/harness-run-context.ts .pi/lib/harness-ui-state.ts .pi/extensions/harness-run-context.ts .pi/extensions/lib/harness-vcc-settings.ts .pi/extensions/dotenv-loader.ts .pi/extensions/lib/posthog-node.d.ts .pi/extensions/lib/harness-posthog.ts .pi/extensions/lib/harness-paths.ts .pi/extensions/pi-model-router-harness.ts .pi/extensions/provider-payload-sanitize.ts .pi/extensions/harness-telemetry.ts .pi/extensions/harness-ask-user.ts .pi/extensions/harness-plan-approval.ts .pi/extensions/lib/ask-user/schema.ts .pi/extensions/lib/ask-user/types.ts .pi/extensions/lib/ask-user/validate.ts .pi/extensions/lib/ask-user/dialog.ts .pi/extensions/lib/ask-user/fallback.ts .pi/extensions/lib/ask-user/render.ts .pi/extensions/lib/plan-approval/types.ts .pi/extensions/lib/plan-approval/schema.ts .pi/extensions/lib/plan-approval/validate.ts .pi/extensions/lib/plan-approval/format-plan.ts .pi/extensions/lib/plan-approval/dialog.ts .pi/extensions/lib/plan-approval/fallback.ts .pi/extensions/lib/plan-approval/render.ts .pi/extensions/lib/plan-approval/create-plan.ts .pi/extensions/harness-subagents.ts .pi/extensions/lib/harness-subagents-bridge.ts .pi/extensions/lib/harness-subagent-auth.ts .pi/extensions/lib/harness-subagent-policy.ts .pi/extensions/lib/harness-subagent-precheck.ts .pi/extensions/lib/harness-spawn-budget.ts .pi/extensions/lib/spawn-policy.ts vendor/pi-subagents/src/agents.ts vendor/pi-subagents/src/subagents.ts .pi/extensions/trace-recorder.ts .pi/extensions/observation-bus.ts .pi/extensions/drift-monitor.ts .pi/extensions/policy-gate.ts .pi/extensions/budget-guard.ts .pi/extensions/debate-orchestrator.ts .pi/extensions/harness-live-widget.ts .pi/extensions/sentrux-rules-sync.ts .pi/extensions/custom-header.ts .pi/extensions/harness-web-tools.ts .pi/extensions/harness-web-guard.ts .pi/extensions/lib/harness-web/run-cli.ts",
77
+ "check:ts": "tsc --noEmit --target ES2023 --lib ES2023 --moduleResolution nodenext --module nodenext --skipLibCheck .pi/extensions/custom-system-prompt.ts .pi/lib/harness-run-context.ts .pi/lib/harness-ui-state.ts .pi/extensions/harness-run-context.ts .pi/extensions/lib/harness-vcc-settings.ts .pi/extensions/dotenv-loader.ts .pi/extensions/lib/posthog-node.d.ts .pi/extensions/lib/harness-posthog.ts .pi/extensions/lib/harness-paths.ts .pi/extensions/pi-model-router-harness.ts .pi/extensions/provider-payload-sanitize.ts .pi/extensions/harness-telemetry.ts .pi/extensions/harness-ask-user.ts .pi/extensions/harness-plan-approval.ts .pi/extensions/lib/ask-user/schema.ts .pi/extensions/lib/ask-user/types.ts .pi/extensions/lib/ask-user/validate.ts .pi/extensions/lib/ask-user/dialog.ts .pi/extensions/lib/ask-user/fallback.ts .pi/extensions/lib/ask-user/render.ts .pi/extensions/lib/plan-approval/types.ts .pi/extensions/lib/plan-approval/schema.ts .pi/extensions/lib/plan-approval/validate.ts .pi/extensions/lib/plan-approval/format-plan.ts .pi/extensions/lib/plan-approval/dialog.ts .pi/extensions/lib/plan-approval/fallback.ts .pi/extensions/lib/plan-approval/render.ts .pi/extensions/lib/plan-approval/create-plan.ts .pi/extensions/harness-subagents.ts .pi/extensions/lib/harness-subagents-bridge.ts .pi/extensions/lib/harness-cocoindex-refresh.ts .pi/extensions/lib/harness-subagent-auth.ts .pi/extensions/lib/harness-subagent-policy.ts .pi/extensions/lib/harness-subagent-precheck.ts .pi/extensions/lib/harness-spawn-budget.ts .pi/extensions/lib/spawn-policy.ts vendor/pi-subagents/src/agents.ts vendor/pi-subagents/src/subagents.ts .pi/extensions/trace-recorder.ts .pi/extensions/observation-bus.ts .pi/extensions/drift-monitor.ts .pi/extensions/policy-gate.ts .pi/extensions/budget-guard.ts .pi/extensions/debate-orchestrator.ts .pi/extensions/harness-live-widget.ts .pi/extensions/sentrux-rules-sync.ts .pi/extensions/custom-header.ts .pi/extensions/harness-web-tools.ts .pi/extensions/harness-web-guard.ts .pi/extensions/lib/harness-web/run-cli.ts",
77
78
  "vendor:sync-router": "bash .pi/scripts/vendor-sync-pi-model-router.sh",
78
79
  "vendor:sync-vcc": "bash .pi/scripts/vendor-sync-pi-vcc.sh",
79
80
  "vendor:sync-subagents": "bash .pi/scripts/vendor-sync-pi-subagents.sh",
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 narumiruna
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,11 @@
1
+ # Vendored `@narumitw/pi-subagents`
2
+
3
+ - **Repository:** https://github.com/narumiruna/pi-extensions
4
+ - **Directory:** `extensions/pi-subagents`
5
+ - **Version:** 0.1.26
6
+ - **Commit:** main @ 2026-05-18 (subagents.ts + agents.ts base)
7
+ - **License:** MIT ([LICENSE](LICENSE))
8
+
9
+ ultimate-pi extends upstream with recursive `$UP_PKG/.pi/agents/**` discovery, harness spawn gates, and subprocess env (`UP_PKG`, `PI_HARNESS_SUBPROCESS`).
10
+
11
+ Refresh: `npm run vendor:sync-subagents`