@vpxa/aikit 0.1.108 → 0.1.109

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/README.md CHANGED
@@ -16,7 +16,7 @@ AI Kit keeps that system fast by compressing code context 5-20x with `compact`,
16
16
 
17
17
  ## Features
18
18
 
19
- - **82 MCP tools** for AI agents to search, analyze, and manipulate codebases
19
+ - **61 MCP tools** for AI agents to search, analyze, and manipulate codebases
20
20
  - **17 specialized agents** — Orchestrator, Planner, Implementer, Frontend, Refactor, Debugger, Security, Documenter, Explorer, 4 Researchers, 2 Code Reviewers, 2 Architect Reviewers — each with a focused role and optimal model
21
21
  - **Parallel agent dispatch** — independent sub-tasks run concurrently, up to 4 file-modifying agents in parallel on non-overlapping files
22
22
  - **Multi-model decisions** — 4 Researcher variants with different LLMs analyze every non-trivial technical choice in parallel, then synthesize consensus
@@ -26,7 +26,7 @@ AI Kit keeps that system fast by compressing code context 5-20x with `compact`,
26
26
  - **Three interfaces**: MCP (for agent IDEs), CLI (for terminal agents), and programmatic API
27
27
  - **Tool profiles** — `full`, `safe`, `research`, `minimal`, `discovery` presets to control which tools are exposed
28
28
  - **Meta-tool discovery** — `list_tools`, `describe_tool`, `search_tools` for token-efficient tool exploration
29
- - **Pluggable flows** — `aikit:basic` and `aikit:advanced` built-in, plus custom team flows with 10 flow management tools
29
+ - **Pluggable flows** — `aikit:basic` and `aikit:advanced` built-in, plus custom team flows managed through unified `aikit_flow` actions
30
30
  - **Session digest** — auto-capture session activity for handoff between agents or sessions
31
31
  - **Middleware pipeline** — extensible plugin hooks for tool execution customization
32
32
  - **Pluggable memory** — adapter interface for curated knowledge storage backends
@@ -68,14 +68,14 @@ This is an **MCP (Model Context Protocol) server** that gives AI agents:
68
68
  7. **Knowledge graph** — auto-populated SQLite graph of modules, symbols, and import relationships with traversal, neighbor queries, and change impact tracking
69
69
  8. **Graph auto-population** — during indexing, a lightweight regex extractor builds the knowledge graph automatically from TS/JS source files (functions, classes, interfaces, types, imports)
70
70
  9. **Optimized reindex** — full reindex skips redundant hash checks, batches graph writes (flush every 50 files), and skips per-file graph deletes when bulk-cleared
71
- 10. **Tool profiles** — five built-in profiles (`full`, `safe`, `research`, `minimal`, `discovery`) that control which subset of 82 tools are exposed, reducing token overhead for focused tasks
71
+ 10. **Tool profiles** — five built-in profiles (`full`, `safe`, `research`, `minimal`, `discovery`) that control which subset of 61 tools are exposed, reducing token overhead for focused tasks
72
72
  11. **Meta-tools** — `list_tools`, `describe_tool`, and `search_tools` for incremental tool discovery without loading full descriptions (~200 tokens vs ~3000)
73
- 12. **Pluggable flow system** — built-in `basic` and `advanced` development flows plus custom flow support with 10 flow management tools (`flow_list`, `flow_start`, `flow_step`, etc.)
73
+ 12. **Pluggable flow system** — built-in `basic` and `advanced` development flows plus custom flow support through unified `flow` actions (`list`, `start`, `step`, `status`, `read`, `runs`, `add`, `remove`, `update`, `reset`, `info`)
74
74
  13. **Session digest** — auto-capture session decisions, files touched, and checkpoint state for seamless agent handoffs
75
75
  14. **Middleware pipeline** — plugin hook system for extending tool execution with pre/post processing, logging, or custom validation
76
76
  15. **Pluggable memory providers** — adapter interface for curated knowledge storage, supporting filesystem (default) and custom backends
77
77
 
78
- The AI Kit auto-indexes configured source directories on startup, stores embeddings in a local LanceDB vector store, and exposes everything through 82 MCP tools, 47 CLI commands, and 2 resources.
78
+ The AI Kit auto-indexes configured source directories on startup, stores embeddings in a local LanceDB vector store, and exposes everything through 61 MCP tools, 47 CLI commands, and 2 resources.
79
79
 
80
80
  ---
81
81
 
@@ -203,7 +203,6 @@ Tools supporting `workspaces` param: `search`, `find`, `symbol`.
203
203
  | `aikit_eval` | `aikit eval` | Sandboxed JavaScript/TypeScript execution |
204
204
  | `aikit_check` | `aikit check` | Incremental typecheck + lint (`detail`: summary/errors/full) |
205
205
  | `aikit_test_run` | `aikit test` | Run tests with structured results |
206
- | `aikit_batch` | `aikit batch` | Parallel operation execution |
207
206
  | `aikit_audit` | `aikit audit` | Unified project audit: runs structure, deps, patterns, health, dead symbols, check, entry points in one call. Returns score, recommendations, and next steps. |
208
207
 
209
208
  ### Knowledge Management
@@ -235,7 +234,6 @@ Tools supporting `workspaces` param: `search`, `find`, `symbol`.
235
234
  | `aikit_measure` | — | Code complexity and line-count metrics |
236
235
  | `aikit_changelog` | — | Generate changelog from git history |
237
236
  | `aikit_schema_validate` | — | Validate JSON data against JSON Schema |
238
- | `aikit_snippet` | — | Persistent code snippet/template storage |
239
237
  | `aikit_env` | — | System and runtime environment info |
240
238
  | `aikit_time` | — | Date parsing, timezone conversion, duration math |
241
239
 
@@ -272,16 +270,7 @@ Tools supporting `workspaces` param: `search`, `find`, `symbol`.
272
270
  ### Flow Management
273
271
  | Tool | CLI | Description |
274
272
  |------|-----|-------------|
275
- | `aikit_flow_list` | `aikit flow list` | List installed flows and active flow |
276
- | `aikit_flow_info` | `aikit flow info` | Get detailed flow info including steps |
277
- | `aikit_flow_start` | `aikit flow start` | Start a named flow |
278
- | `aikit_flow_step` | `aikit flow step` | Advance: next, skip, or redo current step |
279
- | `aikit_flow_status` | `aikit flow status` | Check current execution state |
280
- | `aikit_flow_read_instruction` | `aikit flow read-instruction` | Read the instruction content for the current step |
281
- | `aikit_flow_reset` | `aikit flow reset` | Clear flow state to start over |
282
- | `aikit_flow_add` | `aikit flow add` | Install a custom flow |
283
- | `aikit_flow_remove` | `aikit flow remove` | Remove an installed flow |
284
- | `aikit_flow_update` | `aikit flow update` | Update flow definition or steps |
273
+ | `aikit_flow` | `aikit flow` | Manage flows list, start, navigate steps, read instructions, inspect runs, add/remove/update. Use `action` parameter. |
285
274
 
286
275
  ## MCP Integration
287
276
 
@@ -490,7 +479,7 @@ Available profiles: `full` (default), `safe`, `research`, `minimal`, `discovery`
490
479
  │ ├── chunker/ — tree-sitter + regex code chunking
491
480
  │ ├── indexer/ — incremental file indexer
492
481
  │ ├── analyzers/ — blast-radius, deps, symbols, patterns, diagrams
493
- │ ├── tools/ — 59 tool modules (82 MCP tools)
482
+ │ ├── tools/ — consolidated tool modules (61 MCP tools)
494
483
  │ ├── server/ — MCP protocol server
495
484
  │ └── cli/ — command-line interface
496
485
  ├── bin/aikit.mjs — CLI entry point
@@ -929,15 +918,6 @@ Runs incremental `tsc` and `biome` and returns structured error/warning lists.
929
918
 
930
919
  Returns structured pass/fail summary. `isError` set if any tests failed.
931
920
 
932
- #### `aikit_batch` — Execute multiple operations in parallel
933
-
934
- | Parameter | Type | Required | Default | Description |
935
- |-----------|------|----------|---------|-------------|
936
- | `operations` | object[] (min 1) | **yes** | — | Operations: `id` (string), `type` (`search`/`find`/`check`), `args` (record) |
937
- | `concurrency` | number (1–20) | no | `4` | Max concurrent operations |
938
-
939
- Returns per-operation outcomes (success/failure with results or errors).
940
-
941
921
  #### `aikit_audit` — Unified project audit
942
922
 
943
923
  Runs multiple analysis checks in a single call and returns a synthesized report with a composite score (0–100), per-check summaries, and prioritized recommendations.
@@ -1085,19 +1065,6 @@ Parses conventional commit format (type(scope): subject). Groups by feat/fix/ref
1085
1065
 
1086
1066
  Supports: type, required, properties, additionalProperties, items, enum, const, pattern, minimum/maximum, minLength/maxLength, minItems/maxItems.
1087
1067
 
1088
- #### `aikit_snippet` — Persistent code snippet storage
1089
-
1090
- | Parameter | Type | Required | Description |
1091
- |-----------|------|----------|-------------|
1092
- | `action` | enum | **yes** | `save`, `get`, `list`, `search`, `delete` |
1093
- | `name` | string | varies | Snippet name |
1094
- | `language` | string | no | Language tag |
1095
- | `code` | string | varies | Code content (for save) |
1096
- | `tags` | string[] | no | Categorization tags |
1097
- | `query` | string | varies | Search query (for search) |
1098
-
1099
- Stored as JSON in `.aikit-state/snippets/`. Searchable by name, tags, language, and content.
1100
-
1101
1068
  #### `aikit_env` — System environment info
1102
1069
 
1103
1070
  | Parameter | Type | Required | Default | Description |
@@ -1175,6 +1142,33 @@ Sequential task queues for agent operations.
1175
1142
 
1176
1143
  Shows the audit trail of recent tool invocations. Each entry includes tool name, duration, input/output summaries, and status. Useful for debugging agent behavior.
1177
1144
 
