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.
- package/.agents/skills/ck-search/SKILL.md +99 -0
- package/.agents/skills/defuddle/SKILL.md +90 -0
- package/.agents/skills/find-skills/SKILL.md +142 -0
- package/.agents/skills/firecrawl/SKILL.md +150 -0
- package/.agents/skills/firecrawl/rules/install.md +82 -0
- package/.agents/skills/firecrawl/rules/security.md +26 -0
- package/.agents/skills/firecrawl-agent/SKILL.md +57 -0
- package/.agents/skills/firecrawl-build-interact/SKILL.md +67 -0
- package/.agents/skills/firecrawl-build-onboarding/SKILL.md +102 -0
- package/.agents/skills/firecrawl-build-onboarding/references/auth-flow.md +39 -0
- package/.agents/skills/firecrawl-build-onboarding/references/project-setup.md +20 -0
- package/.agents/skills/firecrawl-build-onboarding/references/sdk-installation.md +17 -0
- package/.agents/skills/firecrawl-build-scrape/SKILL.md +68 -0
- package/.agents/skills/firecrawl-build-search/SKILL.md +68 -0
- package/.agents/skills/firecrawl-crawl/SKILL.md +58 -0
- package/.agents/skills/firecrawl-download/SKILL.md +69 -0
- package/.agents/skills/firecrawl-interact/SKILL.md +83 -0
- package/.agents/skills/firecrawl-map/SKILL.md +50 -0
- package/.agents/skills/firecrawl-parse/SKILL.md +61 -0
- package/.agents/skills/firecrawl-scrape/SKILL.md +68 -0
- package/.agents/skills/firecrawl-search/SKILL.md +59 -0
- package/.agents/skills/obsidian-bases/SKILL.md +299 -0
- package/.agents/skills/obsidian-markdown/SKILL.md +237 -0
- package/.agents/skills/posthog-analyst/SKILL.md +306 -0
- package/.agents/skills/posthog-analyst/evals/evals.json +23 -0
- package/.agents/skills/wiki/SKILL.md +215 -0
- package/.agents/skills/wiki/references/css-snippets.md +122 -0
- package/.agents/skills/wiki/references/frontmatter.md +107 -0
- package/.agents/skills/wiki/references/git-setup.md +58 -0
- package/.agents/skills/wiki/references/mcp-setup.md +149 -0
- package/.agents/skills/wiki/references/modes.md +259 -0
- package/.agents/skills/wiki/references/plugins.md +96 -0
- package/.agents/skills/wiki/references/rest-api.md +124 -0
- package/.agents/skills/wiki-autoresearch/SKILL.md +211 -0
- package/.agents/skills/wiki-autoresearch/references/program.md +75 -0
- package/.agents/skills/wiki-fold/SKILL.md +204 -0
- package/.agents/skills/wiki-fold/references/fold-template.md +133 -0
- package/.agents/skills/wiki-ingest/SKILL.md +288 -0
- package/.agents/skills/wiki-lint/SKILL.md +183 -0
- package/.agents/skills/wiki-query/SKILL.md +176 -0
- package/.agents/skills/wiki-save/SKILL.md +128 -0
- package/.ckignore +41 -0
- package/.env.example +9 -0
- package/.github/workflows/lint.yml +33 -0
- package/.github/workflows/publish-github-packages.yml +35 -0
- package/.github/workflows/publish-npm.yml +1 -1
- package/.pi/SYSTEM.md +107 -40
- package/.pi/agents/pi-pi/agent-expert.md +205 -0
- package/.pi/agents/pi-pi/cli-expert.md +47 -0
- package/.pi/agents/pi-pi/config-expert.md +67 -0
- package/.pi/agents/pi-pi/ext-expert.md +53 -0
- package/.pi/agents/pi-pi/keybinding-expert.md +123 -0
- package/.pi/agents/pi-pi/pi-orchestrator.md +103 -0
- package/.pi/agents/pi-pi/prompt-expert.md +83 -0
- package/.pi/agents/pi-pi/skill-expert.md +52 -0
- package/.pi/agents/pi-pi/theme-expert.md +46 -0
- package/.pi/agents/pi-pi/tui-expert.md +100 -0
- package/.pi/agents/rethink.md +140 -0
- package/.pi/agents/wiki-ingest.md +67 -0
- package/.pi/agents/wiki-lint.md +75 -0
- package/.pi/auto-commit.json +20 -0
- package/.pi/extensions/banner.png +0 -0
- package/.pi/extensions/ck-enforce.ts +216 -0
- package/.pi/extensions/custom-footer.ts +308 -0
- package/.pi/extensions/custom-header.ts +116 -0
- package/.pi/extensions/dotenv-loader.ts +170 -0
- package/.pi/internal/cursor-sdk-transcript-parser.ts +59 -0
- package/.pi/model-router.json +95 -0
- package/.pi/npm/.gitignore +2 -0
- package/.pi/prompts/git-sync.md +124 -0
- package/.pi/prompts/harness-setup.md +509 -0
- package/.pi/prompts/save.md +16 -0
- package/.pi/prompts/wiki-autoresearch.md +19 -0
- package/.pi/prompts/wiki.md +23 -0
- package/.pi/providers/cursor-sdk-provider.test.mjs +476 -0
- package/.pi/providers/cursor-sdk-provider.ts +1085 -0
- package/.pi/settings.json +14 -4
- package/.pi/skills/agent-router/SKILL.md +174 -0
- package/.pi/sounds/alert/1-kaching-track.mp3 +0 -0
- package/.pi/sounds/error/1-ksi-wth-track.mp3 +0 -0
- package/.pi/sounds/error/2-smash-track.mp3 +0 -0
- package/.pi/sounds/error/3-buzzer-track.mp3 +0 -0
- package/.pi/sounds/notification/1-soft-notification-track.mp3 +0 -0
- package/.pi/sounds/project-sounds.json +25 -0
- package/.pi/sounds/reminder/1-soft-notification-track.mp3 +0 -0
- package/.pi/sounds/success/1-tada-track.mp3 +0 -0
- package/.pi/sounds/success/2-jobs-done-track.mp3 +0 -0
- package/.pi/sounds/success/3-yay-track.mp3 +0 -0
- package/CONTRIBUTING.md +116 -0
- package/README.md +32 -39
- package/biome.json +34 -0
- package/firecrawl/.env.template +58 -0
- package/firecrawl/README.md +49 -0
- package/firecrawl/docker-compose.yaml +201 -0
- package/firecrawl/searxng/searxng.env +3 -0
- package/firecrawl/searxng/settings.yml +85 -0
- package/lefthook.yml +8 -0
- package/package.json +55 -24
- package/vault/AGENTS.md +37 -0
- package/vault/wiki/_templates/comparison.md +39 -0
- package/vault/wiki/_templates/concept.md +40 -0
- package/vault/wiki/_templates/decision.md +21 -0
- package/vault/wiki/_templates/entity.md +32 -0
- package/vault/wiki/_templates/flow.md +14 -0
- package/vault/wiki/_templates/module.md +18 -0
- package/vault/wiki/_templates/question.md +31 -0
- package/vault/wiki/_templates/source.md +39 -0
- package/vault/wiki/concepts/AST-Aware Code Chunking.md +44 -0
- package/vault/wiki/concepts/Build-Time Prompt Compilation.md +107 -0
- package/vault/wiki/concepts/Context Engine (AI Coding).md +47 -0
- package/vault/wiki/concepts/Context-Aware System Reminders.md +61 -0
- package/vault/wiki/concepts/Contextualized Text Embedding.md +42 -0
- package/vault/wiki/concepts/Contractor vs Employee AI Model.md +55 -0
- package/vault/wiki/concepts/Dual-Model Agent Architecture.md +65 -0
- package/vault/wiki/concepts/Late Chunking vs Early Chunking.md +43 -0
- package/vault/wiki/concepts/Majority Vote Ensembling.md +68 -0
- package/vault/wiki/concepts/Meta-Harness.md +16 -0
- package/vault/wiki/concepts/Multi-Agent AI Coding Architecture.md +75 -0
- package/vault/wiki/concepts/Prompt Enhancement.md +90 -0
- package/vault/wiki/concepts/Prompt Renderer.md +89 -0
- package/vault/wiki/concepts/Semantic Codebase Indexing.md +67 -0
- package/vault/wiki/concepts/additive-config-hierarchy.md +16 -0
- package/vault/wiki/concepts/agent-artifacts-verifiable-deliverables.md +71 -0
- package/vault/wiki/concepts/agent-browser-browser-automation.md +99 -0
- package/vault/wiki/concepts/agent-codebase-interface.md +43 -0
- package/vault/wiki/concepts/agent-harness-architecture.md +67 -0
- package/vault/wiki/concepts/agent-loop-detection-patterns.md +133 -0
- package/vault/wiki/concepts/agent-search-enforcement.md +126 -0
- package/vault/wiki/concepts/agent-skills-ecosystem.md +74 -0
- package/vault/wiki/concepts/agent-skills-pattern.md +68 -0
- package/vault/wiki/concepts/agentic-harness-context-enforcement.md +91 -0
- package/vault/wiki/concepts/agentic-harness.md +34 -0
- package/vault/wiki/concepts/agentic-orchestration-pipeline.md +56 -0
- package/vault/wiki/concepts/agentic-search-no-embeddings.md +18 -0
- package/vault/wiki/concepts/anthropic-context-engineering.md +13 -0
- package/vault/wiki/concepts/antigravity-agent-first-architecture.md +61 -0
- package/vault/wiki/concepts/ast-compression.md +19 -0
- package/vault/wiki/concepts/ast-truncation.md +66 -0
- package/vault/wiki/concepts/barrel-files.md +37 -0
- package/vault/wiki/concepts/browser-harness-agent.md +41 -0
- package/vault/wiki/concepts/browser-subagent-visual-verification.md +82 -0
- package/vault/wiki/concepts/codebase-intelligence-ecosystem-comparison.md +192 -0
- package/vault/wiki/concepts/codebase-intelligence-harness-integration.md +161 -0
- package/vault/wiki/concepts/codebase-to-context-ingestion.md +46 -0
- package/vault/wiki/concepts/codex-harness-innovations.md +147 -0
- package/vault/wiki/concepts/consensus-debate-flow.md +17 -0
- package/vault/wiki/concepts/consensus-debate.md +206 -0
- package/vault/wiki/concepts/content-addressed-spec-identity.md +166 -0
- package/vault/wiki/concepts/context-anxiety.md +57 -0
- package/vault/wiki/concepts/context-compression-techniques.md +19 -0
- package/vault/wiki/concepts/context-continuity.md +22 -0
- package/vault/wiki/concepts/context-drift-in-agents.md +106 -0
- package/vault/wiki/concepts/context-engineering.md +62 -0
- package/vault/wiki/concepts/context-folding.md +67 -0
- package/vault/wiki/concepts/context-mode.md +38 -0
- package/vault/wiki/concepts/cursor-harness-innovations.md +107 -0
- package/vault/wiki/concepts/deterministic-session-compaction.md +79 -0
- package/vault/wiki/concepts/drift-detection-unified.md +296 -0
- package/vault/wiki/concepts/execution-feedback-loop.md +46 -0
- package/vault/wiki/concepts/feedforward-feedback-harness.md +60 -0
- package/vault/wiki/concepts/five-root-cause-metrics-sentrux.md +40 -0
- package/vault/wiki/concepts/fork-safe-spec-storage.md +89 -0
- package/vault/wiki/concepts/fts5-sandbox.md +19 -0
- package/vault/wiki/concepts/fuzzy-edit-matching.md +71 -0
- package/vault/wiki/concepts/gemini-cli-architecture.md +104 -0
- package/vault/wiki/concepts/generator-evaluator-architecture.md +64 -0
- package/vault/wiki/concepts/guardian-agent-pattern.md +67 -0
- package/vault/wiki/concepts/harness-configuration-layers.md +89 -0
- package/vault/wiki/concepts/harness-control-frameworks.md +155 -0
- package/vault/wiki/concepts/harness-engineering-first-principles.md +90 -0
- package/vault/wiki/concepts/harness-h-formalism.md +53 -0
- package/vault/wiki/concepts/hybrid-code-search.md +61 -0
- package/vault/wiki/concepts/inline-post-edit-validation.md +112 -0
- package/vault/wiki/concepts/legendary-engineering-patterns-harness.md +110 -0
- package/vault/wiki/concepts/lifecycle-hooks.md +94 -0
- package/vault/wiki/concepts/mcp-tool-routing.md +102 -0
- package/vault/wiki/concepts/memory-system-of-record-vs-ephemeral-cache.md +47 -0
- package/vault/wiki/concepts/meta-agent-context-pruning.md +151 -0
- package/vault/wiki/concepts/model-adaptive-harness.md +122 -0
- package/vault/wiki/concepts/model-routing-agents.md +101 -0
- package/vault/wiki/concepts/monorepo-architecture.md +45 -0
- package/vault/wiki/concepts/multi-agent-specialization.md +61 -0
- package/vault/wiki/concepts/permission-subsystem.md +16 -0
- package/vault/wiki/concepts/pi-messenger-analysis.md +243 -0
- package/vault/wiki/concepts/pi-vscode-extension-landscape.md +37 -0
- package/vault/wiki/concepts/policy-engine-pattern.md +78 -0
- package/vault/wiki/concepts/progressive-disclosure-agents.md +53 -0
- package/vault/wiki/concepts/progressive-skill-disclosure.md +17 -0
- package/vault/wiki/concepts/provider-native-prompting.md +203 -0
- package/vault/wiki/concepts/quality-signal-sentrux.md +37 -0
- package/vault/wiki/concepts/repo-map-ranking.md +42 -0
- package/vault/wiki/concepts/result-monad-error-handling.md +47 -0
- package/vault/wiki/concepts/safety-defense-in-depth.md +83 -0
- package/vault/wiki/concepts/sandbox-os-enforcement.md +18 -0
- package/vault/wiki/concepts/selective-debate-routing.md +70 -0
- package/vault/wiki/concepts/self-evolving-harness.md +60 -0
- package/vault/wiki/concepts/sentrux-mcp-integration.md +36 -0
- package/vault/wiki/concepts/sentrux-rules-engine.md +49 -0
- package/vault/wiki/concepts/shell-pattern-compression.md +24 -0
- package/vault/wiki/concepts/skill-first-architecture.md +166 -0
- package/vault/wiki/concepts/structured-compaction.md +78 -0
- package/vault/wiki/concepts/subagent-orchestration.md +17 -0
- package/vault/wiki/concepts/subagent-worktree-isolation.md +68 -0
- package/vault/wiki/concepts/superpowers-methodology.md +78 -0
- package/vault/wiki/concepts/think-in-code.md +73 -0
- package/vault/wiki/concepts/ts-execution-layer.md +100 -0
- package/vault/wiki/concepts/typescript-strict-mode.md +37 -0
- package/vault/wiki/concepts/vcc-conversation-compaction-for-pi.md +51 -0
- package/vault/wiki/concepts/verification-drift-detection.md +19 -0
- package/vault/wiki/consensus/consensus-records.md +58 -0
- package/vault/wiki/decisions/2026-04-30-pi-lean-ctx-native.md +122 -0
- package/vault/wiki/decisions/adr-008.md +40 -0
- package/vault/wiki/decisions/adr-009.md +46 -0
- package/vault/wiki/decisions/adr-010.md +55 -0
- package/vault/wiki/decisions/adr-011.md +165 -0
- package/vault/wiki/decisions/adr-012.md +102 -0
- package/vault/wiki/decisions/adr-013.md +59 -0
- package/vault/wiki/decisions/adr-014.md +73 -0
- package/vault/wiki/decisions/adr-015.md +81 -0
- package/vault/wiki/decisions/adr-016.md +91 -0
- package/vault/wiki/decisions/adr-017.md +79 -0
- package/vault/wiki/decisions/adr-018.md +100 -0
- package/vault/wiki/decisions/adr-019.md +75 -0
- package/vault/wiki/decisions/adr-020.md +106 -0
- package/vault/wiki/decisions/adr-021.md +86 -0
- package/vault/wiki/decisions/adr-022.md +113 -0
- package/vault/wiki/decisions/adr-023.md +113 -0
- package/vault/wiki/decisions/adr-024.md +73 -0
- package/vault/wiki/decisions/adr-025.md +130 -0
- package/vault/wiki/decisions/adr-026.md +56 -0
- package/vault/wiki/decisions/colocate-wiki.md +34 -0
- package/vault/wiki/entities/Anders Hejlsberg.md +29 -0
- package/vault/wiki/entities/Anthropic.md +17 -0
- package/vault/wiki/entities/Augment Code.md +49 -0
- package/vault/wiki/entities/Bjarne Stroustrup.md +26 -0
- package/vault/wiki/entities/Bolt.new (StackBlitz).md +39 -0
- package/vault/wiki/entities/Boris Cherny.md +11 -0
- package/vault/wiki/entities/Claude Code.md +19 -0
- package/vault/wiki/entities/Dennis Ritchie.md +26 -0
- package/vault/wiki/entities/Emergent Labs.md +32 -0
- package/vault/wiki/entities/Google Cloud.md +16 -0
- package/vault/wiki/entities/Guido van Rossum.md +28 -0
- package/vault/wiki/entities/Ken Thompson.md +28 -0
- package/vault/wiki/entities/Lee et al.md +16 -0
- package/vault/wiki/entities/Linus Torvalds.md +28 -0
- package/vault/wiki/entities/Lovable (company).md +40 -0
- package/vault/wiki/entities/Martin Fowler.md +16 -0
- package/vault/wiki/entities/Meng et al.md +16 -0
- package/vault/wiki/entities/OpenAI.md +16 -0
- package/vault/wiki/entities/Rocket.new.md +38 -0
- package/vault/wiki/entities/VILA-Lab.md +15 -0
- package/vault/wiki/entities/autodev-codebase.md +18 -0
- package/vault/wiki/entities/ck-tool.md +59 -0
- package/vault/wiki/entities/codesearch.md +18 -0
- package/vault/wiki/entities/disler-indydevdan.md +33 -0
- package/vault/wiki/entities/gsd-get-shit-done.md +56 -0
- package/vault/wiki/entities/javascript-runtimes.md +48 -0
- package/vault/wiki/entities/jesse-vincent.md +38 -0
- package/vault/wiki/entities/lean-ctx.md +32 -0
- package/vault/wiki/entities/opendev.md +41 -0
- package/vault/wiki/entities/ops-codegraph-tool.md +18 -0
- package/vault/wiki/entities/pi-coding-agent.md +53 -0
- package/vault/wiki/entities/sentrux.md +54 -0
- package/vault/wiki/entities/vgrep-tool.md +57 -0
- package/vault/wiki/entities/vitest.md +41 -0
- package/vault/wiki/flows/harness-wiki-pipeline.md +204 -0
- package/vault/wiki/hot.md +932 -0
- package/vault/wiki/index.md +437 -0
- package/vault/wiki/log.md +418 -0
- package/vault/wiki/meta/dashboard.md +30 -0
- package/vault/wiki/meta/lint-report-2026-04-30.md +86 -0
- package/vault/wiki/meta/lint-report-2026-05-02.md +251 -0
- package/vault/wiki/meta/overview.canvas +43 -0
- package/vault/wiki/modules/adversarial-verification.md +57 -0
- package/vault/wiki/modules/automated-observability.md +54 -0
- package/vault/wiki/modules/bench.md +20 -0
- package/vault/wiki/modules/extensions.md +23 -0
- package/vault/wiki/modules/grounding-checkpoints.md +62 -0
- package/vault/wiki/modules/harness-implementation-plan.md +345 -0
- package/vault/wiki/modules/harness-wiki-skill-mapping.md +135 -0
- package/vault/wiki/modules/harness.md +86 -0
- package/vault/wiki/modules/persistent-memory.md +85 -0
- package/vault/wiki/modules/schema-orchestration.md +68 -0
- package/vault/wiki/modules/skills.md +27 -0
- package/vault/wiki/modules/spec-hardening.md +58 -0
- package/vault/wiki/modules/structured-planning.md +53 -0
- package/vault/wiki/modules/think-in-code-enforcement.md +153 -0
- package/vault/wiki/modules/wiki-query-interface.md +64 -0
- package/vault/wiki/overview.md +51 -0
- package/vault/wiki/questions/Research-pi-vs-claude-code-agentic-orchestration-pipeline.md +87 -0
- package/vault/wiki/questions/Research-sentrux-dev.md +123 -0
- package/vault/wiki/questions/Research-superpowers-skill-for-agentic-coding-agents.md +164 -0
- package/vault/wiki/questions/Research: Augment Code Context Engine.md +244 -0
- package/vault/wiki/questions/Research: Automating Software Engineering - Lovable, Bolt, Emergent, Rocket.md +112 -0
- package/vault/wiki/questions/Research: Claude Code State-of-the-Art Harness Improvements.md +209 -0
- package/vault/wiki/questions/Research: Codex State-of-the-Art Harness Improvements.md +99 -0
- package/vault/wiki/questions/Research: Engineering Workflows of Legendary Programmers and AI Harness Mapping.md +107 -0
- package/vault/wiki/questions/Research: Fallow Codebase Intelligence Harness Integration.md +72 -0
- package/vault/wiki/questions/Research: Gemini CLI SOTA Harness Integration.md +166 -0
- package/vault/wiki/questions/Research: GitHub Issues as Harness Spec Storage.md +188 -0
- package/vault/wiki/questions/Research: Google Antigravity Harness Integration.md +120 -0
- package/vault/wiki/questions/Research: Meta-Agent Context Drift Detection.md +236 -0
- package/vault/wiki/questions/Research: Model-Adaptive Agent Harness Design.md +95 -0
- package/vault/wiki/questions/Research: Model-Specific Prompting Guides.md +165 -0
- package/vault/wiki/questions/Research: Prompt Renderer for Multi-Model Agent Harness.md +216 -0
- package/vault/wiki/questions/Research: Skill-First Harness Architecture.md +91 -0
- package/vault/wiki/questions/Research: TypeScript Best Practices and Codebase Structure.md +88 -0
- package/vault/wiki/questions/Research: TypeScript Execution Layer for Agent Tool Calling.md +81 -0
- package/vault/wiki/questions/Research: claude-mem over Obsidian for Harness Layer.md +71 -0
- 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
- package/vault/wiki/questions/Research: context-mode vs lean-ctx.md +72 -0
- package/vault/wiki/questions/Research: cursor.sh Harness Innovations.md +92 -0
- package/vault/wiki/questions/Research: executor.sh Harness Integration.md +170 -0
- package/vault/wiki/questions/Research: how GSD fits into our coding harness setup.md +97 -0
- 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
- package/vault/wiki/questions/Research: pi-vcc.md +113 -0
- package/vault/wiki/questions/Research: semantic code search tools.md +69 -0
- package/vault/wiki/questions/Research: vcc extension for pi coding agent.md +73 -0
- package/vault/wiki/questions/how-to-enable-semantic-code-search-now.md +111 -0
- package/vault/wiki/questions/mvp-implementation-blueprint.md +552 -0
- package/vault/wiki/questions/research-agent-first-codebase-exploration.md +199 -0
- package/vault/wiki/questions/research-agentic-coding-harness-latest-papers.md +142 -0
- package/vault/wiki/questions/research-gitingest-gitreverse-integration.md +100 -0
- package/vault/wiki/questions/research-wozcode-token-reduction.md +67 -0
- package/vault/wiki/questions/resolved-context-pruning-inplace-vs-restart.md +95 -0
- package/vault/wiki/questions/resolved-context-window-economics.md +167 -0
- package/vault/wiki/questions/resolved-imad-debate-gating-transfer.md +126 -0
- package/vault/wiki/questions/resolved-mcp-tool-preference.md +112 -0
- package/vault/wiki/questions/resolved-small-model-meta-agents.md +107 -0
- package/vault/wiki/questions/resolved-treesitter-dynamic-languages.md +95 -0
- package/vault/wiki/sources/Auggie Context MCP Server.md +63 -0
- package/vault/wiki/sources/Augment Code Codacy AI Giants.md +61 -0
- package/vault/wiki/sources/Augment Code MCP SiliconAngle.md +49 -0
- package/vault/wiki/sources/Augment Code WorkOS ERC 2025.md +55 -0
- package/vault/wiki/sources/Augment Context Engine Official.md +71 -0
- package/vault/wiki/sources/Augment SWE-bench Agent GitHub.md +74 -0
- package/vault/wiki/sources/Augment SWE-bench Pro Blog.md +58 -0
- package/vault/wiki/sources/Source: AgentBus Jinja2 Prompt Pipelines.md +75 -0
- package/vault/wiki/sources/Source: Arxiv /342/200/224 Don't Break the Cache.md" +85 -0
- package/vault/wiki/sources/Source: Augment - Harness Engineering for AI Coding Agents.md +58 -0
- package/vault/wiki/sources/Source: Blake Crosley Agent Architecture Guide.md +100 -0
- package/vault/wiki/sources/Source: Bolt.new Architecture & Case Study.md +75 -0
- package/vault/wiki/sources/Source: Build-Time Prompt Compilation Architecture.md +107 -0
- package/vault/wiki/sources/Source: Claude API Agent Skills Overview.md +70 -0
- package/vault/wiki/sources/Source: Gemini CLI Changelogs.md +88 -0
- package/vault/wiki/sources/Source: Google Blog - Gemini CLI Announcement.md +57 -0
- package/vault/wiki/sources/Source: Google Gemini CLI Architecture Docs.md +53 -0
- package/vault/wiki/sources/Source: LangChain - Anatomy of Agent Harness.md +65 -0
- package/vault/wiki/sources/Source: Lovable Architecture & Clone Analysis.md +83 -0
- package/vault/wiki/sources/Source: Martin Fowler - Harness Engineering.md +70 -0
- package/vault/wiki/sources/Source: OpenAI Harness Engineering Five Principles.md +58 -0
- package/vault/wiki/sources/Source: OpenAI Harness Engineering /342/200/224 0 Lines of Human Code.md" +101 -0
- package/vault/wiki/sources/Source: OpenDev /342/200/224 Building AI Coding Agents for the Terminal.md" +100 -0
- package/vault/wiki/sources/Source: Render AI Coding Agents Benchmark 2025.md +53 -0
- package/vault/wiki/sources/Source: Rocket.new /342/200/224 Vibe Solutioning Platform.md" +70 -0
- package/vault/wiki/sources/Source: SwirlAI Agent Skills Progressive Disclosure.md +71 -0
- package/vault/wiki/sources/Source: TianPan Prompt Caching Architecture.md +89 -0
- package/vault/wiki/sources/Source: Vercel Labs agent-browser.md +155 -0
- package/vault/wiki/sources/Source: browser-harness CDP Harness.md +126 -0
- package/vault/wiki/sources/agent-drift-academic-paper.md +79 -0
- package/vault/wiki/sources/aider-repomap-tree-sitter.md +42 -0
- package/vault/wiki/sources/anthropic-compaction-api.md +58 -0
- package/vault/wiki/sources/anthropic-effective-harnesses.md +42 -0
- package/vault/wiki/sources/anthropic-prompt-best-practices.md +100 -0
- package/vault/wiki/sources/anthropic2026-harness-design.md +63 -0
- package/vault/wiki/sources/barrel-files-tkdodo.md +38 -0
- package/vault/wiki/sources/birth-of-unix-kernighan-interview.md +57 -0
- package/vault/wiki/sources/bockeler2026-harness-engineering.md +69 -0
- package/vault/wiki/sources/cast-code-chunking-paper.md +50 -0
- package/vault/wiki/sources/ck-semantic-search.md +78 -0
- package/vault/wiki/sources/claude-code-architecture-karaxai-2026.md +71 -0
- package/vault/wiki/sources/claude-code-architecture-qubytes-2026.md +50 -0
- package/vault/wiki/sources/claude-code-architecture-vila-lab-2026.md +64 -0
- package/vault/wiki/sources/claude-code-security-architecture-penligent-2026.md +70 -0
- package/vault/wiki/sources/claude-context-editing-docs.md +13 -0
- package/vault/wiki/sources/cloudflare-codemode.md +63 -0
- package/vault/wiki/sources/code-chunk-library-supermemory.md +63 -0
- package/vault/wiki/sources/codeact-apple-2024.md +62 -0
- package/vault/wiki/sources/codex-dsc-rfc-8573.md +41 -0
- package/vault/wiki/sources/codex-open-source-agent-2026.md +110 -0
- package/vault/wiki/sources/coir-code-retrieval-benchmark.md +51 -0
- package/vault/wiki/sources/colinmcnamara-context-optimization-codemode.md +48 -0
- package/vault/wiki/sources/context-folding-paper.md +61 -0
- package/vault/wiki/sources/context-mode-website.md +63 -0
- package/vault/wiki/sources/cursor-agent-best-practices-2026.md +62 -0
- package/vault/wiki/sources/cursor-fork-29b-2025.md +50 -0
- package/vault/wiki/sources/cursor-harness-april-2026.md +76 -0
- package/vault/wiki/sources/cursor-instant-apply-2024.md +45 -0
- package/vault/wiki/sources/cursor-shadow-workspace-2024.md +52 -0
- package/vault/wiki/sources/cursor-shipped-coding-agent-2026.md +53 -0
- package/vault/wiki/sources/cursor-vs-antigravity-2026.md +51 -0
- package/vault/wiki/sources/disler-pi-vs-claude-code.md +69 -0
- package/vault/wiki/sources/distill-deterministic-context-compression.md +53 -0
- package/vault/wiki/sources/embedding-models-benchmark-supermemory-2025.md +48 -0
- package/vault/wiki/sources/executor-rhyssullivan.md +122 -0
- package/vault/wiki/sources/fallow-rs-codebase-intelligence.md +125 -0
- package/vault/wiki/sources/fan2025-imad.md +60 -0
- package/vault/wiki/sources/forgecode-gpt5-agent-improvements.md +63 -0
- package/vault/wiki/sources/gemini-3-prompting-guide.md +78 -0
- package/vault/wiki/sources/gh-cli-sub-issue-rfc.md +50 -0
- package/vault/wiki/sources/gh-sub-issue-extension.md +72 -0
- package/vault/wiki/sources/github-fork-issues-discussion.md +44 -0
- package/vault/wiki/sources/github-issue-dependencies-docs.md +49 -0
- package/vault/wiki/sources/github-sub-issues-docs.md +51 -0
- package/vault/wiki/sources/gitingest.md +91 -0
- package/vault/wiki/sources/gitreverse.md +63 -0
- package/vault/wiki/sources/google-antigravity-official-blog.md +47 -0
- package/vault/wiki/sources/google-antigravity-wikipedia.md +53 -0
- package/vault/wiki/sources/gsd-codecentric-deep-dive.md +57 -0
- package/vault/wiki/sources/gsd-github-repo.md +51 -0
- package/vault/wiki/sources/gsd-hn-discussion.md +59 -0
- package/vault/wiki/sources/guido-python-design-philosophy.md +56 -0
- package/vault/wiki/sources/hejlsberg-7-learnings.md +48 -0
- package/vault/wiki/sources/ironclaw-drift-monitor.md +80 -0
- package/vault/wiki/sources/langsight-loop-detection.md +80 -0
- package/vault/wiki/sources/leanctx-website.md +69 -0
- package/vault/wiki/sources/lee2026-meta-harness.md +59 -0
- package/vault/wiki/sources/linux-kernel-coding-workflow.md +50 -0
- package/vault/wiki/sources/lou2026-autoharness.md +53 -0
- package/vault/wiki/sources/martin-fowler-harness-engineering.md +73 -0
- package/vault/wiki/sources/mcp-architecture-docs.md +13 -0
- package/vault/wiki/sources/meng2026-agent-harness-survey.md +79 -0
- package/vault/wiki/sources/mindstudio-four-agent-types.md +68 -0
- package/vault/wiki/sources/ms-chat-history-management.md +13 -0
- package/vault/wiki/sources/openai-prompt-guidance.md +104 -0
- package/vault/wiki/sources/openclaw-session-pruning.md +13 -0
- package/vault/wiki/sources/opencode-dcp.md +13 -0
- package/vault/wiki/sources/opendev-arxiv-2603.05344v1.md +79 -0
- package/vault/wiki/sources/openhands-platform.md +39 -0
- package/vault/wiki/sources/oss-guide-codebase-exploration.md +53 -0
- package/vault/wiki/sources/pi-compaction-extensions-ecosystem.md +102 -0
- package/vault/wiki/sources/pi-context-prune-github-repo.md +38 -0
- package/vault/wiki/sources/pi-mono-compaction-docs.md +38 -0
- package/vault/wiki/sources/pi-omni-compact-github-repo.md +50 -0
- package/vault/wiki/sources/pi-rtk-optimizer-github-repo.md +45 -0
- package/vault/wiki/sources/pi-vcc-github-repo.md +69 -0
- package/vault/wiki/sources/pi-vscode-marketplace.md +41 -0
- package/vault/wiki/sources/pi-vscode-model-provider-marketplace.md +39 -0
- package/vault/wiki/sources/py-tree-sitter.md +13 -0
- package/vault/wiki/sources/sentrux-dev-landing.md +40 -0
- package/vault/wiki/sources/sentrux-docs-pro-architecture.md +75 -0
- package/vault/wiki/sources/sentrux-docs-quality-signal.md +46 -0
- package/vault/wiki/sources/sentrux-docs-root-cause-metrics.md +57 -0
- package/vault/wiki/sources/sentrux-docs-rules-engine.md +58 -0
- package/vault/wiki/sources/sentrux-github-repo.md +56 -0
- package/vault/wiki/sources/superpowers-github-repo.md +56 -0
- package/vault/wiki/sources/superpowers-release-blog.md +54 -0
- package/vault/wiki/sources/superpowers-termdock-analysis.md +45 -0
- package/vault/wiki/sources/swe-agent-aci.md +42 -0
- package/vault/wiki/sources/swe-bench.md +45 -0
- package/vault/wiki/sources/swe-pruner-context-pruning.md +13 -0
- package/vault/wiki/sources/think-in-code-blog.md +48 -0
- package/vault/wiki/sources/tree-sitter-docs.md +13 -0
- package/vault/wiki/sources/ts-best-practices-2025-devto.md +42 -0
- package/vault/wiki/sources/ts-folder-structure-mingyang.md +58 -0
- package/vault/wiki/sources/ts-monorepo-koerselman.md +44 -0
- package/vault/wiki/sources/ts-result-error-handling-kkalamarski.md +52 -0
- package/vault/wiki/sources/ts-runtimes-comparison-betterstack.md +42 -0
- package/vault/wiki/sources/ts-strict-mode-rishikc.md +43 -0
- package/vault/wiki/sources/unix-philosophy.md +48 -0
- package/vault/wiki/sources/vectara-chunking-vs-embedding-naacl2025.md +39 -0
- package/vault/wiki/sources/vectara-guardian-agents.md +79 -0
- package/vault/wiki/sources/vgrep-semantic-search.md +76 -0
- package/vault/wiki/sources/vitest-official.md +41 -0
- package/vault/wiki/sources/vscode-pi-community-extension.md +40 -0
- package/vault/wiki/sources/wozcode.md +79 -0
- package/.agents/skills/compress/SKILL.md +0 -111
- package/.agents/skills/compress/scripts/__init__.py +0 -9
- package/.agents/skills/compress/scripts/__main__.py +0 -3
- package/.agents/skills/compress/scripts/benchmark.py +0 -78
- package/.agents/skills/compress/scripts/cli.py +0 -73
- package/.agents/skills/compress/scripts/compress.py +0 -227
- package/.agents/skills/compress/scripts/detect.py +0 -121
- package/.agents/skills/compress/scripts/validate.py +0 -189
- package/.agents/skills/emil-design-eng/SKILL.md +0 -679
- package/.agents/skills/lean-ctx/SKILL.md +0 -149
- package/.agents/skills/lean-ctx/scripts/install.sh +0 -95
- package/.agents/skills/scrapling-official/LICENSE.txt +0 -28
- package/.agents/skills/scrapling-official/SKILL.md +0 -390
- package/.agents/skills/scrapling-official/examples/01_fetcher_session.py +0 -26
- package/.agents/skills/scrapling-official/examples/02_dynamic_session.py +0 -26
- package/.agents/skills/scrapling-official/examples/03_stealthy_session.py +0 -26
- package/.agents/skills/scrapling-official/examples/04_spider.py +0 -58
- package/.agents/skills/scrapling-official/examples/README.md +0 -45
- package/.agents/skills/scrapling-official/references/fetching/choosing.md +0 -78
- package/.agents/skills/scrapling-official/references/fetching/dynamic.md +0 -352
- package/.agents/skills/scrapling-official/references/fetching/static.md +0 -432
- package/.agents/skills/scrapling-official/references/fetching/stealthy.md +0 -255
- package/.agents/skills/scrapling-official/references/mcp-server.md +0 -214
- package/.agents/skills/scrapling-official/references/migrating_from_beautifulsoup.md +0 -86
- package/.agents/skills/scrapling-official/references/parsing/adaptive.md +0 -212
- package/.agents/skills/scrapling-official/references/parsing/main_classes.md +0 -586
- package/.agents/skills/scrapling-official/references/parsing/selection.md +0 -494
- package/.agents/skills/scrapling-official/references/spiders/advanced.md +0 -344
- package/.agents/skills/scrapling-official/references/spiders/architecture.md +0 -94
- package/.agents/skills/scrapling-official/references/spiders/getting-started.md +0 -164
- package/.agents/skills/scrapling-official/references/spiders/proxy-blocking.md +0 -235
- package/.agents/skills/scrapling-official/references/spiders/requests-responses.md +0 -196
- package/.agents/skills/scrapling-official/references/spiders/sessions.md +0 -205
- package/PLAN.md +0 -11
- package/extensions/lean-ctx-enforce.ts +0 -166
- package/skills-lock.json +0 -35
- package/wiki/README.md +0 -19
- package/wiki/decisions/0001-establish-project-wiki-and-decision-record-format.md +0 -25
- package/wiki/decisions/0002-add-project-banner-to-readme.md +0 -26
- package/wiki/decisions/0003-remove-redundant-readme-title-heading.md +0 -26
- package/wiki/decisions/0004-publish-package-to-npm-as-ultimate-pi.md +0 -26
- package/wiki/decisions/0005-automate-npm-publish-with-github-actions.md +0 -27
- package/wiki/decisions/0006-switch-to-npm-trusted-publishing.md +0 -26
- package/wiki/decisions/0007-use-absolute-banner-url-for-npm-readme-rendering.md +0 -26
- package/wiki/decisions/0008-rename-banner-asset-for-cache-busting.md +0 -26
- package/wiki/decisions/0009-force-oidc-path-by-clearing-node-auth-token-in-publish-step.md +0 -25
- package/wiki/decisions/0010-simplify-setup-node-for-npm-trusted-publishing.md +0 -26
- package/wiki/decisions/0011-add-noop-workflow-change-to-force-fresh-publish-run.md +0 -25
- package/wiki/decisions/0012-align-workflow-runtime-with-npm-trusted-publishing-requirements.md +0 -26
- package/wiki/decisions/0013-add-package-repository-url-for-provenance-validation.md +0 -25
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: concept
|
|
3
|
+
title: "Lifecycle Hook System"
|
|
4
|
+
aliases: ["lifecycle hooks", "tool-level hooks", "deterministic hooks"]
|
|
5
|
+
created: 2026-05-01
|
|
6
|
+
tags: [concept, harness-design, hooks, deterministic-policy, claude-code]
|
|
7
|
+
status: developing
|
|
8
|
+
related:
|
|
9
|
+
- "[[harness-implementation-plan]]"
|
|
10
|
+
- "[[agentic-harness]]"
|
|
11
|
+
- "[[feedforward-feedback-harness]]"
|
|
12
|
+
- "[[harness-wiki-skill-mapping]]"
|
|
13
|
+
sources:
|
|
14
|
+
- "[[claude-code-architecture-karaxai-2026]]"
|
|
15
|
+
- "[[claude-code-security-architecture-penligent-2026]]"
|
|
16
|
+
updated: 2026-05-02
|
|
17
|
+
---
|
|
18
|
+
# Lifecycle Hook System
|
|
19
|
+
|
|
20
|
+
Deterministic policy enforcement at the tool lifecycle level through hook events with exit-code semantics. The key insight: **CLAUDE.md achieves ~92% compliance. Hooks achieve 100% compliance** for conditions they match (Source: [[claude-code-architecture-karaxai-2026]]).
|
|
21
|
+
|
|
22
|
+
## Hook vs Prompt
|
|
23
|
+
|
|
24
|
+
| Mechanism | Compliance | Method | When it fails |
|
|
25
|
+
|---|---|---|---|
|
|
26
|
+
| CLAUDE.md rules | ~92% | Prompt injection | Model ignores, forgets under load, context anxiety |
|
|
27
|
+
| Hooks | 100% (when matched) | Shell command with exit code | Only if hook script has bugs |
|
|
28
|
+
|
|
29
|
+
The 8% gap between CLAUDE.md and hooks represents every case where the model "knew the rule but didn't follow it." Hooks close this gap by making policy enforcement external to the model.
|
|
30
|
+
|
|
31
|
+
## Key Hook Events
|
|
32
|
+
|
|
33
|
+
### PreToolUse (Most Critical)
|
|
34
|
+
Fires before tool execution. Can: allow, deny, ask (prompt user), defer (for batch processing), modify tool input, inject context. Exit code 2 blocks the tool. JSON output allows finer control.
|
|
35
|
+
|
|
36
|
+
**Use cases**:
|
|
37
|
+
- Block dangerous shell commands (`rm -rf`, `curl` to unknown hosts)
|
|
38
|
+
- Auto-approve safe commands (`npm test`, `git status`)
|
|
39
|
+
- Modify tool input (sanitize paths, add safety flags)
|
|
40
|
+
- Inject environment context ("current branch: main, CI is red")
|
|
41
|
+
- Defend against prompt injection in tool calls
|
|
42
|
+
|
|
43
|
+
### PostToolUse
|
|
44
|
+
Fires after tool succeeds. Can: audit output, auto-format files, run tests asynchronously, replace tool output (redact secrets), inject context. Cannot block (tool already ran).
|
|
45
|
+
|
|
46
|
+
**Use cases**:
|
|
47
|
+
- Run linter after every `Write`/`Edit`
|
|
48
|
+
- Redact secrets from tool output before model sees them
|
|
49
|
+
- Log all file modifications for audit trail
|
|
50
|
+
- Trigger async test suite after code changes
|
|
51
|
+
|
|
52
|
+
### Stop / SubagentStop
|
|
53
|
+
Fires when agent finishes. Can: block stopping, re-invoke agent with feedback. Exit code 2 or JSON `decision: "block"` prevents stop.
|
|
54
|
+
|
|
55
|
+
**Use cases**:
|
|
56
|
+
- "Tests must pass before you stop"
|
|
57
|
+
- "All lint errors must be resolved"
|
|
58
|
+
- "Task list must be fully checked off"
|
|
59
|
+
- "Build must succeed before claiming completion"
|
|
60
|
+
|
|
61
|
+
### PermissionRequest
|
|
62
|
+
Fires when permission dialog would appear. Can: programmatically allow/deny, modify input, update permission rules. Replaces user-facing approval dialogs.
|
|
63
|
+
|
|
64
|
+
**Use cases**:
|
|
65
|
+
- Auto-approve based on environment (CI vs local)
|
|
66
|
+
- Implement time-based policies ("no deploys after 5 PM")
|
|
67
|
+
- Apply team-wide permission rules dynamically
|
|
68
|
+
|
|
69
|
+
## Five Hook Types
|
|
70
|
+
|
|
71
|
+
| Type | Mechanism | Blocking | Use |
|
|
72
|
+
|---|---|---|---|
|
|
73
|
+
| `command` | Shell script, exit codes + JSON stdout | Yes (exit 2) | Deterministic checks, validation |
|
|
74
|
+
| `http` | POST to URL, JSON response | Yes (2xx with block) | Webhook integrations, external services |
|
|
75
|
+
| `mcp_tool` | Call MCP server tool | Depends on tool | Reuse existing MCP infrastructure |
|
|
76
|
+
| `prompt` | Single-turn LLM evaluation | Yes (JSON ok:false) | Semantic checks, policy evaluation |
|
|
77
|
+
| `agent` | Multi-turn subagent with tools | Yes (JSON ok:false) | Complex verification needing codebase access |
|
|
78
|
+
|
|
79
|
+
## Integration with Our Harness
|
|
80
|
+
|
|
81
|
+
Current state: `extensions/harness-*.ts` provides layer-level hooks (before/after each pipeline stage). Missing: tool-level hooks with deterministic exit-code semantics.
|
|
82
|
+
|
|
83
|
+
**Proposed**: Add a `lib/harness-hooks.ts` module that:
|
|
84
|
+
1. Registers hook events at tool lifecycle boundaries (PreToolUse, PostToolUse, etc.)
|
|
85
|
+
2. Supports command-based and prompt-based hook types
|
|
86
|
+
3. Uses exit-code semantics for deterministic allow/deny
|
|
87
|
+
4. Integrates with existing layer-level extension hooks (they fire before/after tool-level hooks)
|
|
88
|
+
5. Hooks configured in `.pi/harness/hooks.json` with the same scoping model (project, user, managed)
|
|
89
|
+
|
|
90
|
+
## First Principles
|
|
91
|
+
|
|
92
|
+
- **Hooks determine correctness, not prompts.** If a rule must never be broken, use a hook. If a rule should usually be followed, use prompts.
|
|
93
|
+
- **Exit codes are the contract.** 0 = allow, 2 = deny (feed stderr to model), other = non-blocking error.
|
|
94
|
+
- **Hooks are external to the model.** They don't consume context. They can't be ignored, forgotten, or bypassed through clever prompting.
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: concept
|
|
3
|
+
status: developing
|
|
4
|
+
created: 2026-04-30
|
|
5
|
+
updated: 2026-05-01
|
|
6
|
+
tags:
|
|
7
|
+
- mcp
|
|
8
|
+
- agent-tools
|
|
9
|
+
- routing
|
|
10
|
+
- architecture
|
|
11
|
+
- typescript-execution-layer
|
|
12
|
+
related:
|
|
13
|
+
- "[[agent-search-enforcement]]"
|
|
14
|
+
- "[[ck-tool]]"
|
|
15
|
+
- "[[Research: semantic code search tools]]"
|
|
16
|
+
- "[[ts-execution-layer]]"
|
|
17
|
+
- "[[harness-implementation-plan]]"
|
|
18
|
+
title: "MCP tool routing"
|
|
19
|
+
|
|
20
|
+
---# MCP tool routing
|
|
21
|
+
|
|
22
|
+
Using the Model Context Protocol (MCP) to register semantic code search as a first-class agent tool, then routing code-exploration queries through it instead of generic shell tools.
|
|
23
|
+
|
|
24
|
+
## MCP Architecture for Code Search
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
┌─────────────────┐ MCP Protocol ┌──────────────────┐
|
|
28
|
+
│ AI Agent │ ◄──────────────────► │ ck MCP Server │
|
|
29
|
+
│ (Claude Code, │ tools/list │ (ck --serve) │
|
|
30
|
+
│ Cursor, etc.) │ tools/call │ │
|
|
31
|
+
│ │ resources/read │ ck_search() │
|
|
32
|
+
│ Native Tools: │ │ ck_get() │
|
|
33
|
+
│ - bash │ │ ck_info() │
|
|
34
|
+
│ - read │ │ ck_reindex() │
|
|
35
|
+
│ - write │ │ │
|
|
36
|
+
└─────────────────┘ └──────────────────┘
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## ck MCP Tools
|
|
40
|
+
|
|
41
|
+
| Tool | Description | Parameters |
|
|
42
|
+
|------|-------------|------------|
|
|
43
|
+
| `ck_search` | Semantic/hybrid search | query, path, mode (sem/hybrid/regex), limit, threshold |
|
|
44
|
+
| `ck_get` | Get file content with context | file_path, start_line, end_line |
|
|
45
|
+
| `ck_info` | Get index statistics | path |
|
|
46
|
+
| `ck_reindex` | Force re-index | path, model |
|
|
47
|
+
|
|
48
|
+
## Registration
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Claude Code
|
|
52
|
+
claude mcp add ck-search -s user -- ck --serve
|
|
53
|
+
|
|
54
|
+
# Claude Desktop (claude_desktop_config.json)
|
|
55
|
+
{
|
|
56
|
+
"mcpServers": {
|
|
57
|
+
"ck-search": {
|
|
58
|
+
"command": "ck",
|
|
59
|
+
"args": ["--serve"]
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
# Cursor (.cursor/mcp.json)
|
|
65
|
+
{
|
|
66
|
+
"mcpServers": {
|
|
67
|
+
"ck-search": {
|
|
68
|
+
"command": "ck",
|
|
69
|
+
"args": ["--serve"]
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Routing Logic
|
|
76
|
+
|
|
77
|
+
The agent decides which tool to use. MCP tools appear alongside native tools. To influence routing:
|
|
78
|
+
|
|
79
|
+
1. **Tool descriptions matter**: The MCP tool description is what the agent sees. Make it specific:
|
|
80
|
+
```
|
|
81
|
+
"ck_search: Semantic code search using embeddings. Use for conceptual
|
|
82
|
+
queries like 'error handling', 'authentication flow', 'retry logic'.
|
|
83
|
+
For exact string matching, use grep instead."
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
2. **System prompt priority**: Tell the agent to prefer MCP tools for code exploration.
|
|
87
|
+
|
|
88
|
+
3. **Naming conventions**: Name tools intuitively. `ck_search` is clearer than `tool_1`.
|
|
89
|
+
|
|
90
|
+
## Limitations
|
|
91
|
+
|
|
92
|
+
- **No priority/weight system in MCP**: All tools are equal. No way to mark a tool as "preferred."
|
|
93
|
+
- **Agent may still choose bash**: If bash grep works, inertia favors it.
|
|
94
|
+
- **Tool discovery overhead**: Agent must query `tools/list` to discover MCP tools. Some agents cache this.
|
|
95
|
+
- **No "replace native tool" mechanism**: MCP tools are additive, not substitutive. Can't disable bash grep.
|
|
96
|
+
|
|
97
|
+
## Alternatives to MCP Routing
|
|
98
|
+
|
|
99
|
+
- **Custom agent framework**: Build your own tool router that intercepts all tool calls and rewrites them.
|
|
100
|
+
- **Proxy MCP server**: An MCP server that wraps both native tools and ck, making routing decisions centrally.
|
|
101
|
+
- **Shell function aliases**: `function grep() { ck --hybrid "$@" || command grep "$@"; }` — simpler but less controlled.
|
|
102
|
+
- **[[ts-execution-layer|TypeScript Execution Layer]]**: Replace MCP tool routing entirely. Instead of routing individual tool calls, expose all tools as a typed TypeScript API. Agent writes TS code; sandbox executes; tool calls dispatch via RPC. 3-4x context reduction and ~20% higher multi-tool success rate vs flat tool calling. Validated by CodeAct, Cloudflare Code Mode, Executor.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: concept
|
|
3
|
+
title: "Memory System-of-Record vs Ephemeral Cache"
|
|
4
|
+
aliases: ["memory layering", "canonical memory vs fast memory"]
|
|
5
|
+
created: 2026-05-05
|
|
6
|
+
updated: 2026-05-05
|
|
7
|
+
tags: [concept, memory, harness, architecture]
|
|
8
|
+
status: developing
|
|
9
|
+
related:
|
|
10
|
+
- "[[persistent-memory]]"
|
|
11
|
+
- "[[adr-009]]"
|
|
12
|
+
- "[[lifecycle-hooks]]"
|
|
13
|
+
- "[[Research: claude-mem over Obsidian for Harness Layer]]"
|
|
14
|
+
sources:
|
|
15
|
+
- "[[adr-009]]"
|
|
16
|
+
- "[[persistent-memory]]"
|
|
17
|
+
- "[[codex-harness-innovations]]"
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
# Memory System-of-Record vs Ephemeral Cache
|
|
21
|
+
|
|
22
|
+
## Definition
|
|
23
|
+
Split agent memory into two layers:
|
|
24
|
+
- **System-of-record memory**: durable, auditable, human-reviewable, citation-ready.
|
|
25
|
+
- **Ephemeral cache memory**: fast, local, convenience-oriented, non-authoritative.
|
|
26
|
+
|
|
27
|
+
## Why This Pattern
|
|
28
|
+
- Harness decisions need traceability and contradiction handling.
|
|
29
|
+
- Fast memory helps turn-level latency and continuity.
|
|
30
|
+
- Mixing both into one store causes drift: quick notes get mistaken as validated decisions.
|
|
31
|
+
|
|
32
|
+
## Harness Mapping
|
|
33
|
+
| Layer | Role | Example in this repo |
|
|
34
|
+
|---|---|---|
|
|
35
|
+
| System-of-record | Canonical truth | `vault/wiki/` with `index.md`, `log.md`, `hot.md` |
|
|
36
|
+
| Ephemeral cache | Speed and recall hints | Optional local auto-memory tool |
|
|
37
|
+
|
|
38
|
+
## Guardrails
|
|
39
|
+
- Any decision, architecture change, or policy update must be written to wiki.
|
|
40
|
+
- Ephemeral memory can suggest; wiki must confirm.
|
|
41
|
+
- When cache conflicts with wiki, wiki wins.
|
|
42
|
+
- Completion hooks should fail tasks that changed architecture without wiki write.
|
|
43
|
+
|
|
44
|
+
## Tradeoff
|
|
45
|
+
- Pure wiki: higher reliability, more manual writing.
|
|
46
|
+
- Pure auto-memory: lower friction, weaker audit/provenance.
|
|
47
|
+
- Hybrid: best practical balance for agentic harnesses.
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
---
|
|
2
|
+
aliases: ["meta-agent pruning", "context drift meta-agent", "stuck-agent recovery"]
|
|
3
|
+
type: concept
|
|
4
|
+
title: "Meta-Agent Context Pruning"
|
|
5
|
+
created: 2026-04-30
|
|
6
|
+
status: developing
|
|
7
|
+
tags:
|
|
8
|
+
- concept
|
|
9
|
+
- meta-agent
|
|
10
|
+
- context-pruning
|
|
11
|
+
- agent-reliability
|
|
12
|
+
- harness-design
|
|
13
|
+
related:
|
|
14
|
+
- "[[Research: Meta-Agent Context Drift Detection]]"
|
|
15
|
+
- "[[context-drift-in-agents]]"
|
|
16
|
+
- "[[agent-loop-detection-patterns]]"
|
|
17
|
+
- "[[guardian-agent-pattern]]"
|
|
18
|
+
- "[[ironclaw-drift-monitor]]"
|
|
19
|
+
- "[[harness-configuration-layers]]"
|
|
20
|
+
- "[[grounding-checkpoints]]"
|
|
21
|
+
updated: 2026-05-02
|
|
22
|
+
|
|
23
|
+
---# Meta-Agent Context Pruning
|
|
24
|
+
|
|
25
|
+
A proposed system: a separate observer (meta-agent) monitors the primary coding agent for stuck behavior, detects context drift, prunes irrelevant history from the context window, and restarts the agent with clean context. This is a **novel synthesis** — each component exists independently in literature and practice, but the full pipeline (detect → identify dead-ends → prune → restart) has not been published as a single system.
|
|
26
|
+
|
|
27
|
+
## Architecture
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
┌─────────────────────────────────────────────────┐
|
|
31
|
+
│ META-AGENT (Observer) │
|
|
32
|
+
│ │
|
|
33
|
+
│ ┌──────────┐ ┌──────────┐ ┌──────────────┐ │
|
|
34
|
+
│ │ DETECT │ → │IDENTIFY │ → │ PRUNE + │ │
|
|
35
|
+
│ │ stuck │ │ dead-end │ │ RESTART │ │
|
|
36
|
+
│ │ pattern │ │ entries │ │ │ │
|
|
37
|
+
│ └──────────┘ └──────────┘ └──────────────┘ │
|
|
38
|
+
│ ↑ │ │
|
|
39
|
+
│ │ monitors │ injects │
|
|
40
|
+
│ │ ↓ │
|
|
41
|
+
│ ┌──────────────────────────────────────────┐ │
|
|
42
|
+
│ │ PRIMARY AGENT (Coding Agent) │ │
|
|
43
|
+
│ │ tool calls → errors → retries → context │ │
|
|
44
|
+
│ │ fills with noise → gets more lost │ │
|
|
45
|
+
│ └──────────────────────────────────────────┘ │
|
|
46
|
+
└─────────────────────────────────────────────────┘
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Pipeline
|
|
50
|
+
|
|
51
|
+
### Phase 1: Detection
|
|
52
|
+
|
|
53
|
+
Rule-based pattern matching on tool call history. Zero LLM overhead.
|
|
54
|
+
|
|
55
|
+
| Pattern | Method | Threshold |
|
|
56
|
+
|---------|--------|-----------|
|
|
57
|
+
| Repetition | Hash(tool + args), count in window | 3+ in 10 calls |
|
|
58
|
+
| Failure spiral | Consecutive error count | 4+ |
|
|
59
|
+
| Tool cycling | Sequence pattern A-B-A-B-A-B | 6 calls |
|
|
60
|
+
| Silence drift | Iterations since last text response | 15+ |
|
|
61
|
+
| Rework churn | Same file path written repeatedly | 3+ |
|
|
62
|
+
| Excessive searching | ls/find/grep calls without code edits | 5+ |
|
|
63
|
+
|
|
64
|
+
Optionally: LLM-based semantic drift check every N steps for higher precision on nuanced stuckness.
|
|
65
|
+
|
|
66
|
+
### Phase 2: Identify Dead-End Entries
|
|
67
|
+
|
|
68
|
+
Classify each context entry as keep or prune:
|
|
69
|
+
|
|
70
|
+
**Keep**: Error led to different approach on next attempt. Output contained new information. User explicitly requested. Established a constraint.
|
|
71
|
+
|
|
72
|
+
**Prune**: Identical call returned same result. Pure noise (boilerplate errors). Agent forgot about it entirely.
|
|
73
|
+
|
|
74
|
+
Conservative default: when uncertain, keep. False-positive pruning is worse than false-negative (keeping noise).
|
|
75
|
+
|
|
76
|
+
### Phase 3: Prune + Restart
|
|
77
|
+
|
|
78
|
+
Two implementation strategies:
|
|
79
|
+
|
|
80
|
+
**Strategy A — In-place editing** (if API supports message deletion from middle of history): Keep original task, key decisions, constraints discovered, last successful state. Remove dead-end entries between them. Inject correction message.
|
|
81
|
+
|
|
82
|
+
**Strategy B — Session restart** (portable, always works): Terminate current session. Start new session with: original system prompt + task + pruned history summary + correction message.
|
|
83
|
+
|
|
84
|
+
### Phase 4: Correction Injection
|
|
85
|
+
|
|
86
|
+
Escalation model:
|
|
87
|
+
1. **Soft**: "You've called [tool] with same args 3 times. Summarize what you know and try a different approach."
|
|
88
|
+
2. **Strong**: "You're stuck. Here's a summary of what you've accomplished. Start fresh from here." (includes pruned context summary)
|
|
89
|
+
3. **Forced restart**: Terminate, prune, restart with clean context.
|
|
90
|
+
|
|
91
|
+
## Feasibility
|
|
92
|
+
|
|
93
|
+
**High**. Each component is individually validated:
|
|
94
|
+
|
|
95
|
+
- Detection: Production-proven (ironclaw DriftMonitor, LangSight loop detection)
|
|
96
|
+
- Pruning: Conceptually similar to context compaction (Anthropic Claude Code) and code-level pruning (SWE-Pruner)
|
|
97
|
+
- Restart: Standard pattern in multi-agent systems (sub-agent isolation)
|
|
98
|
+
|
|
99
|
+
**Novelty**: The composition. No existing system combines all three phases.
|
|
100
|
+
|
|
101
|
+
## Overhead
|
|
102
|
+
|
|
103
|
+
| Component | Tokens | Notes |
|
|
104
|
+
|-----------|--------|-------|
|
|
105
|
+
| Rule-based detection | 0 | Hash comparison + counters |
|
|
106
|
+
| LLM-based detection (optional) | ~500/check | Every 10-15 steps |
|
|
107
|
+
| Pruning | 0 | Metadata operation |
|
|
108
|
+
| Correction injection | ~150/injection | Max 3 injections |
|
|
109
|
+
| Session restart | 1 API call | Cache miss cost |
|
|
110
|
+
| **Total** | **~1,500-3,000** | Per 50-step session |
|
|
111
|
+
|
|
112
|
+
**Net savings**: 5-10x token reduction when stuck sessions are common. Breakeven after 1-2 interventions.
|
|
113
|
+
|
|
114
|
+
## Edge Cases
|
|
115
|
+
|
|
116
|
+
- **Polling agents**: Whitelist polling tools. Use time-based windows, not count-based.
|
|
117
|
+
- **Retry-heavy workflows**: Increase thresholds (5-7). Some tools legitimately fail transiently.
|
|
118
|
+
- **Exploratory searching**: Distinguish by whether code edits follow the searches.
|
|
119
|
+
- **Mid-reasoning interruption**: Pruning while the model is mid-chain-of-thought may lose coherence. Needs testing.
|
|
120
|
+
|
|
121
|
+
## Harness Integration
|
|
122
|
+
|
|
123
|
+
Proposed as **Layer 2.5 — Runtime Drift Monitor** in the ultimate-pi harness:
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
L1 (Spec Hardening) → L2 (Structured Planning) → L2.5 (Drift Monitor) → L3 (Execution + Grounding)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Components:
|
|
130
|
+
- `lib/harness-drift-monitor.ts` — Detection engine, pruning logic, correction injection
|
|
131
|
+
- `extensions/harness-drift-monitor.ts` — Hooks into before_llm_call / after_tool_call
|
|
132
|
+
- `.pi/harness/drift-monitor.json` — Config: thresholds, escalation, whitelists, model profile
|
|
133
|
+
|
|
134
|
+
Model-adaptive: Rule-based every step for GPT, rule-based every 10 steps for Gemini, LLM-based every 15 steps for Opus.
|
|
135
|
+
|
|
136
|
+
## Open Questions
|
|
137
|
+
|
|
138
|
+
- Can context be pruned in-place or must it always restart? API support varies.
|
|
139
|
+
- What is the minimum context that must survive pruning?
|
|
140
|
+
- Does pruning break chain-of-thought coherence?
|
|
141
|
+
- How does pruning interact with prompt caching (cache invalidation)?
|
|
142
|
+
- Can a small model (Haiku/Flash) serve as the meta-agent detector?
|
|
143
|
+
- Does the meta-agent itself need drift monitoring? (Infinite regress risk)
|
|
144
|
+
|
|
145
|
+
## See Also
|
|
146
|
+
|
|
147
|
+
- [[context-drift-in-agents]] — The problem this solves
|
|
148
|
+
- [[agent-loop-detection-patterns]] — Detection code and patterns
|
|
149
|
+
- [[guardian-agent-pattern]] — Complementary proactive approach
|
|
150
|
+
- [[Research: Meta-Agent Context Drift Detection]] — Full research synthesis
|
|
151
|
+
- [[harness-configuration-layers]] — Where this fits in the four-layer harness model
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: concept
|
|
3
|
+
title: "Model-Adaptive Agent Harness"
|
|
4
|
+
aliases: ["adaptive harness", "model-aware harness"]
|
|
5
|
+
created: 2026-04-30
|
|
6
|
+
updated: 2026-05-01
|
|
7
|
+
tags: [concept, agents, harness-design, model-awareness]
|
|
8
|
+
status: redesign
|
|
9
|
+
related:
|
|
10
|
+
- "[[provider-native-prompting]]"
|
|
11
|
+
- "[[harness-configuration-layers]]"
|
|
12
|
+
- "[[Research: Model-Specific Prompting Guides]]"
|
|
13
|
+
- "[[forgecode-gpt5-agent-improvements]]"
|
|
14
|
+
- "[[harness-implementation-plan]]"
|
|
15
|
+
- "[[codex-harness-innovations]]"
|
|
16
|
+
- "[[codex-open-source-agent-2026]]"
|
|
17
|
+
- "[[openai-prompt-guidance]]"
|
|
18
|
+
- "[[anthropic-prompt-best-practices]]"
|
|
19
|
+
- "[[gemini-3-prompting-guide]]"
|
|
20
|
+
sources:
|
|
21
|
+
- "[[openai-prompt-guidance]]"
|
|
22
|
+
- "[[anthropic-prompt-best-practices]]"
|
|
23
|
+
- "[[gemini-3-prompting-guide]]"
|
|
24
|
+
- "[[forgecode-gpt5-agent-improvements]]"
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
# Model-Adaptive Agent Harness
|
|
28
|
+
|
|
29
|
+
An agent harness that generates **provider-native prompts** optimized for each model's official prompting conventions — not a single canonical format with strictness relaxations.
|
|
30
|
+
|
|
31
|
+
> [!important] REDESIGN: May 2026 — The original design ("write once for strictest, relax for forgiving") has been replaced. Official provider guidance shows that models need fundamentally different prompt formats, not just different strictness levels. See [[provider-native-prompting]] and [[Research: Model-Specific Prompting Guides]].
|
|
32
|
+
|
|
33
|
+
## Why This Exists
|
|
34
|
+
|
|
35
|
+
Forge Code demonstrated that GPT 5.4 and Opus 4.6 reached identical benchmark scores (81.8% on TermBench 2.0) only after the harness was adapted to each model. This proved that adaptation matters.
|
|
36
|
+
|
|
37
|
+
But Forge Code's approach was empirical: observe failure modes, then compensate. Each provider now publishes OFFICIAL guidance on how to prompt their models correctly. These guides should be the PRIMARY source for harness adaptations.
|
|
38
|
+
|
|
39
|
+
## Design Principle (v2 — May 2026)
|
|
40
|
+
|
|
41
|
+
**Generate provider-native prompts from a provider-agnostic semantic specification. Never generate a single canonical prompt and relax it.**
|
|
42
|
+
|
|
43
|
+
The harness's internal representation is a semantic spec (WHAT must be communicated). The prompt renderer generates actual prompt text according to the target model's provider conventions (HOW it's communicated).
|
|
44
|
+
|
|
45
|
+
See [[provider-native-prompting]] for the full architecture and renderer design.
|
|
46
|
+
|
|
47
|
+
## Provider Profiles (Official Guidance)
|
|
48
|
+
|
|
49
|
+
### OpenAI GPT-5.x
|
|
50
|
+
- **Structure**: XML-like sections, constraints-first ordering
|
|
51
|
+
- **Density**: Outcome-first, concise. Describe destination, not journey
|
|
52
|
+
- **Verification**: Pre-flight/post-flight action safety blocks
|
|
53
|
+
- **Thinking**: reasoning_effort parameter (none/low/medium/high/xhigh)
|
|
54
|
+
- **Tools**: apply_patch native, shell_command, update_plan
|
|
55
|
+
- **Key rule**: Contradictory instructions actively harm GPT-5+ reasoning
|
|
56
|
+
- **Source**: [[openai-prompt-guidance]]
|
|
57
|
+
|
|
58
|
+
### Anthropic Claude 4.x
|
|
59
|
+
- **Structure**: XML tags, long content at TOP, query at BOTTOM
|
|
60
|
+
- **Density**: General instructions over prescriptive steps
|
|
61
|
+
- **Verification**: Self-check at end, role setting critical
|
|
62
|
+
- **Thinking**: Adaptive thinking with effort parameter (max/xhigh/high/medium/low)
|
|
63
|
+
- **Tools**: Explicit tool direction, text_editor, bash
|
|
64
|
+
- **Key rule**: Be explicit; don't infer intent from vague prompts
|
|
65
|
+
- **Source**: [[anthropic-prompt-best-practices]]
|
|
66
|
+
|
|
67
|
+
### Google Gemini 3
|
|
68
|
+
- **Structure**: Plain text, constraints at END (not beginning)
|
|
69
|
+
- **Density**: Concise by default, must explicitly steer for verbosity
|
|
70
|
+
- **Verification**: Split-step: verify capability → then generate
|
|
71
|
+
- **Thinking**: thinking level LOW/HIGH, system instructions
|
|
72
|
+
- **Temperature**: **1.0 MANDATORY** — never change
|
|
73
|
+
- **Key rule**: Persona definitions are binding; model treats them seriously
|
|
74
|
+
- **Source**: [[gemini-3-prompting-guide]]
|
|
75
|
+
|
|
76
|
+
> [!gap] Empirical failure mode data (from Forge Code) should be layered ON TOP of official guidance, not used as the foundation. The old design was reversed.
|
|
77
|
+
|
|
78
|
+
## What Never Adapts
|
|
79
|
+
|
|
80
|
+
Core invariants across all profiles — enforced by pipeline structure, not model-specific instructions:
|
|
81
|
+
|
|
82
|
+
- Pipeline phase ordering and layer requirements
|
|
83
|
+
- Quality standards and source attribution requirements
|
|
84
|
+
- Confidence labeling
|
|
85
|
+
- Budget constraints (max rounds, max tokens, max pages)
|
|
86
|
+
- Verification requirements (what must be checked, even if how varies)
|
|
87
|
+
- Read-first/write-after wiki contract
|
|
88
|
+
- No-skip rule (verification is mandatory)
|
|
89
|
+
|
|
90
|
+
## Application to Harness Pipeline
|
|
91
|
+
|
|
92
|
+
Each pipeline layer generates a fragment of the semantic spec. The renderer produces the actual prompt:
|
|
93
|
+
|
|
94
|
+
- **L1 Spec Hardening**: Task definition, acceptance criteria → rendered per provider conventions
|
|
95
|
+
- **L2 Structured Planning**: Task DAG, dependencies → constraint ordering per provider
|
|
96
|
+
- **L2.5 Drift Monitor**: Detection strategy → split-step (Gemini), self-check (Claude), loop (GPT)
|
|
97
|
+
- **L3 Grounding Checkpoints**: Verification steps → grounding mechanism per provider
|
|
98
|
+
- **L4 Adversarial Verification**: Attack vectors → verification workflow per provider
|
|
99
|
+
- **L5-L8**: Observability, memory, orchestration, query → rendered per provider
|
|
100
|
+
|
|
101
|
+
## Implementation
|
|
102
|
+
|
|
103
|
+
New module: **Prompt Renderer** (Phase P22b in [[harness-implementation-plan]])
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
Semantic Spec → Prompt Renderer → Provider-Native Prompt
|
|
107
|
+
├── openai-renderer
|
|
108
|
+
├── anthropic-renderer
|
|
109
|
+
└── google-renderer
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
- `lib/renderers/openai.ts` — XML-like sections, constraints-first, preambles
|
|
113
|
+
- `lib/renderers/anthropic.ts` — XML tags, long-content-top, role setting
|
|
114
|
+
- `lib/renderers/google.ts` — Plain text, constraints-last, grounding statements
|
|
115
|
+
- `lib/renderers/fallback.ts` — Conservative markdown for unknown models
|
|
116
|
+
|
|
117
|
+
## Sources
|
|
118
|
+
|
|
119
|
+
- [[openai-prompt-guidance]] — OpenAI official, 2026
|
|
120
|
+
- [[anthropic-prompt-best-practices]] — Anthropic official, 2026
|
|
121
|
+
- [[gemini-3-prompting-guide]] — Google Cloud official, 2026-04-29
|
|
122
|
+
- [[forgecode-gpt5-agent-improvements]] — Forge Code empirical, 2026
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: concept
|
|
3
|
+
title: "Model Routing Agents"
|
|
4
|
+
created: 2026-04-30
|
|
5
|
+
updated: 2026-04-30
|
|
6
|
+
tags:
|
|
7
|
+
- agent-architecture
|
|
8
|
+
- token-reduction
|
|
9
|
+
- cost-optimization
|
|
10
|
+
related:
|
|
11
|
+
- "[[wozcode]]"
|
|
12
|
+
- "[[agentic-harness]]"
|
|
13
|
+
- "[[research-wozcode-token-reduction]]"
|
|
14
|
+
- "[[wiki-query-interface]]"
|
|
15
|
+
status: developing
|
|
16
|
+
|
|
17
|
+
---# Model Routing Agents
|
|
18
|
+
|
|
19
|
+
Model routing is an agent architecture pattern where different operation types are dispatched to different AI models based on capability requirements and cost. Read-only exploration work goes to the cheapest capable model; code generation stays on the frontier model.
|
|
20
|
+
|
|
21
|
+
## WOZCODE's Pattern
|
|
22
|
+
|
|
23
|
+
WOZCODE uses a two-agent split (Source: [[wozcode]]):
|
|
24
|
+
|
|
25
|
+
| Agent | Model | Cost vs Opus | Operations |
|
|
26
|
+
|-------|-------|-------------|------------|
|
|
27
|
+
| `woz:code` | User's frontier (Opus/Sonnet) | 1× | Write/edit code, full tool access |
|
|
28
|
+
| `woz:explore` | Haiku | ~15× cheaper | Read-only: search, explore, summarize |
|
|
29
|
+
|
|
30
|
+
~40% of coding work is exploration → automatically routed to Haiku → ~70% savings on exploration calls.
|
|
31
|
+
|
|
32
|
+
## Why This Works
|
|
33
|
+
|
|
34
|
+
- **Exploration is read-only**: No risk of Haiku writing bad code because it only reads
|
|
35
|
+
- **Exploration is high-volume**: Finding the right files, understanding architecture, searching for patterns — these are many small calls
|
|
36
|
+
- **Exploration is low-creativity**: "Find the file that defines X" doesn't need frontier reasoning
|
|
37
|
+
- **Summaries keep context lean**: Haiku returns summaries, main agent stays focused
|
|
38
|
+
|
|
39
|
+
## Our Harness Integration Points
|
|
40
|
+
|
|
41
|
+
### L8: Wiki Query Interface
|
|
42
|
+
Current: LLM-native search via claude-obsidian skills.
|
|
43
|
+
|
|
44
|
+
Change: Route wiki queries through Haiku when:
|
|
45
|
+
- Query is read-only knowledge retrieval
|
|
46
|
+
- Query is exploratory (not code generation)
|
|
47
|
+
- Query result is a summary, not executable code
|
|
48
|
+
|
|
49
|
+
### L2: Structured Planning
|
|
50
|
+
Current: Task DAG generation uses the main model.
|
|
51
|
+
|
|
52
|
+
Potential: Route plan review/refinement to Haiku. Frontier model generates the initial plan; Haiku validates, cross-references specs, and checks for missing dependencies.
|
|
53
|
+
|
|
54
|
+
### NEW: Model Router Component
|
|
55
|
+
A new cross-cutting component that sits between the Archon orchestrator (L7) and tool invocations:
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
User Request → L1 (Spec) → L2 (Plan) → L3 (Execute) → L4 (Critics) → L5 (Observe) → L6 (Memory)
|
|
59
|
+
↓
|
|
60
|
+
[Model Router]
|
|
61
|
+
/ \
|
|
62
|
+
woz:code woz:explore
|
|
63
|
+
(Frontier) (Haiku)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
The router decides per-operation:
|
|
67
|
+
- **Route to Haiku**: Read tool, wiki query, search tool, summarize operations
|
|
68
|
+
- **Route to Frontier**: Edit tool, write tool, bash tool, code generation
|
|
69
|
+
- **Route to Frontier (always)**: Adversarial verification (L4), spec hardening (L1)
|
|
70
|
+
|
|
71
|
+
## Router Decision Rules
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
interface ModelRouter {
|
|
75
|
+
route(operation: ToolOperation): ModelTarget;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Default rules:
|
|
79
|
+
const DEFAULT_RULES: RoutingRule[] = [
|
|
80
|
+
{ tools: ['read', 'wiki-query', 'search', 'grep'], operation: 'explore', model: 'haiku' },
|
|
81
|
+
{ tools: ['edit', 'write', 'bash'], operation: 'mutate', model: 'frontier' },
|
|
82
|
+
{ tools: ['harden-spec', 'attack', 'verify'], operation: 'critical', model: 'frontier' },
|
|
83
|
+
{ tools: ['read'], when: 'post-edit-verify', model: 'frontier' }, // verification reads stay on frontier
|
|
84
|
+
];
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Risks
|
|
88
|
+
|
|
89
|
+
- **Haiku hallucination in summaries**: If Haiku misreads code, the summary is wrong, and the main agent acts on bad information. Mitigation: confidence scoring on summaries, critical reads always on frontier.
|
|
90
|
+
- **Latency overhead**: Routing adds a decision step. Mitigation: deterministic routing rules, no AI-in-the-loop for the routing decision itself.
|
|
91
|
+
- **Context coherence**: Summaries may lose detail that matters. Mitigation: progressive disclosure — Haiku returns L1 (signatures), main agent can request L2/L3 if needed.
|
|
92
|
+
|
|
93
|
+
## Cost Model
|
|
94
|
+
|
|
95
|
+
For a typical 5-subtask plan:
|
|
96
|
+
- Without routing: all operations on frontier model
|
|
97
|
+
- With routing: ~40% of operations on Haiku (15× cheaper)
|
|
98
|
+
- Expected savings on exploration: ~70%
|
|
99
|
+
- Expected overall savings: ~15-25% (consistent with WOZCODE's reported range)
|
|
100
|
+
|
|
101
|
+
These are projections. Actual savings must be measured from API usage fields (Source: [[wozcode]] methodology).
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: concept
|
|
3
|
+
status: developing
|
|
4
|
+
tags:
|
|
5
|
+
- typescript
|
|
6
|
+
- monorepo
|
|
7
|
+
- turborepo
|
|
8
|
+
- architecture
|
|
9
|
+
related:
|
|
10
|
+
- "[[ts-monorepo-koerselman]]"
|
|
11
|
+
- "[[Research: TypeScript Best Practices and Codebase Structure]]"
|
|
12
|
+
created: 2026-05-02
|
|
13
|
+
updated: 2026-05-02
|
|
14
|
+
|
|
15
|
+
---# Monorepo Architecture (TypeScript)
|
|
16
|
+
|
|
17
|
+
A monorepo stores multiple related packages (apps, libraries, services) in a single version-controlled repository. TypeScript monorepos add the complexity of shared types, build ordering, and module resolution across packages.
|
|
18
|
+
|
|
19
|
+
## Key Tools
|
|
20
|
+
|
|
21
|
+
- **Turborepo**: Build orchestration with caching. Defines task dependencies (`dependsOn`), inputs/outputs per task. Optional remote cloud cache.
|
|
22
|
+
- **Nx**: Similar to Turborepo but with more integrated code generation and dependency graph visualization.
|
|
23
|
+
- **pnpm workspaces**: Fast, disk-efficient package management with strict dependency isolation.
|
|
24
|
+
|
|
25
|
+
## Internal Package Strategies
|
|
26
|
+
|
|
27
|
+
### Built-Package (Recommended by Koerselman)
|
|
28
|
+
Build TS → JS (with bundler). Point `main` to compiled output. Benefits: efficient caching, path aliases work, ESM output clean. Requires more config.
|
|
29
|
+
|
|
30
|
+
### Internal-Packages (Source-only)
|
|
31
|
+
Point `main` directly to TS source. Benefits: simple setup, live code updates. Downsides: no build caching, slower type-checking in consumers, path aliases conflict across packages.
|
|
32
|
+
|
|
33
|
+
## ESM in Monorepos
|
|
34
|
+
|
|
35
|
+
- CJS **cannot** import from ESM at the top level (synchronous vs asynchronous)
|
|
36
|
+
- ESM requires file extensions on relative imports (`.js` or `.ts` with `moduleResolution: "bundler"`)
|
|
37
|
+
- Bundlers eliminate the need for extensions by combining all code into single output files
|
|
38
|
+
|
|
39
|
+
## IDE Integration
|
|
40
|
+
|
|
41
|
+
Use `declarationMap: true` + `tsc --emitDeclarationOnly` to generate type definition map files. Enables go-to-definition from consuming packages back to original TS source.
|
|
42
|
+
|
|
43
|
+
## Deployment Isolation
|
|
44
|
+
|
|
45
|
+
Tools like `isolate-package` extract a single package + its internal dependencies into a self-contained directory for deployment (solves Firebase monorepo issues).
|