ultimate-pi 0.1.2 → 0.1.4

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 (516) hide show
  1. package/.agents/skills/ck-search/SKILL.md +99 -0
  2. package/.agents/skills/defuddle/SKILL.md +90 -0
  3. package/.agents/skills/find-skills/SKILL.md +142 -0
  4. package/.agents/skills/firecrawl/SKILL.md +150 -0
  5. package/.agents/skills/firecrawl/rules/install.md +82 -0
  6. package/.agents/skills/firecrawl/rules/security.md +26 -0
  7. package/.agents/skills/firecrawl-agent/SKILL.md +57 -0
  8. package/.agents/skills/firecrawl-build-interact/SKILL.md +67 -0
  9. package/.agents/skills/firecrawl-build-onboarding/SKILL.md +102 -0
  10. package/.agents/skills/firecrawl-build-onboarding/references/auth-flow.md +39 -0
  11. package/.agents/skills/firecrawl-build-onboarding/references/project-setup.md +20 -0
  12. package/.agents/skills/firecrawl-build-onboarding/references/sdk-installation.md +17 -0
  13. package/.agents/skills/firecrawl-build-scrape/SKILL.md +68 -0
  14. package/.agents/skills/firecrawl-build-search/SKILL.md +68 -0
  15. package/.agents/skills/firecrawl-crawl/SKILL.md +58 -0
  16. package/.agents/skills/firecrawl-download/SKILL.md +69 -0
  17. package/.agents/skills/firecrawl-interact/SKILL.md +83 -0
  18. package/.agents/skills/firecrawl-map/SKILL.md +50 -0
  19. package/.agents/skills/firecrawl-parse/SKILL.md +61 -0
  20. package/.agents/skills/firecrawl-scrape/SKILL.md +68 -0
  21. package/.agents/skills/firecrawl-search/SKILL.md +59 -0
  22. package/.agents/skills/obsidian-bases/SKILL.md +299 -0
  23. package/.agents/skills/obsidian-markdown/SKILL.md +237 -0
  24. package/.agents/skills/posthog-analyst/SKILL.md +306 -0
  25. package/.agents/skills/posthog-analyst/evals/evals.json +23 -0
  26. package/.agents/skills/wiki/SKILL.md +215 -0
  27. package/.agents/skills/wiki/references/css-snippets.md +122 -0
  28. package/.agents/skills/wiki/references/frontmatter.md +107 -0
  29. package/.agents/skills/wiki/references/git-setup.md +58 -0
  30. package/.agents/skills/wiki/references/mcp-setup.md +149 -0
  31. package/.agents/skills/wiki/references/modes.md +259 -0
  32. package/.agents/skills/wiki/references/plugins.md +96 -0
  33. package/.agents/skills/wiki/references/rest-api.md +124 -0
  34. package/.agents/skills/wiki-autoresearch/SKILL.md +211 -0
  35. package/.agents/skills/wiki-autoresearch/references/program.md +75 -0
  36. package/.agents/skills/wiki-fold/SKILL.md +204 -0
  37. package/.agents/skills/wiki-fold/references/fold-template.md +133 -0
  38. package/.agents/skills/wiki-ingest/SKILL.md +288 -0
  39. package/.agents/skills/wiki-lint/SKILL.md +183 -0
  40. package/.agents/skills/wiki-query/SKILL.md +176 -0
  41. package/.agents/skills/wiki-save/SKILL.md +128 -0
  42. package/.ckignore +41 -0
  43. package/.env.example +9 -0
  44. package/.github/workflows/lint.yml +33 -0
  45. package/.github/workflows/publish-github-packages.yml +35 -0
  46. package/.github/workflows/publish-npm.yml +1 -1
  47. package/.pi/SYSTEM.md +107 -40
  48. package/.pi/agents/pi-pi/agent-expert.md +205 -0
  49. package/.pi/agents/pi-pi/cli-expert.md +47 -0
  50. package/.pi/agents/pi-pi/config-expert.md +67 -0
  51. package/.pi/agents/pi-pi/ext-expert.md +53 -0
  52. package/.pi/agents/pi-pi/keybinding-expert.md +123 -0
  53. package/.pi/agents/pi-pi/pi-orchestrator.md +103 -0
  54. package/.pi/agents/pi-pi/prompt-expert.md +83 -0
  55. package/.pi/agents/pi-pi/skill-expert.md +52 -0
  56. package/.pi/agents/pi-pi/theme-expert.md +46 -0
  57. package/.pi/agents/pi-pi/tui-expert.md +100 -0
  58. package/.pi/agents/rethink.md +140 -0
  59. package/.pi/agents/wiki-ingest.md +67 -0
  60. package/.pi/agents/wiki-lint.md +75 -0
  61. package/.pi/auto-commit.json +20 -0
  62. package/.pi/extensions/banner.png +0 -0
  63. package/.pi/extensions/ck-enforce.ts +216 -0
  64. package/.pi/extensions/custom-footer.ts +308 -0
  65. package/.pi/extensions/custom-header.ts +116 -0
  66. package/.pi/extensions/dotenv-loader.ts +170 -0
  67. package/.pi/internal/cursor-sdk-transcript-parser.ts +59 -0
  68. package/.pi/model-router.json +95 -0
  69. package/.pi/npm/.gitignore +2 -0
  70. package/.pi/prompts/git-sync.md +124 -0
  71. package/.pi/prompts/harness-setup.md +509 -0
  72. package/.pi/prompts/save.md +16 -0
  73. package/.pi/prompts/wiki-autoresearch.md +19 -0
  74. package/.pi/prompts/wiki.md +23 -0
  75. package/.pi/providers/cursor-sdk-provider.test.mjs +476 -0
  76. package/.pi/providers/cursor-sdk-provider.ts +1085 -0
  77. package/.pi/settings.json +14 -4
  78. package/.pi/skills/agent-router/SKILL.md +174 -0
  79. package/.pi/sounds/alert/1-kaching-track.mp3 +0 -0
  80. package/.pi/sounds/error/1-ksi-wth-track.mp3 +0 -0
  81. package/.pi/sounds/error/2-smash-track.mp3 +0 -0
  82. package/.pi/sounds/error/3-buzzer-track.mp3 +0 -0
  83. package/.pi/sounds/notification/1-soft-notification-track.mp3 +0 -0
  84. package/.pi/sounds/project-sounds.json +25 -0
  85. package/.pi/sounds/reminder/1-soft-notification-track.mp3 +0 -0
  86. package/.pi/sounds/success/1-tada-track.mp3 +0 -0
  87. package/.pi/sounds/success/2-jobs-done-track.mp3 +0 -0
  88. package/.pi/sounds/success/3-yay-track.mp3 +0 -0
  89. package/CONTRIBUTING.md +116 -0
  90. package/README.md +32 -39
  91. package/biome.json +34 -0
  92. package/firecrawl/.env.template +58 -0
  93. package/firecrawl/README.md +49 -0
  94. package/firecrawl/docker-compose.yaml +201 -0
  95. package/firecrawl/searxng/searxng.env +3 -0
  96. package/firecrawl/searxng/settings.yml +85 -0
  97. package/lefthook.yml +8 -0
  98. package/package.json +55 -24
  99. package/vault/AGENTS.md +37 -0
  100. package/vault/wiki/_templates/comparison.md +39 -0
  101. package/vault/wiki/_templates/concept.md +40 -0
  102. package/vault/wiki/_templates/decision.md +21 -0
  103. package/vault/wiki/_templates/entity.md +32 -0
  104. package/vault/wiki/_templates/flow.md +14 -0
  105. package/vault/wiki/_templates/module.md +18 -0
  106. package/vault/wiki/_templates/question.md +31 -0
  107. package/vault/wiki/_templates/source.md +39 -0
  108. package/vault/wiki/concepts/AST-Aware Code Chunking.md +44 -0
  109. package/vault/wiki/concepts/Build-Time Prompt Compilation.md +107 -0
  110. package/vault/wiki/concepts/Context Engine (AI Coding).md +47 -0
  111. package/vault/wiki/concepts/Context-Aware System Reminders.md +61 -0
  112. package/vault/wiki/concepts/Contextualized Text Embedding.md +42 -0
  113. package/vault/wiki/concepts/Contractor vs Employee AI Model.md +55 -0
  114. package/vault/wiki/concepts/Dual-Model Agent Architecture.md +65 -0
  115. package/vault/wiki/concepts/Late Chunking vs Early Chunking.md +43 -0
  116. package/vault/wiki/concepts/Majority Vote Ensembling.md +68 -0
  117. package/vault/wiki/concepts/Meta-Harness.md +16 -0
  118. package/vault/wiki/concepts/Multi-Agent AI Coding Architecture.md +75 -0
  119. package/vault/wiki/concepts/Prompt Enhancement.md +90 -0
  120. package/vault/wiki/concepts/Prompt Renderer.md +89 -0
  121. package/vault/wiki/concepts/Semantic Codebase Indexing.md +67 -0
  122. package/vault/wiki/concepts/additive-config-hierarchy.md +16 -0
  123. package/vault/wiki/concepts/agent-artifacts-verifiable-deliverables.md +71 -0
  124. package/vault/wiki/concepts/agent-browser-browser-automation.md +99 -0
  125. package/vault/wiki/concepts/agent-codebase-interface.md +43 -0
  126. package/vault/wiki/concepts/agent-harness-architecture.md +67 -0
  127. package/vault/wiki/concepts/agent-loop-detection-patterns.md +133 -0
  128. package/vault/wiki/concepts/agent-search-enforcement.md +126 -0
  129. package/vault/wiki/concepts/agent-skills-ecosystem.md +74 -0
  130. package/vault/wiki/concepts/agent-skills-pattern.md +68 -0
  131. package/vault/wiki/concepts/agentic-harness-context-enforcement.md +91 -0
  132. package/vault/wiki/concepts/agentic-harness.md +34 -0
  133. package/vault/wiki/concepts/agentic-orchestration-pipeline.md +56 -0
  134. package/vault/wiki/concepts/agentic-search-no-embeddings.md +18 -0
  135. package/vault/wiki/concepts/anthropic-context-engineering.md +13 -0
  136. package/vault/wiki/concepts/antigravity-agent-first-architecture.md +61 -0
  137. package/vault/wiki/concepts/ast-compression.md +19 -0
  138. package/vault/wiki/concepts/ast-truncation.md +66 -0
  139. package/vault/wiki/concepts/barrel-files.md +37 -0
  140. package/vault/wiki/concepts/browser-harness-agent.md +41 -0
  141. package/vault/wiki/concepts/browser-subagent-visual-verification.md +82 -0
  142. package/vault/wiki/concepts/codebase-intelligence-ecosystem-comparison.md +192 -0
  143. package/vault/wiki/concepts/codebase-intelligence-harness-integration.md +161 -0
  144. package/vault/wiki/concepts/codebase-to-context-ingestion.md +46 -0
  145. package/vault/wiki/concepts/codex-harness-innovations.md +147 -0
  146. package/vault/wiki/concepts/consensus-debate-flow.md +17 -0
  147. package/vault/wiki/concepts/consensus-debate.md +206 -0
  148. package/vault/wiki/concepts/content-addressed-spec-identity.md +166 -0
  149. package/vault/wiki/concepts/context-anxiety.md +57 -0
  150. package/vault/wiki/concepts/context-compression-techniques.md +19 -0
  151. package/vault/wiki/concepts/context-continuity.md +22 -0
  152. package/vault/wiki/concepts/context-drift-in-agents.md +106 -0
  153. package/vault/wiki/concepts/context-engineering.md +62 -0
  154. package/vault/wiki/concepts/context-folding.md +67 -0
  155. package/vault/wiki/concepts/context-mode.md +38 -0
  156. package/vault/wiki/concepts/cursor-harness-innovations.md +107 -0
  157. package/vault/wiki/concepts/deterministic-session-compaction.md +79 -0
  158. package/vault/wiki/concepts/drift-detection-unified.md +296 -0
  159. package/vault/wiki/concepts/execution-feedback-loop.md +46 -0
  160. package/vault/wiki/concepts/feedforward-feedback-harness.md +60 -0
  161. package/vault/wiki/concepts/five-root-cause-metrics-sentrux.md +40 -0
  162. package/vault/wiki/concepts/fork-safe-spec-storage.md +89 -0
  163. package/vault/wiki/concepts/fts5-sandbox.md +19 -0
  164. package/vault/wiki/concepts/fuzzy-edit-matching.md +71 -0
  165. package/vault/wiki/concepts/gemini-cli-architecture.md +104 -0
  166. package/vault/wiki/concepts/generator-evaluator-architecture.md +64 -0
  167. package/vault/wiki/concepts/guardian-agent-pattern.md +67 -0
  168. package/vault/wiki/concepts/harness-configuration-layers.md +89 -0
  169. package/vault/wiki/concepts/harness-control-frameworks.md +155 -0
  170. package/vault/wiki/concepts/harness-engineering-first-principles.md +90 -0
  171. package/vault/wiki/concepts/harness-h-formalism.md +53 -0
  172. package/vault/wiki/concepts/hybrid-code-search.md +61 -0
  173. package/vault/wiki/concepts/inline-post-edit-validation.md +112 -0
  174. package/vault/wiki/concepts/legendary-engineering-patterns-harness.md +110 -0
  175. package/vault/wiki/concepts/lifecycle-hooks.md +94 -0
  176. package/vault/wiki/concepts/mcp-tool-routing.md +102 -0
  177. package/vault/wiki/concepts/memory-system-of-record-vs-ephemeral-cache.md +47 -0
  178. package/vault/wiki/concepts/meta-agent-context-pruning.md +151 -0
  179. package/vault/wiki/concepts/model-adaptive-harness.md +122 -0
  180. package/vault/wiki/concepts/model-routing-agents.md +101 -0
  181. package/vault/wiki/concepts/monorepo-architecture.md +45 -0
  182. package/vault/wiki/concepts/multi-agent-specialization.md +61 -0
  183. package/vault/wiki/concepts/permission-subsystem.md +16 -0
  184. package/vault/wiki/concepts/pi-messenger-analysis.md +243 -0
  185. package/vault/wiki/concepts/pi-vscode-extension-landscape.md +37 -0
  186. package/vault/wiki/concepts/policy-engine-pattern.md +78 -0
  187. package/vault/wiki/concepts/progressive-disclosure-agents.md +53 -0
  188. package/vault/wiki/concepts/progressive-skill-disclosure.md +17 -0
  189. package/vault/wiki/concepts/provider-native-prompting.md +203 -0
  190. package/vault/wiki/concepts/quality-signal-sentrux.md +37 -0
  191. package/vault/wiki/concepts/repo-map-ranking.md +42 -0
  192. package/vault/wiki/concepts/result-monad-error-handling.md +47 -0
  193. package/vault/wiki/concepts/safety-defense-in-depth.md +83 -0
  194. package/vault/wiki/concepts/sandbox-os-enforcement.md +18 -0
  195. package/vault/wiki/concepts/selective-debate-routing.md +70 -0
  196. package/vault/wiki/concepts/self-evolving-harness.md +60 -0
  197. package/vault/wiki/concepts/sentrux-mcp-integration.md +36 -0
  198. package/vault/wiki/concepts/sentrux-rules-engine.md +49 -0
  199. package/vault/wiki/concepts/shell-pattern-compression.md +24 -0
  200. package/vault/wiki/concepts/skill-first-architecture.md +166 -0
  201. package/vault/wiki/concepts/structured-compaction.md +78 -0
  202. package/vault/wiki/concepts/subagent-orchestration.md +17 -0
  203. package/vault/wiki/concepts/subagent-worktree-isolation.md +68 -0
  204. package/vault/wiki/concepts/superpowers-methodology.md +78 -0
  205. package/vault/wiki/concepts/think-in-code.md +73 -0
  206. package/vault/wiki/concepts/ts-execution-layer.md +100 -0
  207. package/vault/wiki/concepts/typescript-strict-mode.md +37 -0
  208. package/vault/wiki/concepts/vcc-conversation-compaction-for-pi.md +51 -0
  209. package/vault/wiki/concepts/verification-drift-detection.md +19 -0
  210. package/vault/wiki/consensus/consensus-records.md +58 -0
  211. package/vault/wiki/decisions/2026-04-30-pi-lean-ctx-native.md +122 -0
  212. package/vault/wiki/decisions/adr-008.md +40 -0
  213. package/vault/wiki/decisions/adr-009.md +46 -0
  214. package/vault/wiki/decisions/adr-010.md +55 -0
  215. package/vault/wiki/decisions/adr-011.md +165 -0
  216. package/vault/wiki/decisions/adr-012.md +102 -0
  217. package/vault/wiki/decisions/adr-013.md +59 -0
  218. package/vault/wiki/decisions/adr-014.md +73 -0
  219. package/vault/wiki/decisions/adr-015.md +81 -0
  220. package/vault/wiki/decisions/adr-016.md +91 -0
  221. package/vault/wiki/decisions/adr-017.md +79 -0
  222. package/vault/wiki/decisions/adr-018.md +100 -0
  223. package/vault/wiki/decisions/adr-019.md +75 -0
  224. package/vault/wiki/decisions/adr-020.md +106 -0
  225. package/vault/wiki/decisions/adr-021.md +86 -0
  226. package/vault/wiki/decisions/adr-022.md +113 -0
  227. package/vault/wiki/decisions/adr-023.md +113 -0
  228. package/vault/wiki/decisions/adr-024.md +73 -0
  229. package/vault/wiki/decisions/adr-025.md +130 -0
  230. package/vault/wiki/decisions/adr-026.md +56 -0
  231. package/vault/wiki/decisions/colocate-wiki.md +34 -0
  232. package/vault/wiki/entities/Anders Hejlsberg.md +29 -0
  233. package/vault/wiki/entities/Anthropic.md +17 -0
  234. package/vault/wiki/entities/Augment Code.md +49 -0
  235. package/vault/wiki/entities/Bjarne Stroustrup.md +26 -0
  236. package/vault/wiki/entities/Bolt.new (StackBlitz).md +39 -0
  237. package/vault/wiki/entities/Boris Cherny.md +11 -0
  238. package/vault/wiki/entities/Claude Code.md +19 -0
  239. package/vault/wiki/entities/Dennis Ritchie.md +26 -0
  240. package/vault/wiki/entities/Emergent Labs.md +32 -0
  241. package/vault/wiki/entities/Google Cloud.md +16 -0
  242. package/vault/wiki/entities/Guido van Rossum.md +28 -0
  243. package/vault/wiki/entities/Ken Thompson.md +28 -0
  244. package/vault/wiki/entities/Lee et al.md +16 -0
  245. package/vault/wiki/entities/Linus Torvalds.md +28 -0
  246. package/vault/wiki/entities/Lovable (company).md +40 -0
  247. package/vault/wiki/entities/Martin Fowler.md +16 -0
  248. package/vault/wiki/entities/Meng et al.md +16 -0
  249. package/vault/wiki/entities/OpenAI.md +16 -0
  250. package/vault/wiki/entities/Rocket.new.md +38 -0
  251. package/vault/wiki/entities/VILA-Lab.md +15 -0
  252. package/vault/wiki/entities/autodev-codebase.md +18 -0
  253. package/vault/wiki/entities/ck-tool.md +59 -0
  254. package/vault/wiki/entities/codesearch.md +18 -0
  255. package/vault/wiki/entities/disler-indydevdan.md +33 -0
  256. package/vault/wiki/entities/gsd-get-shit-done.md +56 -0
  257. package/vault/wiki/entities/javascript-runtimes.md +48 -0
  258. package/vault/wiki/entities/jesse-vincent.md +38 -0
  259. package/vault/wiki/entities/lean-ctx.md +32 -0
  260. package/vault/wiki/entities/opendev.md +41 -0
  261. package/vault/wiki/entities/ops-codegraph-tool.md +18 -0
  262. package/vault/wiki/entities/pi-coding-agent.md +53 -0
  263. package/vault/wiki/entities/sentrux.md +54 -0
  264. package/vault/wiki/entities/vgrep-tool.md +57 -0
  265. package/vault/wiki/entities/vitest.md +41 -0
  266. package/vault/wiki/flows/harness-wiki-pipeline.md +204 -0
  267. package/vault/wiki/hot.md +932 -0
  268. package/vault/wiki/index.md +437 -0
  269. package/vault/wiki/log.md +418 -0
  270. package/vault/wiki/meta/dashboard.md +30 -0
  271. package/vault/wiki/meta/lint-report-2026-04-30.md +86 -0
  272. package/vault/wiki/meta/lint-report-2026-05-02.md +251 -0
  273. package/vault/wiki/meta/overview.canvas +43 -0
  274. package/vault/wiki/modules/adversarial-verification.md +57 -0
  275. package/vault/wiki/modules/automated-observability.md +54 -0
  276. package/vault/wiki/modules/bench.md +20 -0
  277. package/vault/wiki/modules/extensions.md +23 -0
  278. package/vault/wiki/modules/grounding-checkpoints.md +62 -0
  279. package/vault/wiki/modules/harness-implementation-plan.md +345 -0
  280. package/vault/wiki/modules/harness-wiki-skill-mapping.md +135 -0
  281. package/vault/wiki/modules/harness.md +86 -0
  282. package/vault/wiki/modules/persistent-memory.md +85 -0
  283. package/vault/wiki/modules/schema-orchestration.md +68 -0
  284. package/vault/wiki/modules/skills.md +27 -0
  285. package/vault/wiki/modules/spec-hardening.md +58 -0
  286. package/vault/wiki/modules/structured-planning.md +53 -0
  287. package/vault/wiki/modules/think-in-code-enforcement.md +153 -0
  288. package/vault/wiki/modules/wiki-query-interface.md +64 -0
  289. package/vault/wiki/overview.md +51 -0
  290. package/vault/wiki/questions/Research-pi-vs-claude-code-agentic-orchestration-pipeline.md +87 -0
  291. package/vault/wiki/questions/Research-sentrux-dev.md +123 -0
  292. package/vault/wiki/questions/Research-superpowers-skill-for-agentic-coding-agents.md +164 -0
  293. package/vault/wiki/questions/Research: Augment Code Context Engine.md +244 -0
  294. package/vault/wiki/questions/Research: Automating Software Engineering - Lovable, Bolt, Emergent, Rocket.md +112 -0
  295. package/vault/wiki/questions/Research: Claude Code State-of-the-Art Harness Improvements.md +209 -0
  296. package/vault/wiki/questions/Research: Codex State-of-the-Art Harness Improvements.md +99 -0
  297. package/vault/wiki/questions/Research: Engineering Workflows of Legendary Programmers and AI Harness Mapping.md +107 -0
  298. package/vault/wiki/questions/Research: Fallow Codebase Intelligence Harness Integration.md +72 -0
  299. package/vault/wiki/questions/Research: Gemini CLI SOTA Harness Integration.md +166 -0
  300. package/vault/wiki/questions/Research: GitHub Issues as Harness Spec Storage.md +188 -0
  301. package/vault/wiki/questions/Research: Google Antigravity Harness Integration.md +120 -0
  302. package/vault/wiki/questions/Research: Meta-Agent Context Drift Detection.md +236 -0
  303. package/vault/wiki/questions/Research: Model-Adaptive Agent Harness Design.md +95 -0
  304. package/vault/wiki/questions/Research: Model-Specific Prompting Guides.md +165 -0
  305. package/vault/wiki/questions/Research: Prompt Renderer for Multi-Model Agent Harness.md +216 -0
  306. package/vault/wiki/questions/Research: Skill-First Harness Architecture.md +91 -0
  307. package/vault/wiki/questions/Research: TypeScript Best Practices and Codebase Structure.md +88 -0
  308. package/vault/wiki/questions/Research: TypeScript Execution Layer for Agent Tool Calling.md +81 -0
  309. package/vault/wiki/questions/Research: claude-mem over Obsidian for Harness Layer.md +71 -0
  310. package/vault/wiki/questions/Research: claude-mem over obsidian wiki as the knowledge base for our agentic harness pipeline. think from first principles. does this replace or complement our current setup? no hard feelings about previous decisions. gimme accurate points.md +80 -0
  311. package/vault/wiki/questions/Research: context-mode vs lean-ctx.md +72 -0
  312. package/vault/wiki/questions/Research: cursor.sh Harness Innovations.md +92 -0
  313. package/vault/wiki/questions/Research: executor.sh Harness Integration.md +170 -0
  314. package/vault/wiki/questions/Research: how GSD fits into our coding harness setup.md +97 -0
  315. package/vault/wiki/questions/Research: how claude-mem fits into our workflow. and whether it should replace obsidian in the codebase. no hard feelings about previous actions, rethink from first principles always.md +80 -0
  316. package/vault/wiki/questions/Research: pi-vcc.md +113 -0
  317. package/vault/wiki/questions/Research: semantic code search tools.md +69 -0
  318. package/vault/wiki/questions/Research: vcc extension for pi coding agent.md +73 -0
  319. package/vault/wiki/questions/how-to-enable-semantic-code-search-now.md +111 -0
  320. package/vault/wiki/questions/mvp-implementation-blueprint.md +552 -0
  321. package/vault/wiki/questions/research-agent-first-codebase-exploration.md +199 -0
  322. package/vault/wiki/questions/research-agentic-coding-harness-latest-papers.md +142 -0
  323. package/vault/wiki/questions/research-gitingest-gitreverse-integration.md +100 -0
  324. package/vault/wiki/questions/research-wozcode-token-reduction.md +67 -0
  325. package/vault/wiki/questions/resolved-context-pruning-inplace-vs-restart.md +95 -0
  326. package/vault/wiki/questions/resolved-context-window-economics.md +167 -0
  327. package/vault/wiki/questions/resolved-imad-debate-gating-transfer.md +126 -0
  328. package/vault/wiki/questions/resolved-mcp-tool-preference.md +112 -0
  329. package/vault/wiki/questions/resolved-small-model-meta-agents.md +107 -0
  330. package/vault/wiki/questions/resolved-treesitter-dynamic-languages.md +95 -0
  331. package/vault/wiki/sources/Auggie Context MCP Server.md +63 -0
  332. package/vault/wiki/sources/Augment Code Codacy AI Giants.md +61 -0
  333. package/vault/wiki/sources/Augment Code MCP SiliconAngle.md +49 -0
  334. package/vault/wiki/sources/Augment Code WorkOS ERC 2025.md +55 -0
  335. package/vault/wiki/sources/Augment Context Engine Official.md +71 -0
  336. package/vault/wiki/sources/Augment SWE-bench Agent GitHub.md +74 -0
  337. package/vault/wiki/sources/Augment SWE-bench Pro Blog.md +58 -0
  338. package/vault/wiki/sources/Source: AgentBus Jinja2 Prompt Pipelines.md +75 -0
  339. package/vault/wiki/sources/Source: Arxiv /342/200/224 Don't Break the Cache.md" +85 -0
  340. package/vault/wiki/sources/Source: Augment - Harness Engineering for AI Coding Agents.md +58 -0
  341. package/vault/wiki/sources/Source: Blake Crosley Agent Architecture Guide.md +100 -0
  342. package/vault/wiki/sources/Source: Bolt.new Architecture & Case Study.md +75 -0
  343. package/vault/wiki/sources/Source: Build-Time Prompt Compilation Architecture.md +107 -0
  344. package/vault/wiki/sources/Source: Claude API Agent Skills Overview.md +70 -0
  345. package/vault/wiki/sources/Source: Gemini CLI Changelogs.md +88 -0
  346. package/vault/wiki/sources/Source: Google Blog - Gemini CLI Announcement.md +57 -0
  347. package/vault/wiki/sources/Source: Google Gemini CLI Architecture Docs.md +53 -0
  348. package/vault/wiki/sources/Source: LangChain - Anatomy of Agent Harness.md +65 -0
  349. package/vault/wiki/sources/Source: Lovable Architecture & Clone Analysis.md +83 -0
  350. package/vault/wiki/sources/Source: Martin Fowler - Harness Engineering.md +70 -0
  351. package/vault/wiki/sources/Source: OpenAI Harness Engineering Five Principles.md +58 -0
  352. package/vault/wiki/sources/Source: OpenAI Harness Engineering /342/200/224 0 Lines of Human Code.md" +101 -0
  353. package/vault/wiki/sources/Source: OpenDev /342/200/224 Building AI Coding Agents for the Terminal.md" +100 -0
  354. package/vault/wiki/sources/Source: Render AI Coding Agents Benchmark 2025.md +53 -0
  355. package/vault/wiki/sources/Source: Rocket.new /342/200/224 Vibe Solutioning Platform.md" +70 -0
  356. package/vault/wiki/sources/Source: SwirlAI Agent Skills Progressive Disclosure.md +71 -0
  357. package/vault/wiki/sources/Source: TianPan Prompt Caching Architecture.md +89 -0
  358. package/vault/wiki/sources/Source: Vercel Labs agent-browser.md +155 -0
  359. package/vault/wiki/sources/Source: browser-harness CDP Harness.md +126 -0
  360. package/vault/wiki/sources/agent-drift-academic-paper.md +79 -0
  361. package/vault/wiki/sources/aider-repomap-tree-sitter.md +42 -0
  362. package/vault/wiki/sources/anthropic-compaction-api.md +58 -0
  363. package/vault/wiki/sources/anthropic-effective-harnesses.md +42 -0
  364. package/vault/wiki/sources/anthropic-prompt-best-practices.md +100 -0
  365. package/vault/wiki/sources/anthropic2026-harness-design.md +63 -0
  366. package/vault/wiki/sources/barrel-files-tkdodo.md +38 -0
  367. package/vault/wiki/sources/birth-of-unix-kernighan-interview.md +57 -0
  368. package/vault/wiki/sources/bockeler2026-harness-engineering.md +69 -0
  369. package/vault/wiki/sources/cast-code-chunking-paper.md +50 -0
  370. package/vault/wiki/sources/ck-semantic-search.md +78 -0
  371. package/vault/wiki/sources/claude-code-architecture-karaxai-2026.md +71 -0
  372. package/vault/wiki/sources/claude-code-architecture-qubytes-2026.md +50 -0
  373. package/vault/wiki/sources/claude-code-architecture-vila-lab-2026.md +64 -0
  374. package/vault/wiki/sources/claude-code-security-architecture-penligent-2026.md +70 -0
  375. package/vault/wiki/sources/claude-context-editing-docs.md +13 -0
  376. package/vault/wiki/sources/cloudflare-codemode.md +63 -0
  377. package/vault/wiki/sources/code-chunk-library-supermemory.md +63 -0
  378. package/vault/wiki/sources/codeact-apple-2024.md +62 -0
  379. package/vault/wiki/sources/codex-dsc-rfc-8573.md +41 -0
  380. package/vault/wiki/sources/codex-open-source-agent-2026.md +110 -0
  381. package/vault/wiki/sources/coir-code-retrieval-benchmark.md +51 -0
  382. package/vault/wiki/sources/colinmcnamara-context-optimization-codemode.md +48 -0
  383. package/vault/wiki/sources/context-folding-paper.md +61 -0
  384. package/vault/wiki/sources/context-mode-website.md +63 -0
  385. package/vault/wiki/sources/cursor-agent-best-practices-2026.md +62 -0
  386. package/vault/wiki/sources/cursor-fork-29b-2025.md +50 -0
  387. package/vault/wiki/sources/cursor-harness-april-2026.md +76 -0
  388. package/vault/wiki/sources/cursor-instant-apply-2024.md +45 -0
  389. package/vault/wiki/sources/cursor-shadow-workspace-2024.md +52 -0
  390. package/vault/wiki/sources/cursor-shipped-coding-agent-2026.md +53 -0
  391. package/vault/wiki/sources/cursor-vs-antigravity-2026.md +51 -0
  392. package/vault/wiki/sources/disler-pi-vs-claude-code.md +69 -0
  393. package/vault/wiki/sources/distill-deterministic-context-compression.md +53 -0
  394. package/vault/wiki/sources/embedding-models-benchmark-supermemory-2025.md +48 -0
  395. package/vault/wiki/sources/executor-rhyssullivan.md +122 -0
  396. package/vault/wiki/sources/fallow-rs-codebase-intelligence.md +125 -0
  397. package/vault/wiki/sources/fan2025-imad.md +60 -0
  398. package/vault/wiki/sources/forgecode-gpt5-agent-improvements.md +63 -0
  399. package/vault/wiki/sources/gemini-3-prompting-guide.md +78 -0
  400. package/vault/wiki/sources/gh-cli-sub-issue-rfc.md +50 -0
  401. package/vault/wiki/sources/gh-sub-issue-extension.md +72 -0
  402. package/vault/wiki/sources/github-fork-issues-discussion.md +44 -0
  403. package/vault/wiki/sources/github-issue-dependencies-docs.md +49 -0
  404. package/vault/wiki/sources/github-sub-issues-docs.md +51 -0
  405. package/vault/wiki/sources/gitingest.md +91 -0
  406. package/vault/wiki/sources/gitreverse.md +63 -0
  407. package/vault/wiki/sources/google-antigravity-official-blog.md +47 -0
  408. package/vault/wiki/sources/google-antigravity-wikipedia.md +53 -0
  409. package/vault/wiki/sources/gsd-codecentric-deep-dive.md +57 -0
  410. package/vault/wiki/sources/gsd-github-repo.md +51 -0
  411. package/vault/wiki/sources/gsd-hn-discussion.md +59 -0
  412. package/vault/wiki/sources/guido-python-design-philosophy.md +56 -0
  413. package/vault/wiki/sources/hejlsberg-7-learnings.md +48 -0
  414. package/vault/wiki/sources/ironclaw-drift-monitor.md +80 -0
  415. package/vault/wiki/sources/langsight-loop-detection.md +80 -0
  416. package/vault/wiki/sources/leanctx-website.md +69 -0
  417. package/vault/wiki/sources/lee2026-meta-harness.md +59 -0
  418. package/vault/wiki/sources/linux-kernel-coding-workflow.md +50 -0
  419. package/vault/wiki/sources/lou2026-autoharness.md +53 -0
  420. package/vault/wiki/sources/martin-fowler-harness-engineering.md +73 -0
  421. package/vault/wiki/sources/mcp-architecture-docs.md +13 -0
  422. package/vault/wiki/sources/meng2026-agent-harness-survey.md +79 -0
  423. package/vault/wiki/sources/mindstudio-four-agent-types.md +68 -0
  424. package/vault/wiki/sources/ms-chat-history-management.md +13 -0
  425. package/vault/wiki/sources/openai-prompt-guidance.md +104 -0
  426. package/vault/wiki/sources/openclaw-session-pruning.md +13 -0
  427. package/vault/wiki/sources/opencode-dcp.md +13 -0
  428. package/vault/wiki/sources/opendev-arxiv-2603.05344v1.md +79 -0
  429. package/vault/wiki/sources/openhands-platform.md +39 -0
  430. package/vault/wiki/sources/oss-guide-codebase-exploration.md +53 -0
  431. package/vault/wiki/sources/pi-compaction-extensions-ecosystem.md +102 -0
  432. package/vault/wiki/sources/pi-context-prune-github-repo.md +38 -0
  433. package/vault/wiki/sources/pi-mono-compaction-docs.md +38 -0
  434. package/vault/wiki/sources/pi-omni-compact-github-repo.md +50 -0
  435. package/vault/wiki/sources/pi-rtk-optimizer-github-repo.md +45 -0
  436. package/vault/wiki/sources/pi-vcc-github-repo.md +69 -0
  437. package/vault/wiki/sources/pi-vscode-marketplace.md +41 -0
  438. package/vault/wiki/sources/pi-vscode-model-provider-marketplace.md +39 -0
  439. package/vault/wiki/sources/py-tree-sitter.md +13 -0
  440. package/vault/wiki/sources/sentrux-dev-landing.md +40 -0
  441. package/vault/wiki/sources/sentrux-docs-pro-architecture.md +75 -0
  442. package/vault/wiki/sources/sentrux-docs-quality-signal.md +46 -0
  443. package/vault/wiki/sources/sentrux-docs-root-cause-metrics.md +57 -0
  444. package/vault/wiki/sources/sentrux-docs-rules-engine.md +58 -0
  445. package/vault/wiki/sources/sentrux-github-repo.md +56 -0
  446. package/vault/wiki/sources/superpowers-github-repo.md +56 -0
  447. package/vault/wiki/sources/superpowers-release-blog.md +54 -0
  448. package/vault/wiki/sources/superpowers-termdock-analysis.md +45 -0
  449. package/vault/wiki/sources/swe-agent-aci.md +42 -0
  450. package/vault/wiki/sources/swe-bench.md +45 -0
  451. package/vault/wiki/sources/swe-pruner-context-pruning.md +13 -0
  452. package/vault/wiki/sources/think-in-code-blog.md +48 -0
  453. package/vault/wiki/sources/tree-sitter-docs.md +13 -0
  454. package/vault/wiki/sources/ts-best-practices-2025-devto.md +42 -0
  455. package/vault/wiki/sources/ts-folder-structure-mingyang.md +58 -0
  456. package/vault/wiki/sources/ts-monorepo-koerselman.md +44 -0
  457. package/vault/wiki/sources/ts-result-error-handling-kkalamarski.md +52 -0
  458. package/vault/wiki/sources/ts-runtimes-comparison-betterstack.md +42 -0
  459. package/vault/wiki/sources/ts-strict-mode-rishikc.md +43 -0
  460. package/vault/wiki/sources/unix-philosophy.md +48 -0
  461. package/vault/wiki/sources/vectara-chunking-vs-embedding-naacl2025.md +39 -0
  462. package/vault/wiki/sources/vectara-guardian-agents.md +79 -0
  463. package/vault/wiki/sources/vgrep-semantic-search.md +76 -0
  464. package/vault/wiki/sources/vitest-official.md +41 -0
  465. package/vault/wiki/sources/vscode-pi-community-extension.md +40 -0
  466. package/vault/wiki/sources/wozcode.md +79 -0
  467. package/.agents/skills/compress/SKILL.md +0 -111
  468. package/.agents/skills/compress/scripts/__init__.py +0 -9
  469. package/.agents/skills/compress/scripts/__main__.py +0 -3
  470. package/.agents/skills/compress/scripts/benchmark.py +0 -78
  471. package/.agents/skills/compress/scripts/cli.py +0 -73
  472. package/.agents/skills/compress/scripts/compress.py +0 -227
  473. package/.agents/skills/compress/scripts/detect.py +0 -121
  474. package/.agents/skills/compress/scripts/validate.py +0 -189
  475. package/.agents/skills/emil-design-eng/SKILL.md +0 -679
  476. package/.agents/skills/lean-ctx/SKILL.md +0 -149
  477. package/.agents/skills/lean-ctx/scripts/install.sh +0 -95
  478. package/.agents/skills/scrapling-official/LICENSE.txt +0 -28
  479. package/.agents/skills/scrapling-official/SKILL.md +0 -390
  480. package/.agents/skills/scrapling-official/examples/01_fetcher_session.py +0 -26
  481. package/.agents/skills/scrapling-official/examples/02_dynamic_session.py +0 -26
  482. package/.agents/skills/scrapling-official/examples/03_stealthy_session.py +0 -26
  483. package/.agents/skills/scrapling-official/examples/04_spider.py +0 -58
  484. package/.agents/skills/scrapling-official/examples/README.md +0 -45
  485. package/.agents/skills/scrapling-official/references/fetching/choosing.md +0 -78
  486. package/.agents/skills/scrapling-official/references/fetching/dynamic.md +0 -352
  487. package/.agents/skills/scrapling-official/references/fetching/static.md +0 -432
  488. package/.agents/skills/scrapling-official/references/fetching/stealthy.md +0 -255
  489. package/.agents/skills/scrapling-official/references/mcp-server.md +0 -214
  490. package/.agents/skills/scrapling-official/references/migrating_from_beautifulsoup.md +0 -86
  491. package/.agents/skills/scrapling-official/references/parsing/adaptive.md +0 -212
  492. package/.agents/skills/scrapling-official/references/parsing/main_classes.md +0 -586
  493. package/.agents/skills/scrapling-official/references/parsing/selection.md +0 -494
  494. package/.agents/skills/scrapling-official/references/spiders/advanced.md +0 -344
  495. package/.agents/skills/scrapling-official/references/spiders/architecture.md +0 -94
  496. package/.agents/skills/scrapling-official/references/spiders/getting-started.md +0 -164
  497. package/.agents/skills/scrapling-official/references/spiders/proxy-blocking.md +0 -235
  498. package/.agents/skills/scrapling-official/references/spiders/requests-responses.md +0 -196
  499. package/.agents/skills/scrapling-official/references/spiders/sessions.md +0 -205
  500. package/PLAN.md +0 -11
  501. package/extensions/lean-ctx-enforce.ts +0 -166
  502. package/skills-lock.json +0 -35
  503. package/wiki/README.md +0 -19
  504. package/wiki/decisions/0001-establish-project-wiki-and-decision-record-format.md +0 -25
  505. package/wiki/decisions/0002-add-project-banner-to-readme.md +0 -26
  506. package/wiki/decisions/0003-remove-redundant-readme-title-heading.md +0 -26
  507. package/wiki/decisions/0004-publish-package-to-npm-as-ultimate-pi.md +0 -26
  508. package/wiki/decisions/0005-automate-npm-publish-with-github-actions.md +0 -27
  509. package/wiki/decisions/0006-switch-to-npm-trusted-publishing.md +0 -26
  510. package/wiki/decisions/0007-use-absolute-banner-url-for-npm-readme-rendering.md +0 -26
  511. package/wiki/decisions/0008-rename-banner-asset-for-cache-busting.md +0 -26
  512. package/wiki/decisions/0009-force-oidc-path-by-clearing-node-auth-token-in-publish-step.md +0 -25
  513. package/wiki/decisions/0010-simplify-setup-node-for-npm-trusted-publishing.md +0 -26
  514. package/wiki/decisions/0011-add-noop-workflow-change-to-force-fresh-publish-run.md +0 -25
  515. package/wiki/decisions/0012-align-workflow-runtime-with-npm-trusted-publishing-requirements.md +0 -26
  516. package/wiki/decisions/0013-add-package-repository-url-for-provenance-validation.md +0 -25