1145
+ ### Flow Management
1146
+
1147
+ #### `aikit_flow` — Manage development flows
1148
+
1149
+ | Parameter | Type | Required | Default | Description |
1150
+ |-----------|------|----------|---------|-------------|
1151
+ | `action` | string | **yes** | — | Operation: `list`, `info`, `start`, `step`, `status`, `read`, `reset`, `runs`, `add`, `remove`, `update` |
1152
+ | `name` | string | varies | — | Flow name (for `info`, `start`, `remove`, `update`) |
1153
+ | `topic` | string | no | — | Human-readable topic for the run (for `start`) |
1154
+ | `advance` | string | varies | — | Step action: `next`, `skip`, `redo` (for `step`) |
1155
+ | `step` | string | no | — | Step id to read (for `read`; defaults to current step) |
1156
+ | `source` | string | varies | — | Git URL, local path, or shorthand (for `add`) |
1157
+ | `roots` | string[] | no | — | Workspace roots for multi-root flows (for `start`) |
1158
+
1159
+ **Actions:**
1160
+ - `list` — List installed flows (builtin + custom)
1161
+ - `info` — Get detailed flow info including all steps
1162
+ - `start` — Start a named flow with a topic
1163
+ - `step` — Advance current step (next/skip/redo)
1164
+ - `status` — Check active flow state, current step, phase
1165
+ - `read` — Read instruction content for current or named step
1166
+ - `reset` — Clear flow state to start over
1167
+ - `runs` — List historical flow runs
1168
+ - `add` — Install a custom flow from source
1169
+ - `remove` — Remove an installed custom flow
1170
+ - `update` — Update flow definition
1171
+
1178
1172
  ---
1179
1173
 
1180
1174
  ## MCP Resources
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vpxa/aikit",
3
- "version": "0.1.108",
3
+ "version": "0.1.109",
4
4
  "type": "module",
5
5
  "description": "Local-first AI developer toolkit — knowledge base, code analysis, context management, and developer tools for LLM agents",
6
6
  "license": "MIT",
@@ -1704,568 +1704,7 @@ Notes:
1704
1704
  - Scripts auto-detect ADR directory and filename strategy.