@@ -0,0 +1,51 @@
1
+ ---
2
+ type: concept
3
+ status: developing
4
+ created: 2026-05-05
5
+ tags:
6
+ - pi-agent
7
+ - vcc
8
+ - compaction
9
+ - memory
10
+ related:
11
+ - "[[pi-vcc-github-repo]]"
12
+ - "[[context-continuity]]"
13
+ - "[[structured-compaction]]"
14
+ ---
15
+
16
+ # VCC Conversation Compaction for Pi
17
+
18
+ ## Definition
19
+
20
+ VCC in Pi context refers to transcript-preserving, deterministic compaction approach adopted by `pi-vcc`, inspired by View-oriented Conversation Compiler. It compresses sessions without calling an LLM, then adds recall over raw lineage history.
21
+
22
+ ## Core Mechanics
23
+
24
+ - Algorithmic extraction, not model summarization
25
+ - Stable sectioned output: goal, files, commits, outstanding context, preferences
26
+ - Explicit recall API (`vcc_recall`) with regex and lineage scope
27
+ - High token reduction on long sessions (often 90%+)
28
+
29
+ ## Practical Impact
30
+
31
+ For long-running coding sessions, VCC-style compaction reduces cost and hallucination risk during summarization while preserving retrievability of older context.
32
+
33
+ ## Competitive Position in Pi Ecosystem
34
+
35
+ pi-vcc is the only fully deterministic (no-LLM) compaction extension. Three other Pi compaction extensions exist but all use LLM calls:
36
+ - **pi-model-aware-compaction**: Per-model threshold triggers (timing control, not algorithm change)
37
+ - **pi-custom-compaction**: Swap compaction model/template (still LLM-based)
38
+ - **pi-agentic-compaction**: Virtual filesystem + sandboxed tools (still LLM-based)
39
+
40
+ See [[pi-compaction-extensions-ecosystem]] for full comparison and [[deterministic-session-compaction]] for the broader pattern.
41
+
42
+ ## Broader Pattern Validation
43
+
44
+ The deterministic compaction pattern is independently validated by:
45
+ - **Codex DSC RFC** (openai/codex#8573): Proposed identical approach for Codex, closed as not_planned (Source: [[codex-dsc-rfc-8573]])
46
+ - **Distill** (143 stars): Deterministic context preprocessing, different layer but same no-LLM principle (Source: [[distill-deterministic-context-compression]])
47
+ - **MemoSift**: 6-layer deterministic compression engine with framework adapters
48
+
49
+ ## Clarification
50
+
51
+ VCC here is **not** VS Code extension acronym. It is compaction method and Pi package category.
@@ -0,0 +1,19 @@
1
+ ---
2
+ type: concept
3
+ title: "verification-drift-detection"
4
+ created: 2026-04-30
5
+ updated: 2026-04-30
6
+ status: seed
7
+ tags: [#concept, #harness, #testing]
8
+ related:
9
+ - "[[execution-feedback-loop]]"
10
+ - "[[grounding-checkpoints]]"
11
+ ---
12
+
13
+ # Verification Drift Detection
14
+
15
+ > [!stub] See [[grounding-checkpoints]] for the harness implementation.
16
+
17
+ Detects when an agent's implementation drifts away from the spec or when verification results become stale. Part of the execution feedback loop: after each change, verify that the output still matches expected behavior. Drift detection triggers re-grounding — forcing the agent to re-read the spec before continuing.
18
+
19
+ In the ultimate-pi harness, this is implemented by Layer 3 ([[grounding-checkpoints]]), which enforces smallest-verifiable-change + drift detection on every checkpoint.
@@ -0,0 +1,58 @@
1
+ ---
2
+ type: index
3
+ title: Consensus Records
4
+ created: 2026-04-30
5
+ updated: 2026-04-30
6
+ status: active
7
+ tags: [consensus, debate, alignment, index]
8
+ related:
9
+ - "[[consensus-debate]]"
10
+ - "[[adr-011]]"
11
+ - "[[harness-implementation-plan]]"
12
+ ---
13
+
14
+ # Consensus Records
15
+
16
+ Permanent alignment records for all agent debates. **Every debate verdict — win, lose, or deadlock — is filed here.**
17
+
18
+ Future agents query this directory before forming positions. Contradicting a filed consensus triggers a harness block (L7 enforcement).
19
+
20
+ ## Directory Convention
21
+
22
+ - Filename: `[layer]-[topic-slug].md`
23
+ - Layers: `spec` (L1), `plan` (L2), `verify` (L4)
24
+ - Example: `spec-idempotency-key-design.md`
25
+
26
+ ## Consensus Page Template
27
+
28
+ ```markdown
29
+ ---
30
+ type: consensus
31
+ layer: spec | plan | verify
32
+ verdict: CONSENSUS_REACHED | DEADLOCK | BUDGET_EXHAUSTED | TIMEOUT
33
+ date: YYYY-MM-DD
34
+ participants: [agent-a, agent-b]
35
+ topic: "Brief description"
36
+ related: page-refs (wikilinks to related pages)
37
+ ---
38
+
39
+ # [Topic]
40
+
41
+ ## Final Position
42
+ [The winning / final agreed position]
43
+
44
+ ## Key Rounds Summary
45
+ | Round | Attacker | Defender | Outcome |
46
+ |-------|----------|----------|---------|
47
+ | 1 | ... | ... | ... |
48
+
49
+ ## Evidence References
50
+ - (wikilinks to evidence sources)
51
+
52
+ ## Rationale
53
+ Why this consensus was reached. What was settled.
54
+ ```
55
+
56
+ ## No records yet
57
+
58
+ Consensus filing begins with Phase P19b of the [[harness-implementation-plan]].
@@ -0,0 +1,122 @@
1
+ ---
2
+ type: decision
3
+ status: accepted
4
+ created: 2026-04-30
5
+ tags:
6
+ - lean-ctx
7
+ - pi
8
+ - extensions
9
+ - token-optimization
10
+ - mcp
11
+ related:
12
+ - "[[lean-ctx]]"
13
+ - "[[leanctx-website]]"
14
+ - "[[Research: context-mode vs lean-ctx]]"
15
+ updated: 2026-04-30
16
+ title: "ADR: Adopt pi-lean-ctx Native Package, Drop Custom Extension"
17
+
18
+ ---# ADR: Adopt pi-lean-ctx Native Package, Drop Custom Extension
19
+
20
+ ## Context
21
+
22
+ The ultimate-pi harness had a custom extension (`extensions/lean-ctx-enforce.ts`) that:
23
+
24
+ - Detected lean-ctx binary availability
25
+ - Wrapped `bash` commands with `lean-ctx -c` prefix
26
+ - Overrode `read` to call `lean-ctx read` with simple mode selection
27
+ - Registered `/lean-ctx-status` diagnostic command
28
+
29
+ This custom extension was a stopgap — basic, manual wrapping, no MCP bridge, no auto mode selection, no compression stats.
30
+
31
+ Meanwhile, the pi-lean-ctx npm package (v3.4.5, published by yvgude) provides a native Pi extension with full lean-ctx integration.
32
+
33
+ ## Alternatives Considered
34
+
35
+ 1. **Keep custom extension** — Simple, self-contained, no external npm dependency. But misses MCP bridge (48 tools), auto read-mode selection, ls/find/grep tools, compression stats, and reconnection logic.
36
+
37
+ 2. **Adopt pi-lean-ctx** — npm package maintained by lean-ctx author. Full MCP integration, all 48 lean-ctx MCP tools as native Pi tools, rich read mode selection, spawnHook bash wrapping, compression stats footer, reconnect/timeout-handling.
38
+
39
+ 3. **Hybrid: keep custom + add MCP manually** — Would duplicate effort. pi-lean-ctx already does everything better.
40
+
41
+ ## Decision
42
+
43
+ **Replace the custom `lean-ctx-enforce.ts` extension with the `pi-lean-ctx` npm package.**
44
+
45
+ ## Changes Made
46
+
47
+ | File | Action | Detail |
48
+ |------|--------|--------|
49
+ | `extensions/lean-ctx-enforce.ts` | Deleted | Replaced by pi-lean-ctx |
50
+ | `.pi/settings.json` | Edited | Added `"npm:pi-lean-ctx"` to packages array |
51
+ | `.pi/SYSTEM.md` | Edited | Updated skill routing line |
52
+ | `package.json` | Edited | Updated `check:ts` script to dotenv-loader |
53
+ | `.pi/skills/lean-ctx/SKILL.md` | Edited | Added integration note at top |
54
+ | `.pi/npm/node_modules/pi-lean-ctx` | Installed | v3.4.5 + all deps |
55
+
56
+ ## What pi-lean-ctx Provides
57
+
58
+ ### Tool Overrides
59
+
60
+ | Tool | Custom Ext | pi-lean-ctx |
61
+ |------|-----------|-------------|
62
+ | `bash` | Prepends `lean-ctx -c` | SpawnHook wraps `lean-ctx -c sh -lc` (preserves env, aliases). `raw=true` bypass option. |
63
+ | `read` | Basic `lean-ctx read -m lines/…` | Auto mode selection: full (<8KB code), map (8KB–96KB), signatures (>96KB). Syntax highlighting. Compression stats footer. Truncation handling. |
64
+ | `ls` | Not handled | Routes through `lean-ctx ls` with limit support |
65
+ | `find` | Not handled | Routes through `lean-ctx find` with glob + limit |
66
+ | `grep` | Not handled | Routes through `lean-ctx -c rg` with full ripgrep flags |
67
+ | `cat` blocking | Not enforced | Read tool description warns: "Do NOT use bash to read files (cat/head/tail)" |
68
+
69
+ ### MCP Bridge
70
+
71
+ - Auto-connects to lean-ctx MCP server (stdio transport)
72
+ - Registers all 48 lean-ctx MCP tools as native Pi tools
73
+ - Auto-reconnect (3 attempts, exponential backoff 2s/4s/8s)
74
+ - 120s tool timeout with retry for idempotent tools
75
+ - Tools excluded from bridge: `ctx_read`, `ctx_multi_read`, `ctx_shell`, `ctx_search`, `ctx_tree` (already handled via Pi-native tools)
76
+
77
+ ### Diagnostic Command
78
+
79
+ `/lean-ctx` — Shows binary path, MCP bridge status, registered tool count, reconnect attempts, last hung/errored tool.
80
+
81
+ ## Dependencies
82
+
83
+ - **Runtime**: `lean-ctx` binary (v3.4.2 installed via npm/cargo)
84
+ - **npm**: `pi-lean-ctx@3.4.5` with `@modelcontextprotocol/sdk@^1.29.0`
85
+ - **Peer**: `@mariozechner/pi-coding-agent@>=0.50.0` (we have 0.70.x)
86
+ - **Peer**: `@mariozechner/pi-tui@*` (available via pi-coding-agent)
87
+ - **TypeBox alias**: pi-agent's jiti loader aliases `@sinclair/typebox` → `typebox`
88
+
89
+ ## Consequences
90
+
91
+ ### Positive
92
+
93
+ - 48 lean-ctx MCP tools available to agent: `ctx_session`, `ctx_knowledge`, `ctx_semantic_search`, `ctx_impact`, `ctx_architecture`, `ctx_workflow`, `ctx_gain`, etc.
94
+ - Richer read modes: auto mode selection based on file size + extension
95
+ - Proper compression stats on every tool output
96
+ - Graceful reconnection if MCP server dies
97
+ - Upstream-maintained (by lean-ctx author yvgude)
98
+
99
+ ### Negative
100
+
101
+ - External npm dependency (mitigated: published by same author as lean-ctx, Apache 2.0)
102
+ - MCP bridge adds startup latency (~200ms for tool discovery)
103
+ - One more package to keep updated
104
+
105
+ ### Neutral
106
+
107
+ - `/lean-ctx-status` command removed; replaced by `/lean-ctx`
108
+ - Skill routing in SYSTEM.md changed from "default layer" to "native Pi package" description
109
+
110
+ ## Verification
111
+
112
+ - `lean-ctx` binary v3.4.2 installed ✓
113
+ - `pi-lean-ctx` v3.4.5 installed in `.pi/npm/node_modules` ✓
114
+ - All peer dependencies satisfied ✓
115
+ - `tsc` check on remaining extensions passes ✓
116
+ - @sinclair/typebox aliased by jiti loader ✓
117
+
118
+ ## Next
119
+
120
+ - Restart pi agent; pi-lean-ctx loads at session start
121
+ - Run `/lean-ctx` to verify MCP bridge connected
122
+ - Monitor `lean-ctx gain` after a few sessions for token savings data
@@ -0,0 +1,40 @@
1
+ ---
2
+ type: decision
3
+ title: "ADR-008: Spec-Only Black-Box QA"
4
+ status: active
5
+ priority: 1
6
+ date: "2026-04-28"
7
+ tags: [adr, qa, testing, harness, layer-4]
8
+ sources:
9
+ - "[[harness-implementation-plan]]"
10
+ related:
11
+ - "[[adversarial-verification]]"
12
+ - "[[agentic-harness]]"
13
+ created: 2026-04-30
14
+ updated: 2026-04-30
15
+ ---
16
+
17
+ # ADR-008: Spec-Only Black-Box QA
18
+
19
+ ## Context
20
+
21
+ Layer 4 (Adversarial Verification) needs to generate tests. Where should the test specifications come from — the implementation code or the specification?
22
+
23
+ ## Decision
24
+
25
+ Tests are generated from the **specification only** — never from implementation code. This is black-box testing enforced at the architectural level.
26
+
27
+ The prompt for the QA test writer **never includes implementation code**. The `spec_only` flag is immutable.
28
+
29
+ ## Rationale
30
+
31
+ - Implementation-aware tests can be gamed by the implementation itself
32
+ - Spec-only tests verify behavior, not implementation details
33
+ - Prevents the common failure mode where agents write tests that pass by construction
34
+
35
+ ## Consequences
36
+
37
+ - **Positive**: Tests are honest arbiters of correctness
38
+ - **Positive**: No temptation to "test the implementation" rather than the behavior
39
+ - **Negative**: May miss implementation-specific edge cases (mitigated by critic review in Layer 5)
40
+ - **Negative**: Requires well-specified success criteria (enforced by Layer 1 Spec Hardening)
@@ -0,0 +1,46 @@
1
+ ---
2
+ type: decision
3
+ title: "ADR-009: claude-obsidian Mode B for Persistent Memory"
4
+ status: active
5
+ priority: 1
6
+ date: "2026-04-28"
7
+ tags: [adr, memory, wiki, harness, layer-6, claude-obsidian]
8
+ sources:
9
+ - "[[harness-implementation-plan]]"
10
+ related:
11
+ - "[[persistent-memory]]"
12
+ - "[[wiki-query-interface]]"
13
+ - "[[agentic-harness]]"
14
+ created: 2026-04-30
15
+ updated: 2026-04-30
16
+ ---
17
+
18
+ # ADR-009: claude-obsidian Mode B for Persistent Memory
19
+
20
+ ## Context
21
+
22
+ Layer 6 (Persistent Memory) needs a knowledge base that persists across sessions, supports cross-referencing, and enables retrieval. Previous approach used a custom `WikiKnowledgeBase` class with Vectra BM25+vector search (~87MB deps).
23
+
24
+ ## Decision
25
+
26
+ Replace custom WikiKnowledgeBase + Vectra with **claude-obsidian skills in GitHub Mode B**. Search is LLM-native: `hot.md` → `index.md` → pages. No custom code, no embedding model.
27
+
28
+ ## Comparison
29
+
30
+ | Aspect | Before (ADR-007) | After (ADR-009) |
31
+ |--------|-------------------|------------------|
32
+ | Cross-session memory | None | hot.md ~500-word cache |
33
+ | Source provenance | No tracking | .raw/ immutable sources + manifest delta |
34
+ | Repository structure | Flat patterns/ dirs | Mode B: modules, components, decisions, dependencies, flows |
35
+ | Search | Vectra BM25+vector (~80MB model) | LLM-native: hot.md → index.md → pages |
36
+ | Lint / health | None | 8+ category checks |
37
+ | Contradiction flagging | None | `> [!contradiction]` callouts |
38
+ | Dependencies | ~87MB | ~50KB skills + optional ollama |
39
+
40
+ ## Consequences
41
+
42
+ - **Positive**: Eliminates ~87MB dependency footprint
43
+ - **Positive**: LLM-native search leverages existing Claude capabilities
44
+ - **Positive**: Obsidian wiki is human-readable and browseable
45
+ - **Negative**: Search quality depends on LLM context management (mitigated by 3-mode depth system)
46
+ - **Negative**: No semantic similarity search without optional ollama setup
@@ -0,0 +1,55 @@
1
+ ---
2
+ type: decision
3
+ title: "ADR-010: Agentic Harness ↔ Wiki Tight-Coupling Contract"
4
+ status: active
5
+ priority: 1
6
+ created: "2026-04-28"
7
+ updated: "2026-04-28"
8
+ tags: [decision, harness, wiki, integration, pipeline, adr]
9
+ sources:
10
+ - "[[harness]]"
11
+ - "[[harness-implementation-plan]]"
12
+ - "[[adr-009]]"
13
+ - "[[adr-008]]"
14
+ - "[[persistent-memory]]"
15
+ - "[[wiki-query-interface]]"
16
+ related:
17
+ - "[[colocate-wiki]]"
18
+ - "[[harness-wiki-skill-mapping]]"
19
+ - "[[harness-wiki-pipeline]]"
20
+ ---
21
+
22
+ # ADR-010: Agentic Harness ↔ Wiki Tight-Coupling Contract
23
+
24
+ ## Context
25
+
26
+ The harness has 8 layers. Layers 6 (Persistent Memory) and 8 (Wiki Query Interface) already reference the wiki. But the other 6 layers have **no explicit read/write contract** with the wiki. This creates two failure modes:
27
+
28
+ 1. **Design drift**: An agent makes a decision that contradicts an existing ADR or module spec because it never read the wiki first.
29
+ 2. **Wiki staleness**: After a pipeline event changes the codebase, the wiki is not updated — decisions, patterns, and statuses go stale.
30
+
31
+ [[adr-009]] replaced Vectra with LLM-native wiki search. [[colocate-wiki]] put the wiki in-repo. Now we need the **contract** that makes the harness and wiki a single synchronized system.
32
+
33
+ ## Decision
34
+
35
+ **Every harness layer reads relevant wiki docs before acting, and writes back to the wiki after every state transition.** The contract is enforced at the extension layer (L7 schema orchestration), not by convention.
36
+
37
+ Two axioms:
38
+ 1. **Read-first**: No layer acts without querying the wiki for relevant ADRs, module specs, and patterns.
39
+ 2. **Write-after**: No state transition completes without a wiki write that keeps docs current.
40
+
41
+ ## Rationale
42
+
43
+ - **Consistency**: If ADR-008 says "black-box QA", no layer should generate implementation-coupled tests. Reading the wiki first prevents this.
44
+ - **Traceability**: Every state transition produces a wiki artifact. Future sessions can reconstruct the full decision chain.
45
+ - **Staleness elimination**: The wiki is the single source of truth for design decisions. If code changes, the wiki reflects it. If the wiki says something, the code respects it.
46
+ - **Self-healing**: wiki-lint after every 10-15 writes catches contradictions, orphans, and stale claims before they compound.
47
+
48
+ ## Consequences
49
+
50
+ - **Positive**: Harness decisions are always grounded in documented architecture.
51
+ - **Positive**: Wiki stays current automatically — no manual doc updates needed.
52
+ - **Positive**: New sessions can pick up exactly where the last left off via hot.md.
53
+ - **Negative**: Extra token cost per subtask (~500-1500 for reads, ~500-1500 for writes).
54
+ - **Negative**: Requires discipline at the extension-layer hooks — must not skip wiki reads.
55
+ - **Negative**: Lint runs add latency but prevent long-term decay.
@@ -0,0 +1,165 @@
1
+ ---
2
+ type: decision
3
+ title: "ADR-011: Multi-Agent Consensus Debate in the Harness Pipeline"
4
+ status: accepted
5
+ priority: 1
6
+ date: "2026-04-30"
7
+ tags: [adr, harness, consensus, debate, multi-agent, pi-messenger, selective-routing, imad]
8
+ sources:
9
+ - "[[harness-implementation-plan]]"
10
+ - "[[pi-messenger-analysis]]"
11
+ - "[[fan2025-imad]]"
12
+ related:
13
+ - "[[agentic-harness]]"
14
+ - "[[adversarial-verification]]"
15
+ - "[[spec-hardening]]"
16
+ - "[[structured-planning]]"
17
+ - "[[consensus-debate]]"
18
+ - "[[selective-debate-routing]]"
19
+ - "[[drift-detection-unified]]"
20
+ supersedes:
21
+ created: 2026-04-30
22
+ updated: 2026-04-30
23
+ ---
24
+
25
+ # ADR-011: Multi-Agent Consensus Debate with Selective Routing
26
+
27
+ ## Context
28
+
29
+ The current harness pipeline is single-agent sequential: one agent hardens the spec (L1), one agent plans (L2), one agent executes (L3), one critic attacks once (L4). L4 has `max_attack_rounds: 2` — a retry loop, not a debate.
30
+
31
+ The best human software decisions come from back-and-forth argument: thesis → antithesis → synthesis. Single-pass review is weak because the reviewer's first objection is often shallow, and the proposer's rebuttal frequently reveals a deeper truth neither saw alone.
32
+
33
+ Agents lack intuition. Multi-round argument is a substitute for intuition — each round forces the opponent to find a new attack surface, and each rebuttal forces the defender to articulate deeper justification.
34
+
35
+ pi-messenger (nicobailon/pi-messenger, 532 ⭐) demonstrates that agents CAN communicate peer-to-peer via the file system — registry, inboxes, `fs.watch` for real-time delivery. No server, no daemon, just files. This is the right transport primitive for consensus debates.
36
+
37
+ **UPDATE (2026-04-30)**: iMAD (Fan et al., AAAI 2026) demonstrates that debate is NOT always beneficial. Multi-agent debate can overturn correct single-agent answers. Always-on debate wastes tokens AND can reduce accuracy. Selective routing via a pre-debate gating classifier saves 92% tokens AND improves accuracy by 13.5%.
38
+
39
+ ## Decision
40
+
41
+ **Add a consensus debate capability to the harness pipeline. Use pi-messenger's file-based message passing as the transport layer. Strip all UI overlays. Build a consensus protocol on top. Gate debate with iMAD-style selective routing — trigger debate only when a pre-debate classifier detects hesitation/uncertainty cues in single-agent self-critique.**
42
+
43
+ ### iMAD Integration: Pre-Debate Gate
44
+
45
+ Before spawning a debate, the system:
46
+
47
+ 1. Single agent produces structured self-critique response
48
+ 2. Extract hesitation cues: uncertainty markers ("might", "could be", "I think"), contradictory statements, missing evidence references, low confidence indicators
49
+ 3. Lightweight classifier → debate or skip
50
+ 4. If confidence high + no hesitation → skip debate, save tokens
51
+ 5. If uncertainty detected → trigger full consensus debate
52
+
53
+ Expected reduction: ~92% token savings on high-confidence tasks (~80% of tasks in early estimate).
54
+
55
+ ### What we adopt from pi-messenger:
56
+
57
+ | Component | Purpose |
58
+ |-----------|---------|
59
+ | Agent registry (`.pi/messenger/registry/`) | Agent discovery, presence |
60
+ | Per-agent inbox directories | Message delivery |
61
+ | `fs.watch`-based message detection | Real-time delivery without polling |
62
+ | JSON message format | Structured inter-agent communication |
63
+ | Atomic file write patterns | Race-free message delivery |
64
+ | Stale registration cleanup | Dead agent garbage collection |
65
+ | Memorable name generation | Debug-friendly agent identification |
66
+
67
+ ### What we strip (the "overlays"):
68
+
69
+ - Chat overlay UI (`/messenger`)
70
+ - Status bar indicators (●3, on fire, debugging...)
71
+ - Activity feed timeline
72
+ - Emoji-based status messages
73
+ - Human-as-participant features
74
+ - Crew orchestration (planner→worker→reviewer DAG) — L7 handles this
75
+ - Swarm claim/complete — L7 handles task tracking
76
+ - Message budgets (per-coordination-level) — consensus budget replaces this
77
+
78
+ ### Consensus Protocol:
79
+
80
+ A structured debate protocol with:
81
+
82
+ 1. **DebateSession**: N agents, M rounds, defined topic/scope
83
+ 2. **ConsensusBudget**: Max rounds, max tokens per round, max wall-clock time
84
+ 3. **Turn protocol**: Structured messages with `{ role, round, claim, counter_to, evidence_refs }`
85
+ 4. **Convergence detection**: When positions stabilize for K consecutive rounds
86
+ 5. **Verdict**: `CONSENSUS_REACHED`, `DEADLOCK` (positions unchanged after N rounds), `BUDGET_EXHAUSTED`
87
+
88
+ ### Integration points (selective — triggered only when pre-debate gate signals uncertainty):
89
+
90
+ | Layer | Debate purpose | Agents | Budget |
91
+ |-------|---------------|--------|--------|
92
+ | L1 (Spec Hardening) | Argue about ambiguity resolution | Spec proposer + Spec critic | 3 rounds, ~6K tokens |
93
+ | L2 (Structured Planning) | Argue about plan structure, dependencies | Planner + Plan critic | 3 rounds, ~10K tokens |
94
+ | L4 (Adversarial Verification) | Multi-round attack on implementation | Defender + Attacker | 4 rounds, ~8K tokens |
95
+
96
+ ## Rationale
97
+
98
+ ### Why file-based messaging (not MCP, not HTTP, not in-process)?
99
+
100
+ 1. **Zero infrastructure**: No server, no daemon, no port management. pi.dev extensions already have filesystem access.
101
+ 2. **Process isolation**: Each debate participant is a separate LLM session. Filesystem is the natural IPC boundary.
102
+ 3. **Crash safety**: Messages are files. If an agent crashes, its messages persist. Debate can resume.
103
+ 4. **Observability**: Debate transcripts are files on disk. Debuggable without tooling.
104
+ 5. **pi-messenger already solved this**: Registry format, inbox pattern, watcher debouncing, stale cleanup — all battle-tested.
105
+
106
+ ### Why selective routing (not always-on debate)?
107
+
108
+ iMAD shows that always-on debate:
109
+ - Costs 92% more tokens than selective routing
110
+ - Can overturn correct single-agent answers (accuracy regression)
111
+ - Is only beneficial when the single agent shows hesitation/uncertainty
112
+
113
+ Single agent self-critique is cheaper than full debate. Route to debate only when needed.
114
+
115
+ ### Why not use pi-messenger's Crew orchestration?
116
+
117
+ The harness has L7 (Schema Orchestration via Archon) for DAG execution, loop nodes, approval gates, and worktree isolation. pi-messenger's Crew (planner→worker→reviewer waves) is a competing orchestration model. Using both would create conflicting DAG executors.
118
+
119
+ ### Why consensus budgets?
120
+
121
+ Without budgets, debates consume unlimited tokens. A budget forces convergence — agents must prioritize their strongest arguments. This mirrors real human meetings with time limits.
122
+
123
+ ## Consequences
124
+
125
+ ### Positive
126
+ - **Better decisions when needed**: Multi-round argument surfaces deeper issues than single-pass review
127
+ - **Token-efficient**: Selective routing avoids debating settled questions
128
+ - **Defense in depth**: Adversarial verification becomes genuine debate when warranted
129
+ - **Spec quality**: L1 debates catch ambiguous specs before implementation
130
+ - **Permanent agent alignment**: Winning consensus filed to `wiki/consensus/` — future agents query and align to resolved debates, preventing re-litigation
131
+ - **Observable reasoning**: Debate transcripts are file artifacts that can be audited
132
+
133
+ ### Negative
134
+ - **Complexity**: New consensus protocol layer, pre-debate classifier, message schema, convergence detection
135
+ - **Classifier accuracy risk**: Pre-debate gate may miss cases where debate would help (false negatives)
136
+ - **Latency**: When debate IS triggered, multi-round adds wall-clock time
137
+ - **Agent quality variance**: Cheap models may produce shallow arguments
138
+
139
+ ### Mitigations
140
+ - Debate is opt-in per layer (configurable `consensus: { enabled: true/false }`)
141
+ - Pre-debate classifier is conservative: when uncertain, trigger debate
142
+ - Budgets prevent runaway token consumption
143
+ - **Winning consensus MUST be filed in wiki (`wiki/consensus/`)** as a permanent alignment record — NOT optional. Future agents query consensus before making decisions. Contradicting a filed consensus triggers harness block.
144
+ - Hard-threshold pass/fail criteria (not narrative self-assessment) as primary L4 mechanism; debate is supplementary
145
+
146
+ ## Token Budget Impact (with Selective Routing)
147
+
148
+ | Activity | Always-Debate | With Selective (80% skip rate) |
149
+ |----------|--------------|-------------------------------|
150
+ | L1 Spec Debate | +4,000 | +800 avg |
151
+ | L2 Plan Debate | +5,000 | +1,000 avg |
152
+ | L4 Adversarial Debate | +4,000 | +1,200 avg |
153
+ | **Total added per subtask** | **~13,000** | **~3,000 avg** |
154
+
155
+ ## Implementation
156
+
157
+ See [[harness-implementation-plan]] Phases P17-P19 and P2b.
158
+
159
+ ## Related
160
+
161
+ - [[consensus-debate]] — concept page for the consensus protocol
162
+ - [[selective-debate-routing]] — iMAD concept and mechanism
163
+ - [[pi-messenger-analysis]] — full analysis of pi-messenger and what we adopt/strip
164
+ - [[harness-implementation-plan]] — master plan with build phases
165
+ - [[drift-detection-unified]] — how consensus debate complements drift detection
@@ -0,0 +1,102 @@
1
+ ---
2
+ type: decision
3
+ title: "ADR-012: Extension-Based Harness Orchestrator — Leveraging Pi's Native Event System"
4
+ status: accepted
5
+ priority: 1
6
+ date: "2026-05-02"
7
+ updated: "2026-05-04"
8
+ tags: [adr, harness, integration, extensions, orchestrator, pi-extension-api]
9
+ sources:
10
+ - "[[HARNESS-PRD]]"
11
+ - "[[dotenv-loader]]"
12
+ - "[[custom-footer]]"
13
+ related:
14
+ - "[[adr-010]]"
15
+ - "[[adr-011]]"
16
+ - "[[adr-026-one-thing]]"
17
+ supersedes:
18
+ created: 2026-05-02
19
+ ---
20
+
21
+ # ADR-012: Extension-Based Harness Orchestrator — Leveraging Pi's Native Event System
22
+
23
+ **UPDATED 2026-05-04**: Original ADR incorrectly stated pi has only 5 native events. Pi v0.70.2 provides 30+ event types via `ExtensionAPI.on()`. The decision — extension-based, no fork — remains correct. Updated to reflect actual pi capabilities.
24
+
25
+ ## Context
26
+
27
+ The HARNESS-PRD specifies an 8-layer mandatory execution pipeline. The pi coding agent provides an `ExtensionAPI` with **30+ native event types**: `session_start`, `session_before_compact`, `session_compact`, `session_shutdown`, `before_agent_start`, `agent_start`, `agent_end`, `turn_start`, `turn_end`, `message_start`, `message_update`, `message_end`, `tool_execution_start`, `tool_execution_update`, `tool_execution_end`, `tool_call` (per-tool types: bash, read, edit, write, grep, find, ls, custom), `tool_result` (per-tool types), `context`, `before_provider_request`, `after_provider_response`, `model_select`, `input`, `user_bash`, `resources_discover`, and more.
28
+
29
+ Three integration paths were considered:
30
+ - **A) Fork pi to add hook points.** Maintenance burden. Blocks on upstream.
31
+ - **B) Wrap pi at process boundary.** Fragile, breaks on pi updates.
32
+ - **C) Build a harness orchestrator extension that listens to pi's native events and routes them through a skill pipeline.** Zero pi changes. Full control within extensions.
33
+
34
+ ## Decision
35
+
36
+ **Use an extension-based harness orchestrator. No fork. No process wrapping. No custom event bus needed.**
37
+
38
+ A single `harness-orchestrator` extension subscribes to pi's native events directly — no intermediate event bus layer. State machine tracks pipeline position (L1→L2→L3→L4→L5-L8). Phase transitions detected via tool result patterns and turn boundaries. Skills are activated via `pi.sendMessage()` with `deliverAs: "steer"` to inject steering prompts at the right pipeline phase.
39
+
40
+ ### Event-to-Pipeline Mapping
41
+
42
+ Pi's native events map directly to harness pipeline phases without translation:
43
+
44
+ | Pi Native Event | Harness Pipeline Action |
45
+ |---|---|
46
+ | `turn_start` | Initialize phase context. Inject L1 spec-hardening steer if entering L1. |
47
+ | `tool_call` | Track which tools the agent invokes. Detect phase transitions (e.g., write tool = entering L3 execution). |
48
+ | `tool_result` | Route to drift monitor during L3 execution. Detect gate conditions (compile failures, lint errors). |
49
+ | `turn_end` | Trigger L4 critic if in verification phase. Accumulate token budget. |
50
+ | `before_agent_start` | Inject harness state into system prompt. Reinject after compaction. |
51
+ | `agent_end` | Finalize pipeline. Trigger L5 observability + L6 memory writes. |
52
+ | `session_start` | Bootstrap harness state. Load config. Warm wiki cache. |
53
+ | `session_compact` | Persist harness state. Reinject after compaction completes. |
54
+ | `session_shutdown` | Flush observations. Write keep-rate samples. |
55
+
56
+ ### Enforcement Model — Updated
57
+
58
+ With `tool_call` events, the orchestrator gains new enforcement capabilities not possible with only 5 events:
59
+
60
+ - **Pre-execution tool blocking**: `tool_call` handlers can return `{ block: true, reason: "..." }` to prevent tool execution. This enables: blocking edits when spec isn't hardened, blocking writes when drift detected, blocking bash when sandbox isn't configured.
61
+ - **Result mutation**: `tool_result` handlers can modify content/details/isError. This enables: injecting warnings into results, marking results as errors based on drift detection, adding structural analysis annotations.
62
+ - **Context injection**: `before_agent_start` can replace the system prompt entirely. This enables: switching between "spec hardening mode" and "execution mode" and "verification mode" prompts.
63
+
64
+ Not 100% software-enforced for all layers, but `tool_call` blocking + `tool_result` mutation + `before_agent_start` prompt injection achieves high compliance. L7 orchestration (later phase) may add process-level enforcement via `pi.exec()`-based gate scripts.
65
+
66
+ ## Rationale
67
+
68
+ - **Zero pi dependency**: Works with pi v0.70.2 today. No upstream PRs, no fork maintenance.
69
+ - **All harness logic in one extension**: The orchestrator is a single `.pi/extensions/harness-orchestrator.ts`. No intermediate event bus layer.
70
+ - **Proven pattern**: `custom-footer.ts` already demonstrates using `turn_start`, `context`, `model_select`, and `session_start` events. The harness orchestrator is the same pattern, scaled.
71
+ - **Upgrade path**: If pi adds new native events, the orchestrator can subscribe to them without architectural changes.
72
+ - **Tool call blocking is new**: pi's `tool_call` event supports `{ block: true }` return — this is a hard enforcement mechanism not available in the original 5-event assumption.
73
+
74
+ ## Consequences
75
+
76
+ ### Positive
77
+ - Ships immediately. No external dependencies beyond pi.
78
+ - Harness is self-contained in `.pi/extensions/`.
79
+ - `tool_call` blocking provides hard enforcement for critical gates.
80
+ - ~150 lines, not ~290 (no intermediate event bus).
81
+
82
+ ### Negative
83
+ - Still ~95% compliance for skill-level steering (LLM can ignore steering prompts).
84
+ - Pattern detection in `tool_result` is heuristic, not guaranteed.
85
+ - `pi.sendMessage()` steering behavior unverified — need to test skill activation.
86
+
87
+ ### Mitigations
88
+ - `tool_call` blocking for critical safety gates (no edit without spec, no write with drift).
89
+ - Multiple defense layers (L1 hardening + L2.5 drift + L4 adversarial + P20 deterministic) mean a single-layer bypass is caught downstream.
90
+ - Compliance monitoring in L5 observability tracks bypass rates per layer.
91
+ - L7 orchestration (P23) adds process-level enforcement via `pi.exec()` gate scripts.
92
+
93
+ ## Correction from Original (2026-05-04)
94
+
95
+ | | Original ADR-012 | Corrected |
96
+ |---|---|---|
97
+ | Pi native events | "5 native events" | **30+ native events** |
98
+ | Architecture | Event bus layer on top of 5 events | **Orchestrator listens to 30+ events directly** |
99
+ | File | `harness-event-bus.ts` | **`harness-orchestrator.ts`** |
100
+ | Lines | ~200+ | **~100** (thinner — no bus layer) |
101
+ | Tool blocking | Not possible (assumed) | **Possible via `tool_call` event** |
102
+ | Pre-execution gates | Prompt-only | **Prompt OR `tool_call` blocking** |