1705
1705
  - Use \`--dir\` and \`--strategy\` to override.
1706
1706
  - Use \`--json\` to emit machine-readable output.
1707
- `}],aikit:[{file:`SKILL.md`,content:`---
1708
- name: aikit
1709
- description: "Use the @vpxa/aikit AI Kit MCP server for codebase search, analysis, and persistent memory. Load this skill when using aikit_search, aikit_analyze, aikit_knowledge, or any aikit_* tool. Covers all 82 MCP tools: search (hybrid/semantic/keyword), code analysis (analyze aspects for structure, dependencies, symbols, patterns, entry points, diagrams, plus blast radius), knowledge graph (auto-populated module/symbol/import graph with traversal), context management (worksets, stash, checkpoints, restore, lanes), code manipulation (rename, codemod, eval), knowledge management (knowledge actions: remember/read/update/forget/list), web access (fetch, search, http), FORGE protocol (ground, classify, evidence map, stratum cards, digest), brainstorming (interactive ideation sessions), presentation (rich dashboards via present tool), onboarding (full codebase analysis in one call), and developer utilities (regex, encode, measure, changelog, schema-validate, snippet, env, time)."
1710
- metadata:
1711
- category: cross-cutting
1712
- domain: general
1713
- applicability: always
1714
- inputs: [codebase]
1715
- outputs: [search-results, analysis, knowledge]
1716
- relatedSkills: [present]
1717
- ---
1718
-
1719
- # @vpxa/aikit — AI Kit
1720
-
1721
- Local-first AI developer toolkit — 82 MCP tools for search, analysis, context compression, FORGE quality gates, knowledge management, code manipulation, execution, web access, brainstorming, presentation, and developer utilities.
1722
-
1723
- ## When to Use
1724
-
1725
- - You need long-term memory across coding sessions
1726
- - You want to search a codebase semantically (by meaning, not just keywords)
1727
- - You need to compress large contexts to focus on what matters
1728
- - You want structured output from build tools (tsc, vitest, biome, git)
1729
- - You need to plan which files to read for a task
1730
- - You want to safely explore refactors in isolated lanes
1731
- - You need to rename symbols, apply codemods, or run code transformations
1732
- - You want to fetch and read web pages or search the web
1733
- - You need to make HTTP requests, test APIs, or debug endpoints
1734
- - You want to test regex patterns, encode/decode data, or validate JSON schemas
1735
- - You need code complexity metrics or a git changelog
1736
- - You want to save and reuse code snippets across sessions
1737
-
1738
- ## Skills Reference
1739
-
1740
- | Context | Skill | Load when |
1741
- |---------|-------|----------|
1742
- | Repository access recovery | \`repo-access\` | When encountering git auth failures, accessing private/enterprise repos, or when \`web_fetch\`/\`http\` returns auth errors on repository URLs. |
1743
-
1744
- ## Architecture
1745
-
1746
- 10-package monorepo published as a single npm package:
1747
-
1748
- \`\`\`
1749
- core → store → embeddings → chunker → indexer → analyzers → tools → server → cli → tui
1750
- \`\`\`
1751
-
1752
- - **MCP server**: 82 tools + 2 resources (via \`@modelcontextprotocol/sdk\`)
1753
- - **CLI**: 45 commands (thin dispatcher + 10 command groups)
1754
- - **Search**: Hybrid vector + keyword + RRF fusion
1755
- - **Embeddings**: ONNX local (mxbai-embed-large-v1, 1024 dimensions)
1756
- - **Vector store**: LanceDB (embedded, zero infrastructure)
1757
- - **Chunking**: Tree-sitter AST (TS/JS/Python/Go/Rust/Java) + regex fallback
1758
- - **TUI**: Ink/React dashboard for human monitoring (search, status, curated, activity log)
1759
-
1760
- ## Session Protocol (MANDATORY)
1761
-
1762
- ### Start (do ALL)
1763
- \`\`\`
1764
- flow({ action: 'status' }) # Check/resume active flow FIRST
1765
- # If flow active → flow({ action: 'read', step }) → follow step instructions
1766
- status({}) # Check AI Kit health + onboard state
1767
- # If onboard not run → onboard({ path: "." }) # First-time codebase analysis
1768
- flow({ action: 'list' }) # See available flows
1769
- # Select flow based on task → flow({ action: 'start', name: "<name>", topic: "<task>" }) # Start — creates .flows/{topic}/
1770
- knowledge({ action: "list" }) # See stored knowledge
1771
- search({ query: "SESSION CHECKPOINT", origin: "curated" }) # Resume prior work
1772
- \`\`\`
1773
-
1774
- ### During Session
1775
- \`\`\`
1776
- search → scope_map → symbol → trace (orient)
1777
- check → test_run (validate changes)
1778
- knowledge({ action: "remember", ... }) (capture insights)
1779
- \`\`\`
1780
-
1781
- ### End of Session
1782
- \`\`\`
1783
- session_digest({ persist: true }) # Auto-capture session activity
1784
- knowledge({ action: "remember", title: "Session checkpoint: <topic>", content: "<what was done, decisions made, next steps>", category: "conventions" })
1785
- \`\`\`
1786
-
1787
- ## Tool Catalog
1788
-
1789
- ### Search & Discovery (8)
1790
- | Tool | CLI | Purpose |
1791
- |------|-----|---------|
1792
- | \`search\` | \`aikit search\` | Hybrid/semantic/keyword search with \`search_mode\` param |
1793
- | \`find\` | \`aikit find\` | Federated search: vector + FTS + glob + regex in one call. Use \`mode: 'examples'\` to find usage examples. |
1794
- | \`symbol\` | \`aikit symbol\` | Resolve symbol definition, imports, and references |
1795
- | \`lookup\` | \`aikit lookup\` | Full-file retrieval by path or record ID |
1796
- | \`scope_map\` | \`aikit scope-map\` | Task-scoped reading plan with token estimates |
1797
- | \`trace\` | \`aikit trace\` | Forward/backward flow tracing through call chains |
1798
- | \`dead_symbols\` | \`aikit dead-symbols\` | Find exported symbols never imported — separates source (actionable) from docs (informational). Accepts \`path\` to scope the search. |
1799
- | \`file_summary\` | \`aikit summarize\` | Structural overview of a file (exports, imports, functions) |
1800
-
1801
- ### Code Analysis (2)
1802
- | Tool | CLI | Purpose |
1803
- |------|-----|---------|
1804
- | \`analyze\` | \`aikit analyze <aspect>\` | Unified analyzer for structure, dependencies, symbols, patterns, entry_points, and diagram aspects |
1805
- | \`blast_radius\` | \`aikit analyze blast-radius\` | Change impact analysis |
1806
-
1807
- ### Context Management (6)
1808
- | Tool | CLI | Purpose |
1809
- |------|-----|---------|
1810
- | \`compact\` | \`aikit compact\` | Compress text to relevant sections using embeddings (no LLM). Accepts \`path\` for server-side file read. |
1811
- | \`workset\` | \`aikit workset\` | Named file set management (save/load/add/remove) |
1812
- | \`stash\` | \`aikit stash\` | Named key-value store for session data |
1813
- | \`checkpoint\` | \`aikit checkpoint\` | Save/restore session checkpoints |
1814
- | \`restore\` | \`aikit restore\` | Restore a previously saved checkpoint |
1815
- | \`parse_output\` | \`aikit parse-output\` | Parse tsc/vitest/biome/git output → structured JSON |
1816
-
1817
- ### Code Manipulation (4)
1818
- | Tool | CLI | Purpose |
1819
- |------|-----|---------|
1820
- | \`rename\` | \`aikit rename\` | Smart whole-word symbol rename across files (dry-run supported) |
1821
- | \`codemod\` | \`aikit codemod\` | Regex-based code transformations with rules (dry-run supported) |
1822
- | \`diff_parse\` | \`aikit diff\` | Parse unified diff → structured changes |
1823
- | \`data_transform\` | \`aikit transform\` | JQ-like JSON transformations |
1824
-
1825
- ### Execution & Validation (4)
1826
- | Tool | CLI | Purpose |
1827
- |------|-----|---------|
1828
- | \`eval\` | \`aikit eval\` | Sandboxed JavaScript/TypeScript execution |
1829
- | \`check\` | \`aikit check\` | Incremental typecheck + lint. \`detail\` param: efficient (default, minimal), normal (parsed errors), full (includes raw) |
1830
- | \`test_run\` | \`aikit test\` | Run tests with structured pass/fail results |
1831
- | \`audit\` | \`aikit audit\` | Unified project audit: structure, deps, patterns, health, dead symbols, check, entry points → synthesized report with score and recommendations. 6 round-trips → 1. |
1832
-
1833
- ### Knowledge Management (2)
1834
- | Tool | CLI | Purpose |
1835
- |------|-----|---------|
1836
- | \`knowledge\` | \`aikit knowledge <action>\` | Unified knowledge tool for remember, read, update, forget, and list actions |
1837
- | \`produce_knowledge\` | — | Auto-generate knowledge from analysis |
1838
-
1839
- ### Auto-Knowledge (automatic)
1840
-
1841
- Tool outputs are automatically analyzed after every call. Useful facts (conventions, test patterns, build commands, errors) are extracted and stored as curated entries. Quality gate (score >= 0.3), deduplication, TTL for transient facts, max 50/session.
1842
-
1843
- Search auto-knowledge with: \`search({ query: "...", origin: "curated" })\` or \`knowledge({ action: "list", category: "conventions" })\`
1844
-
1845
- ### Verified Lanes (1 tool, 6 actions)
1846
- | Tool | CLI | Purpose |
1847
- |------|-----|---------|
1848
- | \`lane\` | \`aikit lane\` | Manage isolated file copies for parallel exploration |
1849
-
1850
- Lane actions: \`create\` (copy files to lane), \`list\`, \`status\` (modified/added/deleted), \`diff\` (line-level diff), \`merge\` (apply back to originals), \`discard\`.
1851
-
1852
- ### Git & Environment (4)
1853
- | Tool | CLI | Purpose |
1854
- |------|-----|---------|
1855
- | \`git_context\` | \`aikit git\` | Branch, status, recent commits |
1856
- | \`process\` | \`aikit proc\` | Process supervisor (start/stop/logs) |
1857
- | \`watch\` | \`aikit watch\` | Filesystem watcher |
1858
- | \`delegate\` | \`aikit delegate\` | Delegate subtask to local Ollama model |
1859
-
1860
- ### Web & Network (3)
1861
- | Tool | CLI | Purpose |
1862
- |------|-----|---------|
1863
- | \`web_fetch\` | — | Fetch web page → markdown/raw/links/outline for LLM consumption |
1864
- | \`web_search\` | — | Search the web via DuckDuckGo (no API key needed) |
1865
- | \`http\` | — | Make HTTP requests for API testing/debugging |
1866
-
1867
- ### Developer Utilities (7)
1868
- | Tool | CLI | Purpose |
1869
- |------|-----|---------|
1870
- | \`regex_test\` | — | Test regex patterns with match/replace/split modes |
1871
- | \`encode\` | — | Base64, URL, SHA-256, MD5, hex encode/decode, JWT decode |
1872
- | \`measure\` | — | Code complexity metrics (cyclomatic, cognitive complexity, lines, functions) |
1873
- | \`changelog\` | — | Generate changelog from git history (conventional commits) |
1874
- | \`schema_validate\` | — | Validate JSON data against JSON Schema |
1875
- | \`env\` | — | System and runtime environment info (sensitive values redacted) |
1876
- | \`time\` | — | Date parsing, timezone conversion, duration math |
1877
-
1878
- ### FORGE Quality Gates (5)
1879
- | Tool | CLI | Purpose |
1880
- |------|-----|---------|
1881
- | \`forge_ground\` | — | Full Ground phase: classify tier, scope map, unknowns, constraints |
1882
- | \`forge_classify\` | — | Quick tier classification (Floor/Standard/Critical) |
1883
- | \`evidence_map\` | — | CRUD + Gate evaluation for verified/assumed/unknown claims. Safety gate tags (\`provenance\`/\`commitment\`/\`coverage\`) enable mandatory pre-YIELD checks |
1884
- | \`stratum_card\` | — | Generate T1/T2 compressed context cards from files (10-100x token reduction) |
1885
- | \`digest\` | — | Compress N text sources into token-budgeted summary |
1886
-
1887
- ### System (9)
1888
- | Tool | CLI | Purpose |
1889
- |------|-----|---------|
1890
- | \`config\` | \`aikit config\` | View or update project configuration (kb.config.json) |
1891
- | \`status\` | \`aikit status\` | Index statistics |
1892
- | \`reindex\` | \`aikit reindex\` | Rebuild index |
1893
- | \`health\` | \`aikit health\` | Project health checks (package.json, tsconfig, lockfile, circular deps) |
1894
- | \`guide\` | \`aikit guide\` | Tool discovery — given a goal, recommends tools and workflow order |
1895
- | \`onboard\` | \`aikit onboard\` | Full codebase onboarding in one call (structure + deps + patterns + knowledge) |
1896
- | \`graph\` | \`aikit graph\` | Query the auto-populated knowledge graph (modules, symbols, imports) |
1897
- | \`queue\` | \`aikit queue\` | Task queue for sequential agent operations (create/push/next/done/fail) |
1898
- | \`replay\` | \`aikit replay\` | View or clear the audit trail of tool invocations (action: list/clear) |
1899
-
1900
- ### Flows (1)
1901
- | Tool | CLI | Purpose |
1902
- |------|-----|---------|
1903
- | \`flow\` | \`aikit flow <action>\` | Manage flows — list, inspect, start, navigate steps, read instructions, inspect runs, and add/remove/update custom flows. |
1904
-
1905
- ### Presentation (1)
1906
- | Tool | CLI | Purpose |
1907
- |------|-----|---------|
1908
- | \`present\` | — | Rich dashboards, charts, tables, timelines. Use \`format: "browser"\` then \`openBrowserPage\` to display. **In CLI mode (no VS Code chat), always use \`format: "browser"\`** — \`html\` UIResource is invisible in terminal. |
1909
-
1910
- ### Meta-Tools — Tool Discovery (3)
1911
- | Tool | CLI | Purpose |
1912
- |------|-----|---------|
1913
- | \`list_tools\` | — | List all active AI Kit tools with names, titles, and categories. Accepts optional \`category\` filter. Use for initial tool discovery. |
1914
- | \`describe_tool\` | — | Get detailed metadata for a specific tool (title, categories, annotations). Use after \`list_tools\` to understand a tool before calling it. |
1915
- | \`search_tools\` | — | Search active tools by keyword across names, titles, and categories. Use when you know what you need but not the tool name. |
1916
-
1917
- ### Session Management (1)
1918
- | Tool | CLI | Purpose |
1919
- |------|-----|---------|
1920
- | \`session_digest\` | — | Generate a compressed digest of session activity (replay log, stash, checkpoints). Options: \`scope\` (tools/stash/all), \`since\`, \`last\`, \`focus\`, \`mode\` (deterministic/sampling), \`tokenBudget\`, \`persist\`. Use at session end for handoff or mid-session to review what happened. |
1921
-
1922
- ## Flow System
1923
-
1924
- Flows are multi-step guided workflows that structure complex tasks. Each step has a skill file with detailed instructions, required artifacts, and agent assignments.
1925
-
1926
- ### Built-in Flows
1927
-
1928
- | Flow | Steps | Use When |
1929
- |------|-------|----------|
1930
- | \`aikit:basic\` | assess → implement → verify | Bug fixes, config changes, small features |
1931
- | \`aikit:advanced\` | spec → plan → task → execute → verify | New modules, cross-service changes, architectural work |
1932
-
1933
- ### Flow Lifecycle
1934
-
1935
- \`\`\`text
1936
- flow({ action: 'list' }) # See available flows
1937
- flow({ action: 'info', name: 'aikit:basic' }) # View steps, skills, agents
1938
- flow({ action: 'start', name: 'aikit:basic', topic: 'Fix login bug' }) # Start — creates .flows/fix-login-bug/
1939
- flow({ action: 'read' }) # Read current step's instructions ({{artifacts_path}} resolved)
1940
- # ... do the work described in the instruction ...
1941
- flow({ action: 'step', advance: 'next' }) # Advance to next step
1942
- flow({ action: 'step', advance: 'skip' }) # Skip current step
1943
- flow({ action: 'step', advance: 'redo' }) # Redo current step
1944
- flow({ action: 'status' }) # Check progress (includes slug, runDir, artifactsPath, phase, isEpilogue)
1945
- flow({ action: 'reset' }) # Abandon active flow
1946
- flow({ action: 'runs' }) # List all runs (current + past)
1947
- # Epilogue steps (mandatory, injected after every flow):
1948
- # After last flow step → _docs-sync epilogue runs automatically
1949
- # flow({ action: 'status' }) shows phase: 'after', isEpilogue: true during epilogue
1950
- \`\`\`
1951
-
1952
- Custom flow lifecycle management:
1953
-
1954
- \`\`\`text
1955
- flow({ action: 'add', source: '.github/flows/my-flow' })
1956
- flow({ action: 'update', name: 'my-flow' })
1957
- flow({ action: 'remove', name: 'my-flow' })
1958
- \`\`\`
1959
-
1960
- ## CRITICAL: Use AI Kit Tools Instead of Native IDE Tools
1961
-
1962
- AI Kit tools provide **10x richer output** than native IDE tools — with AST-analyzed call graphs, scope context, import classification, and cognitive complexity. **You MUST use AI Kit tools instead of native read/search tools.**
1963
-
1964
- ### ⛔ PROHIBITED: Native File Reading
1965
-
1966
- **\`read_file\` / \`read_file_raw\` MUST NOT be used to understand code.** They waste tokens and miss structural information.
1967
-
1968
- The **ONLY** acceptable use of \`read_file\`: getting exact lines immediately before an edit (to verify the \`old_str\` for replacement). Even then, use \`file_summary\` first to identify which lines to read.
1969
-
1970
- ### Tool Replacement Table
1971
-
1972
- | ❌ NEVER do this | ✅ Use AI Kit Tool | Why |
1973
- |---|---|---|
1974
- | \`read_file\` (full file) | \`file_summary\` | Exports, imports, call edges — **10x fewer tokens** |
1975
- | \`read_file\` (specific section) | \`compact({ path, query })\` | Server-side read + extract — **5-20x reduction** |
1976
- | \`grep_search\` / \`textSearch\` | \`search\` | Semantic + keyword hybrid across all indexed content |
1977
- | \`grep_search\` for a symbol | \`symbol\` | Definition + references **with scope context** |
1978
- | Multiple \`read_file\` calls | \`digest\` | Compresses multiple sources into token-budgeted summary |
1979
- | \`listDirectory\` + \`read_file\` | \`scope_map\` | Identifies relevant files for a task automatically |
1980
- | Manual code tracing | \`trace\` | AST call-graph traversal with scope context |
1981
- | Line counting / \`wc\` | \`measure\` | Lines, complexity, **cognitive complexity**, functions |
1982
- | Grep for unused exports | \`dead_symbols\` | AST-powered export detection with regex fallback |
1983
- | Repeated file reads | \`stratum_card\` | Reusable compressed context — **10-100x reduction** |
1984
- | \`fetch_webpage\` | \`web_fetch\` | Readability extract + token budget — richer output |
1985
- | Web research / browsing | \`web_search\` | Structured web results without browser — **unique to KB** |
1986
-
1987
- ### Decision Tree — How to Read Code
1988
-
1989
- \`\`\`
1990
- Need to understand a file?
1991
- ├─ Just structure? → file_summary (exports, imports, call edges — ~50 tokens)
1992
- ├─ Specific section? → compact({ path, query }) — 5-20x reduction
1993
- ├─ Multiple files? → digest (multi-source compression — token-budgeted)
1994
- ├─ Repeated reference? → stratum_card (T1/T2 card — 10-100x reduction)
1995
- ├─ Need exact lines to EDIT? → read_file (the ONLY acceptable use)
1996
- └─ "I want to read the whole file" → ⛔ STOP. Use file_summary or compact instead.
1997
- \`\`\`
1998
-
1999
- ### Decision Tree — Need Structural Relationships?
2000
-
2001
- When vector search and file reads don't answer the question (e.g. "who imports this?",
2002
- "what does this depend on?", "how are these files connected?"), use \`graph\`:
2003
-
2004
- \`\`\`
2005
- Need to understand relationships between code?
2006
- ├─ Who imports / calls this? → graph({action:'find_nodes', name_pattern}) → graph({action:'neighbors', node_id, direction:'incoming'})
2007
- ├─ What does this depend on? → graph({action:'neighbors', node_id, direction:'outgoing'})
2008
- ├─ Full context for a symbol? → graph({action:'symbol360', name})
2009
- ├─ Related files within N hops? → graph({action:'traverse', node_id, max_depth:2})
2010
- ├─ Layer/module isolation check? → graph({action:'depth_traverse', node_id, max_depth:3})
2011
- └─ Graph size/health? → graph({action:'stats'})
2012
- \`\`\`
2013
-
2014
- **Use this BEFORE** reaching for \`analyze({ aspect: "dependencies", ... })\` (slower, less precise) or manually
2015
- tracing via \`symbol\` + \`trace\` chains. The graph is auto-populated during indexing.
2016
-
2017
- ### What AI Kit Tools Return (AST-Enhanced)
2018
-
2019
- These tools use Tree-sitter WASM to analyze source code at the AST level, providing structured data that raw file reads cannot:
2020
-
2021
- | Tool | Rich Output |
2022
- |------|-------------|
2023
- | \`file_summary\` | Imports classified as **external vs internal** (\`isExternal\` flag). **Call edges** between functions (e.g., \`handleRequest() → validateInput() @ line 42\`). \`exported\` flag on interfaces and types. Import count breakdown. |
2024
- | \`symbol\` | References include **scope** — which function/class/method contains each usage (e.g., \`referenced in processOrder() at auth-service.ts:55\`). |
2025
- | \`trace\` | **Call-graph edges** discovered via AST syntax tree, not text matching. Supports forward (who does X call?) and backward (who calls X?) tracing. Scope context on each node. |
2026
- | \`measure\` | **Cognitive complexity** — weights nesting depth (nested \`if\` inside \`for\` inside \`try\` scores higher). More useful than cyclomatic complexity for understanding code difficulty. |
2027
- | \`dead_symbols\` | **AST export enumeration** — catches \`export default\`, barrel re-exports (\`export { x } from\`), \`export =\`, and \`export type\`. Regex fallback for non-AST-supported languages. |
2028
-
2029
- ### Example: \`file_summary\` Output
2030
-
2031
- \`\`\`
2032
- src/auth-service.ts
2033
- Language: typescript | Lines: 180 | Estimated tokens: ~1400
2034
-
2035
- Imports (6): 3 external, 3 internal
2036
- - import { hash } from 'bcrypt' [external]
2037
- - import { UserRepo } from './user-repo' [internal]
2038
-
2039
- Functions (4):
2040
- - authenticate @ line 22 [exported]
2041
- - validateToken @ line 55 [exported]
2042
- - hashPassword @ line 90
2043
- - generateJwt @ line 110
2044
-
2045
- Call edges (12 intra-file):
2046
- - authenticate() → hashPassword() @ line 35
2047
- - authenticate() → generateJwt() @ line 42
2048
- - validateToken() → UserRepo.findById() @ line 68
2049
-
2050
- Interfaces (2):
2051
- - AuthResult @ line 8 [exported]
2052
- - TokenPayload @ line 14
2053
- \`\`\`
2054
-
2055
- Compare: \`read_file\` would cost ~1400 tokens for raw text. \`file_summary\` gives structured data in ~120 tokens — **12x reduction** with richer information.
2056
-
2057
- ## Token Efficiency
2058
-
2059
- \`config.tokenBudget\` controls output verbosity globally:
2060
-
2061
- | Level | Output | Compression | Context Strategy |
2062
- |-------|--------|-------------|------------------|
2063
- | \`efficient\` (default) | Minimal output, score + top issues only | threshold 2000, budget 1000 | \`stratum_card(T1)\` |
2064
- | \`normal\` | Standard output with parsed errors/pattern names | threshold 4000, budget 2000 | \`compact()\` |
2065
- | \`full\` | Maximum detail with raw output/full tables | No compression | \`digest()\` |
2066
-
2067
- Set via: \`config({ action: 'update', updates: { tokenBudget: 'normal' } })\`
2068
-
2069
- Tools with \`detail\` param inherit from \`config.tokenBudget\` when not explicitly set.
2070
- Compression middleware applies to ALL tool responses automatically.
2071
-
2072
- ## Search Strategy
2073
-
2074
- 1. **Start broad**: \`search({ query: "topic", search_mode: "hybrid" })\`
2075
- 2. **Narrow**: Add \`content_type\`, \`origin\`, or \`category\` filters
2076
- 3. **Exact match**: Use \`search_mode: "keyword"\` for identifiers
2077
- 4. **Federated**: Use \`find\` to combine vector + glob + regex
2078
-
2079
- ## Workflow Chains
2080
-
2081
- ### Codebase Onboarding
2082
- \`\`\`
2083
- analyze({ aspect: "structure", path: "src/" })
2084
- → analyze({ aspect: "dependencies", path: "src/" })
2085
- → analyze({ aspect: "entry_points", path: "src/" })
2086
- → produce_knowledge({ path: "src/" })
2087
- → knowledge({ action: "remember", title: "Codebase onboarding complete", ... })
2088
- \`\`\`
2089
-
2090
- ### Planning a Task
2091
- \`\`\`
2092
- scope_map({ task: "implement user auth" })
2093
- → compact({ path: "src/auth.ts", query: "auth flow" })
2094
- → workset({ action: "save", name: "auth-task", files: [...] })
2095
- \`\`\`
2096
-
2097
- ### Bug Investigation
2098
- \`\`\`
2099
- parse_output({ output: <error> }) → symbol({ name: "failingFn" })
2100
- → trace({ symbol: "failingFn", direction: "backward" })
2101
- → blast_radius({ changed_files: ["suspect.ts"] })
2102
- → eval({ code: "hypothesis test" }) → check({ files: ["suspect.ts"] })
2103
- \`\`\`
2104
-
2105
- ### Multi-Task Orchestration (DAG Queue)
2106
- \`\`\`
2107
- queue({ action: "create", name: "my-tasks" })
2108
- → queue({ action: "push", name: "my-tasks", title: "Task 1", data: { deps: [] } })
2109
- → queue({ action: "push", name: "my-tasks", title: "Task 2", data: { deps: ["task-1-id"] } })
2110
- → queue({ action: "next", name: "my-tasks" }) # Gets next ready task
2111
- → [do work]
2112
- → queue({ action: "done", name: "my-tasks", id: "<id>" })
2113
- \`\`\`
2114
-
2115
- ### Safe Refactor with Lanes
2116
- \`\`\`
2117
- scope_map({ task: "rename UserService" })
2118
- → lane({ action: "create", name: "refactor", files: [...] })
2119
- → [make changes in lane files]
2120
- → lane({ action: "diff", name: "refactor" })
2121
- → check({}) → test_run({})
2122
- → lane({ action: "merge", name: "refactor" })
2123
- \`\`\`
2124
-
2125
- ### Lane — isolated read-only exploration
2126
-
2127
- \`lane({ action:'create', name })\` creates an isolated copy of the workspace. Use to try approach A vs B WITHOUT touching canonical source. Other actions: \`list\`, \`diff\`, \`delete\`. Compare with \`lane({ action:'diff', names:['a','b'] })\`. Do NOT use \`lane\` for actual refactors — use \`checkpoint\` instead (\`checkpoint\` = reversible on canonical source; \`lane\` = isolated copies for comparison).
2128
-
2129
- ### After Making Changes
2130
- \`\`\`
2131
- blast_radius({ changed_files: ["src/auth.ts"] })
2132
- → check({}) → test_run({ grep: "auth" })
2133
- → reindex()
2134
- → knowledge({ action: "remember", title: "Implemented auth", content: "..." })
2135
- \`\`\`
2136
-
2137
- ### Pre-Commit Validation
2138
- \`\`\`
2139
- git_context({ diff: true })
2140
- → diff_parse({ diff: <staged diff> })
2141
- → blast_radius({ changed_files: [...] })
2142
- → check({}) → test_run({})
2143
- \`\`\`
2144
-
2145
- ---
2146
-
2147
- ## Persistent Memory
2148
-
2149
- | Action | Tool | Category |
2150
- |--------|------|----------|
2151
- | Store | \`knowledge({ action: "remember", title, content, category })\` | conventions, decisions, patterns, context, session |
2152
- | Search | \`search({ query, origin: "curated" })\` | — |
2153
- | Browse | \`knowledge({ action: "list" })\` or \`knowledge({ action: "list", category })\` | — |
2154
- | Read | \`knowledge({ action: "read", id })\` | — |
2155
- | Update | \`knowledge({ action: "update", id, content })\` | — |
2156
- | Remove | \`knowledge({ action: "forget", id })\` | — |
2157
-
2158
- **Session checkpoint** (end of session): \`knowledge({ action: "remember", title: "Session checkpoint: <topic>", content: "Done/Decisions/Next/Blockers", category: "session" })\`
2159
-
2160
- ## CLI Quick Reference
2161
-
2162
- \`\`\`bash
2163
- aikit init # Scaffold AI Kit in current directory
2164
- aikit init --force # Overwrite all scaffold/skill files
2165
- aikit init --guide # JSON report of stale files for LLM-driven updates
2166
- aikit serve # Start MCP server (stdio or HTTP)
2167
- aikit search <q> # Hybrid search
2168
- aikit find <q> # Federated search
2169
- aikit symbol <name> # Resolve symbol
2170
- aikit scope-map <t> # Task reading plan
2171
- aikit compact <q> # Context compression (--path file or stdin)
2172
- aikit check # Typecheck + lint (--detail efficient|normal|full)
2173
- aikit test # Run tests
2174
- aikit rename <old> <new> <path> # Rename symbol
2175
- aikit lane create <name> --files f1,f2 # Create lane
2176
- aikit lane diff <name> # View lane changes
2177
- aikit lane merge <name> # Merge lane back
2178
- aikit status # Index stats
2179
- aikit reindex # Rebuild index
2180
- \`\`\`
2181
-
2182
- ## Configuration
2183
-
2184
- \`kb.config.json\` in project root:
2185
- \`\`\`json
2186
- {
2187
- "sources": [{ "path": ".", "excludePatterns": ["node_modules/**", "**/node_modules/**", "dist/**", "coverage/**", ".aikit-data/**"] }],
2188
- "indexing": { "chunkSize": 1500, "chunkOverlap": 200, "minChunkSize": 100, "concurrency": 5 },
2189
- "embedding": { "model": "mixedbread-ai/mxbai-embed-large-v1", "dimensions": 1024 },
2190
- "store": { "backend": "lancedb", "path": ".aikit-data" },
2191
- "curated": { "path": "curated", "adapter": "filesystem" }
2192
- }
2193
- \`\`\`
2194
-
2195
- ## Tool Profiles
2196
-
2197
- Tool profiles control which subset of the 82 tools are active. Profiles reduce token overhead by exposing only relevant tools for a given task.
2198
-
2199
- ### Built-in Profiles
2200
-
2201
- | Profile | Description | Use When |
2202
- |---------|-------------|----------|
2203
- | \`full\` | All tools enabled (default) | General development, orchestration |
2204
- | \`safe\` | Read-only tools — no file/state modifications | Code review, analysis, research |
2205
- | \`research\` | Search, analysis, knowledge, web access | Investigation, documentation |
2206
- | \`minimal\` | Essential tools only — search, check, test | Simple tasks, low-token budgets |
2207
- | \`discovery\` | Full toolset + meta-tools for guided exploration | New users, onboarding, tool learning |
2208
-
2209
- ### Activating a Profile
2210
-
2211
- Set \`toolProfile\` in \`kb.config.json\`:
2212
-
2213
- \`\`\`json
2214
- {
2215
- "toolProfile": "research"
2216
- }
2217
- \`\`\`
2218
-
2219
- Base tools (\`status\`, \`config\`, \`guide\`, \`health\`) are **always available** regardless of profile.
2220
-
2221
- ## Development (Self-Dogfooding)
2222
-
2223
- When developing @vpxa/aikit itself: always \`pnpm build\` before using CLI/server (runs from \`dist/\`), always \`reindex\` after structural code changes, and don't run CLI and HTTP server simultaneously (LanceDB is single-process).
2224
-
2225
- ---
2226
-
2227
- ## Flows
2228
-
2229
- Flows are structured multi-step workflows that guide agents through complex tasks. They are the **primary workflow system** — use them instead of ad-hoc planning when a matching flow exists.
2230
-
2231
- ### Flow Tools
2232
-
2233
- | Tool | Purpose |
2234
- |------|---------|
2235
- | \`flow\` | Manage flow state and lifecycle actions — status, list, info, start, step, read, reset, add, update, and remove. Use the \`action\` parameter. |
2236
-
2237
- ### Flow Selection
2238
-
2239
- | Task Type | Flow | Why |
2240
- |-----------|------|-----|
2241
- | Bug fix, config change, small refactor | \`aikit:basic\` | Known scope, low risk |
2242
- | New feature in existing module | \`aikit:basic\` | Clear boundaries |
2243
- | New system/service/module | \`aikit:advanced\` | Needs spec + planning |
2244
- | Cross-service changes | \`aikit:advanced\` | Multiple boundaries |
2245
- | Architectural change | \`aikit:advanced\` | High impact |
2246
- | Unclear scope or exploratory | No flow | Use agent's native workflow |
2247
-
2248
- ### Flow Lifecycle
2249
-
2250
- 1. **Start**: \`flow({ action: 'list' })\` → choose flow → \`flow({ action: 'start', name: "<name>", topic: "<task>" })\`
2251
- 2. **Each step**: \`flow({ action: 'read', step: "<name>" })\` → follow step instructions → complete work
2252
- 3. **Advance**: \`flow({ action: 'step', advance: 'next' })\` → repeat from step 2
2253
- 4. **Epilogue**: After last flow step, mandatory epilogue steps run (e.g., \`_docs-sync\` updates \`docs/\`)
2254
- 5. **Resume**: \`flow({ action: 'status' })\` → if active, \`flow({ action: 'read' })\` for current step → continue
2255
- 6. **Reset**: \`flow({ action: 'reset' })\` if you need to start over
2256
-
2257
- ---
2258
-
2259
- ## Reference Documentation
2260
-
2261
- For detailed patterns on specific topics, load these reference files:
2262
-
2263
- | Topic | File | When to load |
2264
- |-------|------|-------------|
2265
- | Multi-task orchestration | \`references/coordination.md\` | Queue, DAG, lanes, worksets, stash, checkpoints |
2266
- | Quality gates (FORGE) | \`references/forge-protocol.md\` | Complex tasks, evidence maps, tier classification |
2267
- | Search & relationships | \`references/search-patterns.md\` | Finding code, tracing data flow, graph traversal |
2268
- `},{file:`references/coordination.md`,content:`# Coordination & Multi-Task Orchestration
1707
+ `}],aikit:[{file:`SKILL.md`,content:'---\nname: aikit\ndescription: "Use the @vpxa/aikit AI Kit MCP server for codebase search, analysis, and persistent memory. Load this skill when using aikit_search, aikit_analyze, aikit_knowledge, or any aikit_* tool. Covers all 61 MCP tools: search (hybrid/semantic/keyword), code analysis (analyze aspects for structure, dependencies, symbols, patterns, entry points, diagrams, plus blast radius), knowledge graph (auto-populated module/symbol/import graph with traversal), context management (worksets, stash, checkpoints, restore, lanes), code manipulation (rename, codemod, eval), execution and validation (check, test_run, audit), knowledge management (knowledge actions: remember/read/update/forget/list), web access (fetch, search, http), FORGE protocol (ground, classify, evidence map, stratum cards, digest), flow management (list, start, navigate steps, read instructions, inspect runs, add/remove/update flows), presentation (rich dashboards via present tool), onboarding (full codebase analysis in one call), meta-tools (tool discovery and descriptions), and developer utilities (regex, encode, measure, changelog, schema-validate, env, time)."\nmetadata:\n category: cross-cutting\n domain: general\n applicability: always\n inputs: [codebase]\n outputs: [search-results, analysis, knowledge]\n relatedSkills: [present]\n---\n\n# @vpxa/aikit — AI Kit\n\nLocal-first AI developer toolkit — 61 MCP tools for search, analysis, context compression, FORGE quality gates, knowledge management, code manipulation, execution, web access, flow management, presentation, meta-tool discovery, and developer utilities.\n\n## When to Use\n\n- You need long-term memory across coding sessions\n- You want to search a codebase semantically (by meaning, not just keywords)\n- You need to compress large contexts to focus on what matters\n- You want structured output from build tools (tsc, vitest, biome, git)\n- You need to plan which files to read for a task\n- You want to safely explore refactors in isolated lanes\n- You need to rename symbols, apply codemods, or run code transformations\n- You want to fetch and read web pages or search the web\n- You need to make HTTP requests, test APIs, or debug endpoints\n- You want to test regex patterns, encode/decode data, or validate JSON schemas\n- You need code complexity metrics or a git changelog\n\n## Skills Reference\n\n| Context | Skill | Load when |\n|---------|-------|----------|\n| Repository access recovery | `repo-access` | When encountering git auth failures, accessing private/enterprise repos, or when `web_fetch`/`http` returns auth errors on repository URLs. |\n\n## Architecture\n\n10-package monorepo published as a single npm package:\n\n```\ncore → store → embeddings → chunker → indexer → analyzers → tools → server → cli → tui\n```\n\n- **MCP server**: 61 tools + 2 resources (via `@modelcontextprotocol/sdk`)\n- **CLI**: 45 commands (thin dispatcher + 10 command groups)\n- **Search**: Hybrid vector + keyword + RRF fusion\n- **Embeddings**: ONNX local (mxbai-embed-large-v1, 1024 dimensions)\n- **Vector store**: LanceDB (embedded, zero infrastructure)\n- **Chunking**: Tree-sitter AST (TS/JS/Python/Go/Rust/Java) + regex fallback\n- **TUI**: Ink/React dashboard for human monitoring (search, status, curated, activity log)\n\n## Session Protocol (MANDATORY)\n\n### Start (do ALL)\n```\nflow({ action: \'status\' }) # Check/resume active flow FIRST\n# If flow active → flow({ action: \'read\', step }) → follow step instructions\nstatus({}) # Check AI Kit health + onboard state\n# If onboard not run → onboard({ path: "." }) # First-time codebase analysis\nflow({ action: \'list\' }) # See available flows\n# Select flow based on task → flow({ action: \'start\', name: "<name>", topic: "<task>" }) # Start — creates .flows/{topic}/\nknowledge({ action: "list" }) # See stored knowledge\nsearch({ query: "SESSION CHECKPOINT", origin: "curated" }) # Resume prior work\n```\n\n### During Session\n```\nsearch → scope_map → symbol → trace (orient)\ncheck → test_run (validate changes)\nknowledge({ action: "remember", ... }) (capture insights)\n```\n\n### End of Session\n```\nsession_digest({ persist: true }) # Auto-capture session activity\nknowledge({ action: "remember", title: "Session checkpoint: <topic>", content: "<what was done, decisions made, next steps>", category: "conventions" })\n```\n\n## Tool Catalog\n\n### Search & Discovery (8)\n| Tool | CLI | Purpose |\n|------|-----|---------|\n| `search` | `aikit search` | Hybrid/semantic/keyword search with `search_mode` param |\n| `find` | `aikit find` | Federated search: vector + FTS + glob + regex in one call. Use `mode: \'examples\'` to find usage examples. |\n| `symbol` | `aikit symbol` | Resolve symbol definition, imports, and references |\n| `lookup` | `aikit lookup` | Full-file retrieval by path or record ID |\n| `scope_map` | `aikit scope-map` | Task-scoped reading plan with token estimates |\n| `trace` | `aikit trace` | Forward/backward flow tracing through call chains |\n| `dead_symbols` | `aikit dead-symbols` | Find exported symbols never imported — separates source (actionable) from docs (informational). Accepts `path` to scope the search. |\n| `file_summary` | `aikit summarize` | Structural overview of a file (exports, imports, functions) |\n\n### Code Analysis (2)\n| Tool | CLI | Purpose |\n|------|-----|---------|\n| `analyze` | `aikit analyze <aspect>` | Unified analyzer for structure, dependencies, symbols, patterns, entry_points, and diagram aspects |\n| `blast_radius` | `aikit analyze blast-radius` | Change impact analysis |\n\n### Context Management (6)\n| Tool | CLI | Purpose |\n|------|-----|---------|\n| `compact` | `aikit compact` | Compress text to relevant sections using embeddings (no LLM). Accepts `path` for server-side file read. |\n| `workset` | `aikit workset` | Named file set management (save/load/add/remove) |\n| `stash` | `aikit stash` | Named key-value store for session data |\n| `checkpoint` | `aikit checkpoint` | Save/restore session checkpoints |\n| `restore` | `aikit restore` | Restore a previously saved checkpoint |\n| `parse_output` | `aikit parse-output` | Parse tsc/vitest/biome/git output → structured JSON |\n\n### Code Manipulation (4)\n| Tool | CLI | Purpose |\n|------|-----|---------|\n| `rename` | `aikit rename` | Smart whole-word symbol rename across files (dry-run supported) |\n| `codemod` | `aikit codemod` | Regex-based code transformations with rules (dry-run supported) |\n| `diff_parse` | `aikit diff` | Parse unified diff → structured changes |\n| `data_transform` | `aikit transform` | JQ-like JSON transformations |\n\n### Execution & Validation (4)\n| Tool | CLI | Purpose |\n|------|-----|---------|\n| `eval` | `aikit eval` | Sandboxed JavaScript/TypeScript execution |\n| `check` | `aikit check` | Incremental typecheck + lint. `detail` param: efficient (default, minimal), normal (parsed errors), full (includes raw) |\n| `test_run` | `aikit test` | Run tests with structured pass/fail results |\n| `audit` | `aikit audit` | Unified project audit: structure, deps, patterns, health, dead symbols, check, entry points → synthesized report with score and recommendations. 6 round-trips → 1. |\n\n### Knowledge Management (2)\n| Tool | CLI | Purpose |\n|------|-----|---------|\n| `knowledge` | `aikit knowledge <action>` | Unified knowledge tool for remember, read, update, forget, and list actions |\n| `produce_knowledge` | — | Auto-generate knowledge from analysis |\n\n### Auto-Knowledge (automatic)\n\nTool outputs are automatically analyzed after every call. Useful facts (conventions, test patterns, build commands, errors) are extracted and stored as curated entries. Quality gate (score >= 0.3), deduplication, TTL for transient facts, max 50/session.\n\nSearch auto-knowledge with: `search({ query: "...", origin: "curated" })` or `knowledge({ action: "list", category: "conventions" })`\n\n### Verified Lanes (1 tool, 6 actions)\n| Tool | CLI | Purpose |\n|------|-----|---------|\n| `lane` | `aikit lane` | Manage isolated file copies for parallel exploration |\n\nLane actions: `create` (copy files to lane), `list`, `status` (modified/added/deleted), `diff` (line-level diff), `merge` (apply back to originals), `discard`.\n\n### Git & Environment (4)\n| Tool | CLI | Purpose |\n|------|-----|---------|\n| `git_context` | `aikit git` | Branch, status, recent commits |\n| `process` | `aikit proc` | Process supervisor (start/stop/logs) |\n| `watch` | `aikit watch` | Filesystem watcher |\n| `delegate` | `aikit delegate` | Delegate subtask to local Ollama model |\n\n### Web & Network (3)\n| Tool | CLI | Purpose |\n|------|-----|---------|\n| `web_fetch` | — | Fetch web page → markdown/raw/links/outline for LLM consumption |\n| `web_search` | — | Search the web via DuckDuckGo (no API key needed) |\n| `http` | — | Make HTTP requests for API testing/debugging |\n\n### Developer Utilities (7)\n| Tool | CLI | Purpose |\n|------|-----|---------|\n| `regex_test` | — | Test regex patterns with match/replace/split modes |\n| `encode` | — | Base64, URL, SHA-256, MD5, hex encode/decode, JWT decode |\n| `measure` | — | Code complexity metrics (cyclomatic, cognitive complexity, lines, functions) |\n| `changelog` | — | Generate changelog from git history (conventional commits) |\n| `schema_validate` | — | Validate JSON data against JSON Schema |\n| `env` | — | System and runtime environment info (sensitive values redacted) |\n| `time` | — | Date parsing, timezone conversion, duration math |\n\n### FORGE Quality Gates (5)\n| Tool | CLI | Purpose |\n|------|-----|---------|\n| `forge_ground` | — | Full Ground phase: classify tier, scope map, unknowns, constraints |\n| `forge_classify` | — | Quick tier classification (Floor/Standard/Critical) |\n| `evidence_map` | — | CRUD + Gate evaluation for verified/assumed/unknown claims. Safety gate tags (`provenance`/`commitment`/`coverage`) enable mandatory pre-YIELD checks |\n| `stratum_card` | — | Generate T1/T2 compressed context cards from files (10-100x token reduction) |\n| `digest` | — | Compress N text sources into token-budgeted summary |\n\n### System (9)\n| Tool | CLI | Purpose |\n|------|-----|---------|\n| `config` | `aikit config` | View or update project configuration (kb.config.json) |\n| `status` | `aikit status` | Index statistics |\n| `reindex` | `aikit reindex` | Rebuild index |\n| `health` | `aikit health` | Project health checks (package.json, tsconfig, lockfile, circular deps) |\n| `guide` | `aikit guide` | Tool discovery — given a goal, recommends tools and workflow order |\n| `onboard` | `aikit onboard` | Full codebase onboarding in one call (structure + deps + patterns + knowledge) |\n| `graph` | `aikit graph` | Query the auto-populated knowledge graph (modules, symbols, imports) |\n| `queue` | `aikit queue` | Task queue for sequential agent operations (create/push/next/done/fail) |\n| `replay` | `aikit replay` | View or clear the audit trail of tool invocations (action: list/clear) |\n\n### Flows (1)\n| Tool | CLI | Purpose |\n|------|-----|---------|\n| `flow` | `aikit flow` | Manage flows — list, start, navigate steps, read instructions, inspect runs, add/remove/update. |\n\n### Presentation (1)\n| Tool | CLI | Purpose |\n|------|-----|---------|\n| `present` | — | Rich dashboards, charts, tables, timelines. Use `format: "browser"` then `openBrowserPage` to display. **In CLI mode (no VS Code chat), always use `format: "browser"`** — `html` UIResource is invisible in terminal. |\n\n### Meta-Tools — Tool Discovery (3)\n| Tool | CLI | Purpose |\n|------|-----|---------|\n| `list_tools` | — | List all active AI Kit tools with names, titles, and categories. Accepts optional `category` filter. Use for initial tool discovery. |\n| `describe_tool` | — | Get detailed metadata for a specific tool (title, categories, annotations). Use after `list_tools` to understand a tool before calling it. |\n| `search_tools` | — | Search active tools by keyword across names, titles, and categories. Use when you know what you need but not the tool name. |\n\n### Session Management (1)\n| Tool | CLI | Purpose |\n|------|-----|---------|\n| `session_digest` | — | Generate a compressed digest of session activity (replay log, stash, checkpoints). Options: `scope` (tools/stash/all), `since`, `last`, `focus`, `mode` (deterministic/sampling), `tokenBudget`, `persist`. Use at session end for handoff or mid-session to review what happened. |\n\n## Execution & Data Tools\n\n### `eval` — Execute Code in Sandbox\n\nRun JavaScript or TypeScript snippets in a constrained VM. Captures console output and return values.\n\n**Parameters:**\n| Param | Type | Default | Description |\n|-------|------|---------|-------------|\n| `code` | string | — | Code to execute |\n| `lang` | `"js"` \\| `"ts"` | `"js"` | Language mode (ts strips type syntax first) |\n| `timeout` | number | 5000 | Execution timeout in ms (max 60000) |\n\n**Examples:**\n```\n// Quick calculation\neval({ code: "return [1,2,3].reduce((a,b) => a+b, 0)" })\n\n// Process data\neval({ code: "const data = [1,2,3,4,5]; return { sum: data.reduce((a,b)=>a+b), avg: data.reduce((a,b)=>a+b)/data.length }" })\n\n// TypeScript\neval({ code: "interface Point { x: number; y: number }; const p: Point = {x: 1, y: 2}; return p.x + p.y", lang: "ts" })\n```\n\n---\n\n### `data_transform` — jq-like JSON Transforms\n\nApply jq-inspired expressions to JSON input for filtering, projection, grouping, and extraction.\n\n**Parameters:**\n| Param | Type | Description |\n|-------|------|-------------|\n| `input` | string | JSON string to transform |\n| `expression` | string | Transform expression (see syntax below) |\n\n**Supported Expressions:**\n\n| Expression | Description | Example |\n|------------|-------------|---------|\n| `.` | Identity (return input as-is) | `.` |\n| `.field` | Access object field | `.name` |\n| `.[N]` | Array index access | `.[0]` |\n| `.field1.field2` | Nested field access | `.user.name` |\n| `| filter(condition)` | Filter array items | `| filter(.age > 18)` |\n| `| map(expr)` | Transform each item | `| map(.name)` |\n| `| sort_by(.field)` | Sort by field | `| sort_by(.date)` |\n| `| group_by(.field)` | Group items by field | `| group_by(.category)` |\n| `| select(cond)` | Keep items matching condition | `| select(.active == true)` |\n| `| flatten` | Flatten nested arrays | `| flatten` |\n| `| unique` | Remove duplicates | `| unique` |\n| `| keys` | Get object keys | `| keys` |\n| `| values` | Get object values | `| values` |\n| `| length` | Array/string length | `| length` |\n| `| join(sep)` | Join array with separator | `| join(", ")` |\n| `| first` | First element | `| first` |\n| `| last` | Last element | `| last` |\n| `| sum` | Sum numeric array | `| sum` |\n| `| avg` | Average of numeric array | `| avg` |\n| `| min` / `| max` | Min/max value | `| min` |\n\n**Comparisons:** `==`, `!=`, `>`, `<`, `>=`, `<=`\n**Logical:** `and`, `or`, `not`\n\n**Examples:**\n```\n// Filter and project\ndata_transform({ input: \'[{"name":"Alice","age":30},{"name":"Bob","age":17}]\', expression: \'| filter(.age >= 18) | map(.name)\' })\n// → ["Alice"]\n\n// Group and count\ndata_transform({ input: \'[{"type":"bug"},{"type":"feat"},{"type":"bug"}]\', expression: \'| group_by(.type)\' })\n// → {"bug":[...], "feat":[...]}\n\n// Sort and take first\ndata_transform({ input: \'[{"score":3},{"score":1},{"score":5}]\', expression: \'| sort_by(.score) | first\' })\n// → {"score":1}\n```\n\n---\n\n### `time` — Date & Time Operations\n\nParse dates, convert timezones, calculate durations, add time. Supports ISO 8601, unix timestamps, and human-readable formats.\n\n**Parameters:**\n| Param | Type | Description |\n|-------|------|-------------|\n| `operation` | string | `now`, `parse`, `convert`, `diff`, `add` |\n| `input` | string | Date input (ISO, unix, or parseable string). For `diff`: two comma-separated dates |\n| `timezone` | string | Target timezone (e.g., "America/New_York") |\n| `duration` | string | Duration to add (e.g., "2h30m", "1d", "30s") — for `add` |\n\n**Operations:**\n| Op | Purpose | Example |\n|----|---------|---------|\n| `now` | Current time in all formats | `time({ operation: "now" })` |\n| `parse` | Parse any date string | `time({ operation: "parse", input: "2024-03-15T10:30:00Z" })` |\n| `convert` | Convert to timezone | `time({ operation: "convert", input: "2024-03-15T10:30:00Z", timezone: "Asia/Tokyo" })` |\n| `diff` | Duration between dates | `time({ operation: "diff", input: "2024-01-01,2024-12-31" })` |\n| `add` | Add duration to date | `time({ operation: "add", input: "2024-03-15", duration: "2h30m" })` |\n\n**Duration format:** Combine: `Nd` (days), `Nh` (hours), `Nm` (minutes), `Ns` (seconds)\nExample: `"1d2h30m"` = 1 day, 2 hours, 30 minutes\n\n## Flow System\n\nFlows are multi-step guided workflows that structure complex tasks. Each step has a skill file with detailed instructions, required artifacts, and agent assignments.\n\n### Built-in Flows\n\n| Flow | Steps | Use When |\n|------|-------|----------|\n| `aikit:basic` | assess → implement → verify | Bug fixes, config changes, small features |\n| `aikit:advanced` | spec → plan → task → execute → verify | New modules, cross-service changes, architectural work |\n\n### Flow Lifecycle\n\n```text\nflow({ action: \'list\' }) # See available flows\nflow({ action: \'info\', name: \'aikit:basic\' }) # View steps, skills, agents\nflow({ action: \'start\', name: \'aikit:basic\', topic: \'Fix login bug\' }) # Start — creates .flows/fix-login-bug/\nflow({ action: \'read\' }) # Read current step\'s instructions ({{artifacts_path}} resolved)\n# ... do the work described in the instruction ...\nflow({ action: \'step\', advance: \'next\' }) # Advance to next step\nflow({ action: \'step\', advance: \'skip\' }) # Skip current step\nflow({ action: \'step\', advance: \'redo\' }) # Redo current step\nflow({ action: \'status\' }) # Check progress (includes slug, runDir, artifactsPath, phase, isEpilogue)\nflow({ action: \'reset\' }) # Abandon active flow\nflow({ action: \'runs\' }) # List all runs (current + past)\n# Epilogue steps (mandatory, injected after every flow):\n# After last flow step → _docs-sync epilogue runs automatically\n# flow({ action: \'status\' }) shows phase: \'after\', isEpilogue: true during epilogue\n```\n\nCustom flow lifecycle management:\n\n```text\nflow({ action: \'add\', source: \'.github/flows/my-flow\' })\nflow({ action: \'update\', name: \'my-flow\' })\nflow({ action: \'remove\', name: \'my-flow\' })\n```\n\n## CRITICAL: Use AI Kit Tools Instead of Native IDE Tools\n\nAI Kit tools provide **10x richer output** than native IDE tools — with AST-analyzed call graphs, scope context, import classification, and cognitive complexity. **You MUST use AI Kit tools instead of native read/search tools.**\n\n### ⛔ PROHIBITED: Native File Reading\n\n**`read_file` / `read_file_raw` MUST NOT be used to understand code.** They waste tokens and miss structural information.\n\nThe **ONLY** acceptable use of `read_file`: getting exact lines immediately before an edit (to verify the `old_str` for replacement). Even then, use `file_summary` first to identify which lines to read.\n\n### Tool Replacement Table\n\n| ❌ NEVER do this | ✅ Use AI Kit Tool | Why |\n|---|---|---|\n| `read_file` (full file) | `file_summary` | Exports, imports, call edges — **10x fewer tokens** |\n| `read_file` (specific section) | `compact({ path, query })` | Server-side read + extract — **5-20x reduction** |\n| `grep_search` / `textSearch` | `search` | Semantic + keyword hybrid across all indexed content |\n| `grep_search` for a symbol | `symbol` | Definition + references **with scope context** |\n| Multiple `read_file` calls | `digest` | Compresses multiple sources into token-budgeted summary |\n| `listDirectory` + `read_file` | `scope_map` | Identifies relevant files for a task automatically |\n| Manual code tracing | `trace` | AST call-graph traversal with scope context |\n| Line counting / `wc` | `measure` | Lines, complexity, **cognitive complexity**, functions |\n| Grep for unused exports | `dead_symbols` | AST-powered export detection with regex fallback |\n| Repeated file reads | `stratum_card` | Reusable compressed context — **10-100x reduction** |\n| `fetch_webpage` | `web_fetch` | Readability extract + token budget — richer output |\n| Web research / browsing | `web_search` | Structured web results without browser — **unique to KB** |\n\n### Decision Tree — How to Read Code\n\n```\nNeed to understand a file?\n├─ Just structure? → file_summary (exports, imports, call edges — ~50 tokens)\n├─ Specific section? → compact({ path, query }) — 5-20x reduction\n├─ Multiple files? → digest (multi-source compression — token-budgeted)\n├─ Repeated reference? → stratum_card (T1/T2 card — 10-100x reduction)\n├─ Need exact lines to EDIT? → read_file (the ONLY acceptable use)\n└─ "I want to read the whole file" → ⛔ STOP. Use file_summary or compact instead.\n```\n\n### Decision Tree — Need Structural Relationships?\n\nWhen vector search and file reads don\'t answer the question (e.g. "who imports this?",\n"what does this depend on?", "how are these files connected?"), use `graph`:\n\n```\nNeed to understand relationships between code?\n├─ Who imports / calls this? → graph({action:\'find_nodes\', name_pattern}) → graph({action:\'neighbors\', node_id, direction:\'incoming\'})\n├─ What does this depend on? → graph({action:\'neighbors\', node_id, direction:\'outgoing\'})\n├─ Full context for a symbol? → graph({action:\'symbol360\', name})\n├─ Related files within N hops? → graph({action:\'traverse\', node_id, max_depth:2})\n├─ Layer/module isolation check? → graph({action:\'depth_traverse\', node_id, max_depth:3})\n└─ Graph size/health? → graph({action:\'stats\'})\n```\n\n**Use this BEFORE** reaching for `analyze({ aspect: "dependencies", ... })` (slower, less precise) or manually\ntracing via `symbol` + `trace` chains. The graph is auto-populated during indexing.\n\n### What AI Kit Tools Return (AST-Enhanced)\n\nThese tools use Tree-sitter WASM to analyze source code at the AST level, providing structured data that raw file reads cannot:\n\n| Tool | Rich Output |\n|------|-------------|\n| `file_summary` | Imports classified as **external vs internal** (`isExternal` flag). **Call edges** between functions (e.g., `handleRequest() → validateInput() @ line 42`). `exported` flag on interfaces and types. Import count breakdown. |\n| `symbol` | References include **scope** — which function/class/method contains each usage (e.g., `referenced in processOrder() at auth-service.ts:55`). |\n| `trace` | **Call-graph edges** discovered via AST syntax tree, not text matching. Supports forward (who does X call?) and backward (who calls X?) tracing. Scope context on each node. |\n| `measure` | **Cognitive complexity** — weights nesting depth (nested `if` inside `for` inside `try` scores higher). More useful than cyclomatic complexity for understanding code difficulty. |\n| `dead_symbols` | **AST export enumeration** — catches `export default`, barrel re-exports (`export { x } from`), `export =`, and `export type`. Regex fallback for non-AST-supported languages. |\n\n### Example: `file_summary` Output\n\n```\nsrc/auth-service.ts\nLanguage: typescript | Lines: 180 | Estimated tokens: ~1400\n\nImports (6): 3 external, 3 internal\n - import { hash } from \'bcrypt\' [external]\n - import { UserRepo } from \'./user-repo\' [internal]\n\nFunctions (4):\n - authenticate @ line 22 [exported]\n - validateToken @ line 55 [exported]\n - hashPassword @ line 90\n - generateJwt @ line 110\n\nCall edges (12 intra-file):\n - authenticate() → hashPassword() @ line 35\n - authenticate() → generateJwt() @ line 42\n - validateToken() → UserRepo.findById() @ line 68\n\nInterfaces (2):\n - AuthResult @ line 8 [exported]\n - TokenPayload @ line 14\n```\n\nCompare: `read_file` would cost ~1400 tokens for raw text. `file_summary` gives structured data in ~120 tokens — **12x reduction** with richer information.\n\n## Token Efficiency\n\n`config.tokenBudget` controls output verbosity globally:\n\n| Level | Output | Compression | Context Strategy |\n|-------|--------|-------------|------------------|\n| `efficient` (default) | Minimal output, score + top issues only | threshold 2000, budget 1000 | `stratum_card(T1)` |\n| `normal` | Standard output with parsed errors/pattern names | threshold 4000, budget 2000 | `compact()` |\n| `full` | Maximum detail with raw output/full tables | No compression | `digest()` |\n\nSet via: `config({ action: \'update\', updates: { tokenBudget: \'normal\' } })`\n\nTools with `detail` param inherit from `config.tokenBudget` when not explicitly set.\nCompression middleware applies to ALL tool responses automatically.\n\n## Search Strategy\n\n1. **Start broad**: `search({ query: "topic", search_mode: "hybrid" })`\n2. **Narrow**: Add `content_type`, `origin`, or `category` filters\n3. **Exact match**: Use `search_mode: "keyword"` for identifiers\n4. **Federated**: Use `find` to combine vector + glob + regex\n\n## Workflow Chains\n\n### Codebase Onboarding\n```\nanalyze({ aspect: "structure", path: "src/" })\n→ analyze({ aspect: "dependencies", path: "src/" })\n→ analyze({ aspect: "entry_points", path: "src/" })\n→ produce_knowledge({ path: "src/" })\n→ knowledge({ action: "remember", title: "Codebase onboarding complete", ... })\n```\n\n### Planning a Task\n```\nscope_map({ task: "implement user auth" })\n→ compact({ path: "src/auth.ts", query: "auth flow" })\n→ workset({ action: "save", name: "auth-task", files: [...] })\n```\n\n### Bug Investigation\n```\nparse_output({ output: <error> }) → symbol({ name: "failingFn" })\n→ trace({ symbol: "failingFn", direction: "backward" })\n→ blast_radius({ changed_files: ["suspect.ts"] })\n→ eval({ code: "hypothesis test" }) → check({ files: ["suspect.ts"] })\n```\n\n### Multi-Task Orchestration (DAG Queue)\n```\nqueue({ action: "create", name: "my-tasks" })\n→ queue({ action: "push", name: "my-tasks", title: "Task 1", data: { deps: [] } })\n→ queue({ action: "push", name: "my-tasks", title: "Task 2", data: { deps: ["task-1-id"] } })\n→ queue({ action: "next", name: "my-tasks" }) # Gets next ready task\n→ [do work]\n→ queue({ action: "done", name: "my-tasks", id: "<id>" })\n```\n\n### Safe Refactor with Lanes\n```\nscope_map({ task: "rename UserService" })\n→ lane({ action: "create", name: "refactor", files: [...] })\n→ [make changes in lane files]\n→ lane({ action: "diff", name: "refactor" })\n→ check({}) → test_run({})\n→ lane({ action: "merge", name: "refactor" })\n```\n\n### Lane — isolated read-only exploration\n\n`lane({ action:\'create\', name })` creates an isolated copy of the workspace. Use to try approach A vs B WITHOUT touching canonical source. Other actions: `list`, `diff`, `delete`. Compare with `lane({ action:\'diff\', names:[\'a\',\'b\'] })`. Do NOT use `lane` for actual refactors — use `checkpoint` instead (`checkpoint` = reversible on canonical source; `lane` = isolated copies for comparison).\n\n### After Making Changes\n```\nblast_radius({ changed_files: ["src/auth.ts"] })\n→ check({}) → test_run({ grep: "auth" })\n→ reindex()\n→ knowledge({ action: "remember", title: "Implemented auth", content: "..." })\n```\n\n### Pre-Commit Validation\n```\ngit_context({ diff: true })\n→ diff_parse({ diff: <staged diff> })\n→ blast_radius({ changed_files: [...] })\n→ check({}) → test_run({})\n```\n\n---\n\n## Persistent Memory\n\n| Action | Tool | Category |\n|--------|------|----------|\n| Store | `knowledge({ action: "remember", title, content, category })` | conventions, decisions, patterns, context, session |\n| Search | `search({ query, origin: "curated" })` | — |\n| Browse | `knowledge({ action: "list" })` or `knowledge({ action: "list", category })` | — |\n| Read | `knowledge({ action: "read", id })` | — |\n| Update | `knowledge({ action: "update", id, content })` | — |\n| Remove | `knowledge({ action: "forget", id })` | — |\n\n**Session checkpoint** (end of session): `knowledge({ action: "remember", title: "Session checkpoint: <topic>", content: "Done/Decisions/Next/Blockers", category: "session" })`\n\n## CLI Quick Reference\n\n```bash\naikit init # Scaffold AI Kit in current directory\naikit init --force # Overwrite all scaffold/skill files\naikit init --guide # JSON report of stale files for LLM-driven updates\naikit serve # Start MCP server (stdio or HTTP)\naikit search <q> # Hybrid search\naikit find <q> # Federated search\naikit symbol <name> # Resolve symbol\naikit scope-map <t> # Task reading plan\naikit compact <q> # Context compression (--path file or stdin)\naikit check # Typecheck + lint (--detail efficient|normal|full)\naikit test # Run tests\naikit rename <old> <new> <path> # Rename symbol\naikit lane create <name> --files f1,f2 # Create lane\naikit lane diff <name> # View lane changes\naikit lane merge <name> # Merge lane back\naikit status # Index stats\naikit reindex # Rebuild index\n```\n\n## Configuration\n\n`kb.config.json` in project root:\n```json\n{\n "sources": [{ "path": ".", "excludePatterns": ["node_modules/**", "**/node_modules/**", "dist/**", "coverage/**", ".aikit-data/**"] }],\n "indexing": { "chunkSize": 1500, "chunkOverlap": 200, "minChunkSize": 100, "concurrency": 5 },\n "embedding": { "model": "mixedbread-ai/mxbai-embed-large-v1", "dimensions": 1024 },\n "store": { "backend": "lancedb", "path": ".aikit-data" },\n "curated": { "path": "curated", "adapter": "filesystem" }\n}\n```\n\n## Tool Profiles\n\nTool profiles control which subset of the 61 tools are active. Profiles reduce token overhead by exposing only relevant tools for a given task.\n\n### Built-in Profiles\n\n| Profile | Description | Use When |\n|---------|-------------|----------|\n| `full` | All tools enabled (default) | General development, orchestration |\n| `safe` | Read-only tools — no file/state modifications | Code review, analysis, research |\n| `research` | Search, analysis, knowledge, web access | Investigation, documentation |\n| `minimal` | Essential tools only — search, check, test | Simple tasks, low-token budgets |\n| `discovery` | Full toolset + meta-tools for guided exploration | New users, onboarding, tool learning |\n\n### Activating a Profile\n\nSet `toolProfile` in `kb.config.json`:\n\n```json\n{\n "toolProfile": "research"\n}\n```\n\nBase tools (`status`, `config`, `guide`, `health`) are **always available** regardless of profile.\n\n## Development (Self-Dogfooding)\n\nWhen developing @vpxa/aikit itself: always `pnpm build` before using CLI/server (runs from `dist/`), always `reindex` after structural code changes, and don\'t run CLI and HTTP server simultaneously (LanceDB is single-process).\n\n---\n\n## Flows\n\nFlows are structured multi-step workflows that guide agents through complex tasks. They are the **primary workflow system** — use them instead of ad-hoc planning when a matching flow exists.\n\n### Flow Tools\n\n| Tool | Purpose |\n|------|---------|\n| `flow` | Check if a flow is active + current step + phase (before/flow/after) + isEpilogue |\n\nDifferent `action` values handle listing, starting, reading steps, advancing, resets, run inspection, and add/update/remove flow management.\n\n### Flow Selection\n\n| Task Type | Flow | Why |\n|-----------|------|-----|\n| Bug fix, config change, small refactor | `aikit:basic` | Known scope, low risk |\n| New feature in existing module | `aikit:basic` | Clear boundaries |\n| New system/service/module | `aikit:advanced` | Needs spec + planning |\n| Cross-service changes | `aikit:advanced` | Multiple boundaries |\n| Architectural change | `aikit:advanced` | High impact |\n| Unclear scope or exploratory | No flow | Use agent\'s native workflow |\n\n### Flow Lifecycle\n\n1. **Start**: `flow({ action: \'list\' })` → choose flow → `flow({ action: \'start\', name: "<name>", topic: "<task>" })`\n2. **Each step**: `flow({ action: \'read\', step: "<name>" })` → follow step instructions → complete work\n3. **Advance**: `flow({ action: \'step\', advance: \'next\' })` → repeat from step 2\n4. **Epilogue**: After last flow step, mandatory epilogue steps run (e.g., `_docs-sync` updates `docs/`)\n5. **Resume**: `flow({ action: \'status\' })` → if active, `flow({ action: \'read\' })` for current step → continue\n6. **Reset**: `flow({ action: \'reset\' })` if you need to start over\n\n---\n\n## Reference Documentation\n\nFor detailed patterns on specific topics, load these reference files:\n\n| Topic | File | When to load |\n|-------|------|-------------|\n| Multi-task orchestration | `references/coordination.md` | Queue, DAG, lanes, worksets, stash, checkpoints |\n| Quality gates (FORGE) | `references/forge-protocol.md` | Complex tasks, evidence maps, tier classification |\n| Search & relationships | `references/search-patterns.md` | Finding code, tracing data flow, graph traversal |\n'},{file:`references/coordination.md`,content:`# Coordination & Multi-Task Orchestration
2269
1708
 
2270
1709
  Patterns for managing multiple tasks, parallel exploration, and session state.
2271
1710