@vpxa/aikit 0.1.185 → 0.1.187
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/package.json +1 -1
- package/packages/browser/dist/index.js +1 -1
- package/scaffold/dist/definitions/skills/adr-skill.mjs +73 -155
- package/scaffold/dist/definitions/skills/aikit.mjs +291 -318
- package/scaffold/dist/definitions/skills/brainstorming.mjs +107 -242
- package/scaffold/dist/definitions/skills/browser-use.mjs +213 -1
- package/scaffold/dist/definitions/skills/c4-architecture.mjs +212 -2256
- package/scaffold/dist/definitions/skills/docs.mjs +395 -755
- package/scaffold/dist/definitions/skills/lesson-learned.mjs +61 -21
- package/scaffold/dist/definitions/skills/react.mjs +104 -137
- package/scaffold/dist/definitions/skills/requirements-clarity.mjs +55 -2
- package/scaffold/dist/definitions/skills/session-handoff.mjs +127 -177
- package/scaffold/dist/definitions/skills/typescript.mjs +16 -0
|
@@ -1,328 +1,301 @@
|
|
|
1
|
-
var e=[{file:`SKILL.md`,content:'---\nname: aikit\ndescription: "Use the @vpxa/aikit AI Kit MCP server for codebase search, analysis, and persistent memory. Load when using any aikit_* tool. 63 tools: search (hybrid/semantic/keyword), code analysis (structure, deps, symbols, patterns, entry points, diagrams, blast radius), knowledge graph (module/symbol/import traversal), context (worksets, stash, checkpoints, lanes), signaling (inter-agent signals, leases), code manipulation (rename, codemod, eval), validation (check, test_run, audit), knowledge (remember/read/update/forget/list/history/diff/recover/orphaned/withdraw/flush/lesson), web (fetch, search, http), FORGE (ground, classify, evidence map, stratum cards, digest), flows (list, start, step, read, runs, add/remove/update), presentation (dashboards), onboarding, meta-tools, and 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 — 63 MCP tools for search, analysis, context compression, FORGE quality gates, knowledge management, signaling and coordination, 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| Skill | Audience | Load when |\n|-------|----------|-----------|\n| `aikit` | All agents | **Always load at session start.** Tool signatures, workflows, session protocol. |\n| `brainstorming` | Orchestrator, Planner, Researchers | Design/planning phase — exploring requirements, user intent, and design before implementation. NOT for code agents. |\n| `session-handoff` | Any agent | Context window filling up, session ending, or major milestone completed. |\n| `requirements-clarity` | Orchestrator, Planner | Before planning vague or complex features — score 0-100 until ≥ 90. |\n| `lesson-learned` | Any agent | After completing work — extract principles from git diffs. |\n| `c4-architecture` | Planner, Documenter, Researchers | When documenting or reviewing architecture — C4 Mermaid diagrams. |\n| `adr-skill` | Orchestrator, Planner, Researchers | When making non-trivial technical decisions — executable ADRs. |\n| `present` | Orchestrator, Planner, Documenter | When presenting dashboards, charts, tables, or complex visual content to users. NOT for subagents. |\n| `typescript` | Implementer, Frontend, Refactor, Debugger | Before TypeScript implementation — type system, compiler config, advanced types. |\n| `react` | Frontend | Before React work — component architecture, React 19 APIs, Server Components. |\n| `frontend-design` | Frontend | Before UI/UX work — visual design, typography, color, layout, accessibility. |\n| `multi-agents-development` | Orchestrator | Before delegating to multiple agents — task decomposition, dispatch, review pipelines. |\n| `docs` | Documenter | When creating or updating project documentation — Diátaxis framework, staleness detection. |\n| `repo-access` | Any agent | When encountering git auth failures, accessing private/enterprise repos. |\n| `browser-use` | Frontend, any agent (auth) | When needing browser interaction — login flows, visual validation, web scraping. |\n\n## Architecture\n\n16-package monorepo published as a single npm package:\n\n```\ncore → store → embeddings → chunker → indexer → analyzers → tools → server → cli\n ↕\n dashboard, elicitation, enterprise-bridge, flows, present, settings-ui, aikit-client\n```\n\n- **MCP server**: 62 tools + 2 resources (via `@modelcontextprotocol/sdk`)\n- **CLI**: 49 commands (thin dispatcher + 11 command groups)\n- **Search**: Hybrid vector + keyword + RRF fusion\n- **Embeddings**: ONNX local (mxbai-embed-large-v1, 512 dimensions, int8 quantized)\n- **Vector store**: SQLite-vec (embedded, zero infrastructure)\n- **Chunking**: Tree-sitter AST (TS/JS/Python/Go/Rust/Java) + regex fallback\n- **Dashboard**: Web-based dashboard for knowledge graph visualization and settings management\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, list, history, diff, recover, orphaned, withdraw, flush, and `lesson` actions |\n| `produce_knowledge` | — | Auto-generate knowledge from analysis |\n\n### Signaling & Coordination (1)\n\n| `signal` | — | Inter-agent signaling and write-intent leases for multi-agent coordination |\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` | — | Multi-provider web search (DuckDuckGo + Bing-HTML + Mojeek fan-out, no API key needed) |\n| `http` | — | Make HTTP requests for API testing/debugging |\n\nExamples: `web_fetch({ urls: ["https://docs.example.com"], mode: "markdown" })`, `web_search({ queries: ["react suspense", "vitest retries"], limit: 5 })`\n\n### Browser Automation (1)\n| Tool | CLI | Purpose |\n|------|-----|---------|\n| `browser` | — | Unified browser automation — owned Chromium runtime with 13 actions |\n\n**Actions:**\n| Action | Purpose | Key params |\n|--------|---------|------------|\n| `open` | Launch a browser page | `url`, `mode` (ui/headless/panel), `waitUntil`, `label`, `autoDialog` |\n| `read` | Extract page content | `readMode` (snapshot/dom/markdown/text), `selector` for scoping |\n| `act` | Interact with elements | `kind` (click/type/press/hover/drag/select/scroll/upload), `ref`/`selector` |\n| `network` | Capture network traffic | `subAction` (enable/get/clear/export-har), `filter` |\n| `console` | Browser console messages | `consoleSubAction` (enable/get/clear), `level` |\n| `fetch` | HTTP with page cookies/session | `fetchUrl`, `fetchMethod`, `fetchHeaders`, `fetchBody` |\n| `batch` | Multi-action execution | `steps` (array of action objects) |\n| `diff` | Snapshot diff vs baseline | `pageId` |\n| `navigate` | URL navigation and waiting | `url`, `type` (back/forward/reload/waitFor) |\n| `eval` | Execute JavaScript in page | `code` |\n| `screenshot` | Capture page/element | `selector`, `clip` ({x,y,width,height}), `format` (png/jpeg), `quality` (0-100), `fullPage` |\n| `dialog` | Handle browser dialogs | `accept`, `promptText` |\n| `session` | Manage pages and state | `sessionAction` (list/close/cookies/set-cookie/delete-cookie/clear-cookies/get-storage/set-storage/clear-storage) |\n\n**Read modes:** `snapshot` (accessibility tree, default), `dom` (cleaned HTML), `markdown` (converted md), `text` (visible text only). All support `selector` scoping.\n\n**Session state:** Full cookie CRUD (`set-cookie`, `delete-cookie`, `clear-cookies`, `cookies` to export) + localStorage/sessionStorage management (`get-storage`, `set-storage`, `clear-storage` with `storageType` param).\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 (aikit.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 `blocks` or `template` + `data`; no `actions` renders inline in the host client, any `actions` uses browser transport. |\n\n**Viewer templates:** For architecture diagrams use `c4-static@1` (inline) or `c4@1` (interactive). For process flows use `process-flow-static@1` / `process-flow@1`. For code tours use `tour@1`.\nLoad the `present` skill for data schemas. Server validates template `data` — wrong shapes return clear field-level errors.\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), `token_budget`, `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` | Multi-provider web search without browser — **unique to AI Kit** |\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## 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", path })` | Relative path within `.ai/curated/` |\n| Update | `knowledge({ action: "update", path, content })` | Relative path within `.ai/curated/` |\n| Remove | `knowledge({ action: "forget", path })` | Relative path within `.ai/curated/` |\n| History | `knowledge({ action: "history", path })` | Entry version history |\n| Diff | `knowledge({ action: "diff", path, from_sha?, to_sha? })` | Compare entry versions |\n| Recover | `knowledge({ action: "recover", path })` | Restore a withdrawn entry |\n| Orphaned | `knowledge({ action: "orphaned" })` | Find orphaned knowledge entries |\n| Withdraw | `knowledge({ action: "withdraw", scope: "flow:<run-id>", profile: "<role>", budget: 4000 })` | Flow-scoped context retrieval |\n| Flush | `knowledge({ action: "flush", scope: "flow:<run-id>" })` | Clean up flow context |\n\n### Lessons (structured insights with confidence)\n\n| Create | `knowledge({ action: "lesson", sub_action: "create", title, content, category })` | Create a scored lesson entry |\n| Confirm | `knowledge({ action: "lesson", sub_action: "confirm", path })` | Increase confidence when a lesson is validated |\n| Contradict | `knowledge({ action: "lesson", sub_action: "contradict", path })` | Decrease confidence when a lesson is invalidated |\n| List | `knowledge({ action: "lesson", sub_action: "list-lessons" })` | Browse lessons by confidence |\n\n**Session checkpoint** (end of session): `knowledge({ action: "remember", title: "Session checkpoint: <topic>", content: "Done/Decisions/Next/Blockers", category: "session" })`\n\n## Memory Lifecycle (Automatic)\n\nAI Kit manages memory health automatically in the background:\n\n- **Retention scoring** — Ebbinghaus forgetting curve. Frequently accessed entries stay fresh; unused entries decay and may be flagged for review.\n- **Tier consolidation** — 4 tiers: Working → Episodic → Semantic → Procedural. Entries promote automatically based on stability and access frequency.\n- **Auto-supersession** — On `remember`, the system detects similar existing entries (Jaccard similarity > 0.6) and may suggest superseding them.\n- **Observation capture** — Tool results are automatically captured as knowledge observations (rate-limited, 50/session max).\n- **Procedural extraction** — Repeated tool sequences are detected and stored as reusable procedures.\n\nThese systems run transparently — you do NOT need to invoke them manually. They improve memory quality over time.\n\n## Inter-Agent Signaling\n\nFor multi-agent workflows, use the `signal` tool to coordinate:\n\n| Post | `signal({ action: "post", workspace: "<ws>", key: "status", value: "done", agent: "<name>" })` |\n| Get | `signal({ action: "get", workspace: "<ws>", key: "status" })` |\n| Lease | `signal({ action: "lease", workspace: "<ws>", resource: "src/auth.ts", agent: "Implementer" })` |\n| Unlease | `signal({ action: "unlease", workspace: "<ws>", resource: "src/auth.ts" })` |\n| List leases | `signal({ action: "leases", workspace: "<ws>" })` |\n\nUse signals to:\n- Communicate completion status between parallel agents\n- Prevent write conflicts with file-level leases\n- Share discoveries across agent boundaries\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`aikit.config.json` in project root:\n```json\n{\n "sources": [{ "path": ".", "excludePatterns": ["**/node_modules/**", "**/dist/**", "**/build/**", "**/.git/**", "**/.aikit-data/**", "**/coverage/**"] }],\n "indexing": { "chunkSize": 1500, "chunkOverlap": 200, "minChunkSize": 100 },\n "embedding": { "model": "mixedbread-ai/mxbai-embed-large-v1", "dimensions": 1024 },\n "store": { "backend": "sqlite-vec", "path": ".aikit-data" },\n "curated": { "path": ".ai/curated" }\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 `aikit.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/`), and always `reindex` after structural code changes.\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
|
|
1
|
+
var e=[{file:`SKILL.md`,content:`---
|
|
2
|
+
name: aikit
|
|
3
|
+
description: "Use the @vpxa/aikit AI Kit MCP server for codebase search, context compression, validation, and persistent memory. Load at session start or before using aikit_* tools. This skill teaches tool judgment: minimize raw reads, choose the smallest useful retrieval path, and persist decisions that matter."
|
|
4
|
+
metadata:
|
|
5
|
+
category: cross-cutting
|
|
6
|
+
domain: general
|
|
7
|
+
applicability: always
|
|
8
|
+
inputs: [codebase]
|
|
9
|
+
outputs: [search-results, analysis, knowledge]
|
|
10
|
+
relatedSkills: [session-handoff, present]
|
|
11
|
+
---
|
|
2
12
|
|
|
3
|
-
|
|
13
|
+
# @vpxa/aikit — AI Kit
|
|
4
14
|
|
|
5
|
-
|
|
15
|
+
Local-first AI developer toolkit for search, analysis, compression, validation, memory, flows, and coordination.
|
|
6
16
|
|
|
7
|
-
|
|
8
|
-
|--------|---------|---------|
|
|
9
|
-
| \`create\` | New queue | \`queue({ action: "create", name: "tasks" })\` |
|
|
10
|
-
| \`push\` | Add item | \`queue({ action: "push", name: "tasks", title: "Fix auth", data: { deps: [] } })\` |
|
|
11
|
-
| \`next\` | Get next ready item | \`queue({ action: "next", name: "tasks" })\` |
|
|
12
|
-
| \`done\` | Mark complete | \`queue({ action: "done", name: "tasks", id: "<id>" })\` |
|
|
13
|
-
| \`fail\` | Mark failed | \`queue({ action: "fail", name: "tasks", id: "<id>", error: "reason" })\` |
|
|
14
|
-
| \`get\` | View queue state | \`queue({ action: "get", name: "tasks" })\` |
|
|
15
|
-
| \`list\` | List all queues | \`queue({ action: "list" })\` |
|
|
16
|
-
| \`clear\` | Clear all items | \`queue({ action: "clear", name: "tasks" })\` |
|
|
17
|
-
| \`delete\` | Delete queue | \`queue({ action: "delete", name: "tasks" })\` |
|
|
17
|
+
## When to Use
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
- You need to understand unfamiliar code without raw-reading large files.
|
|
20
|
+
- You need structured search across code, docs, and prior decisions.
|
|
21
|
+
- You need typecheck, test, or audit results in structured form.
|
|
22
|
+
- You need memory across sessions, not just within one conversation.
|
|
23
|
+
- You need to estimate blast radius before changing shared code.
|
|
24
|
+
- You need guided flows, FORGE gates, or coordination primitives.
|
|
20
25
|
|
|
21
|
-
|
|
26
|
+
## Mindset
|
|
22
27
|
|
|
23
|
-
|
|
24
|
-
queue({ action: "create", name: "build-pipeline" })
|
|
25
|
-
queue({ action: "push", name: "build-pipeline", title: "Compile types", data: { deps: [] } }) // → id: "a"
|
|
26
|
-
queue({ action: "push", name: "build-pipeline", title: "Bundle JS", data: { deps: ["a"] } }) // → id: "b"
|
|
27
|
-
queue({ action: "push", name: "build-pipeline", title: "Run tests", data: { deps: ["a"] } }) // → id: "c"
|
|
28
|
-
queue({ action: "push", name: "build-pipeline", title: "Deploy", data: { deps: ["b", "c"] } }) // → id: "d"
|
|
29
|
-
queue({ action: "next", name: "build-pipeline" }) // Returns "Compile types" (no deps)
|
|
30
|
-
queue({ action: "done", name: "build-pipeline", id: "a" })
|
|
31
|
-
queue({ action: "next", name: "build-pipeline" }) // Returns "Bundle JS" or "Run tests" (deps satisfied)
|
|
32
|
-
\`\`\`
|
|
28
|
+
AI Kit tools are a compression layer. Their job is to prevent agents from wasting tokens on raw file reads and flat text search.
|
|
33
29
|
|
|
34
|
-
|
|
30
|
+
Every call should reduce context, not add to it.
|
|
35
31
|
|
|
36
|
-
|
|
32
|
+
Think: what's the minimum I need to read to act? Then choose the tool that gives exactly that.
|
|
37
33
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
###
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
-
|
|
112
|
-
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
###
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
##
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
### Bug Investigation
|
|
307
|
-
\`\`\`
|
|
308
|
-
symbol({ name: "failingFunction" }) // Find definition
|
|
309
|
-
→ trace({ start: "failingFunction", direction: "backward" }) // Who calls it?
|
|
310
|
-
→ compact({ path: "src/caller.ts", query: "error handling around failingFunction" })
|
|
311
|
-
→ blast_radius({ path: ".", files: ["src/caller.ts"] }) // What else is affected?
|
|
312
|
-
\`\`\`
|
|
313
|
-
|
|
314
|
-
### Dependency Analysis
|
|
315
|
-
\`\`\`
|
|
316
|
-
graph({ action: "find_nodes", name_pattern: "auth-module" })
|
|
317
|
-
→ graph({ action: "neighbors", node_id: "<id>", direction: "incoming" }) // Who depends on auth?
|
|
318
|
-
→ graph({ action: "traverse", node_id: "<id>", max_depth: 2 }) // Deep dependency tree
|
|
319
|
-
\`\`\`
|
|
320
|
-
|
|
321
|
-
### Codebase Onboarding
|
|
322
|
-
\`\`\`
|
|
323
|
-
scope_map({ task: "Understand the authentication system" })
|
|
324
|
-
→ [read each file with file_summary or compact based on relevance]
|
|
325
|
-
→ graph({ action: "find_nodes", name_pattern: "auth" })
|
|
326
|
-
→ graph({ action: "neighbors", node_id: "<id>" })
|
|
327
|
-
\`\`\`
|
|
34
|
+
Common mistake: using \`read_file\` out of habit. That is the last resort, not the first.
|
|
35
|
+
|
|
36
|
+
Default progression: \`file_summary\` → \`compact\` → \`digest\` → \`read_file\` only for exact edit lines.
|
|
37
|
+
|
|
38
|
+
If you are unsure which tool fits, ask AI Kit for the live catalog with \`list_tools\`, then narrow with \`search_tools\` or \`describe_tool\`.
|
|
39
|
+
|
|
40
|
+
## Operating Model
|
|
41
|
+
|
|
42
|
+
1. Orient with compressed retrieval, not raw reads.
|
|
43
|
+
2. Validate with structured tools, not noisy terminal output.
|
|
44
|
+
3. Persist decisions that future sessions must reuse.
|
|
45
|
+
4. Reuse previous context before searching again.
|
|
46
|
+
5. Use reference docs only when the main routing logic is not enough.
|
|
47
|
+
|
|
48
|
+
## Tool Selection (Decision Tree)
|
|
49
|
+
|
|
50
|
+
~~~text
|
|
51
|
+
Need to understand code?
|
|
52
|
+
├─ Just structure? → file_summary (exports, imports — ~50 tokens)
|
|
53
|
+
├─ Specific section? → compact({ path, query }) — 5-20x token reduction
|
|
54
|
+
├─ Multiple files? → digest (multi-source compression)
|
|
55
|
+
├─ Need relationships? → graph (find_nodes → neighbors)
|
|
56
|
+
└─ Need exact lines? → read_file (ONLY for editing)
|
|
57
|
+
|
|
58
|
+
Need to find something?
|
|
59
|
+
├─ Code/symbols? → search (hybrid — default)
|
|
60
|
+
├─ Symbol definition? → symbol (definition + refs + call context)
|
|
61
|
+
├─ Usage examples? → find({ mode: 'examples', query })
|
|
62
|
+
├─ Cross-file flow? → trace (forward/backward/both)
|
|
63
|
+
└─ Change impact? → blast_radius
|
|
64
|
+
|
|
65
|
+
Need to validate?
|
|
66
|
+
├─ Type errors? → check (typecheck + lint combined)
|
|
67
|
+
├─ Tests pass? → test_run (structured output)
|
|
68
|
+
└─ Full audit? → audit (structure + deps + health)
|
|
69
|
+
|
|
70
|
+
Need to remember?
|
|
71
|
+
├─ Store decision? → knowledge({ action: 'remember' })
|
|
72
|
+
├─ Find past decision? → search({ query, origin: 'curated' })
|
|
73
|
+
├─ Session state? → stash (ephemeral) or checkpoint (persistent)
|
|
74
|
+
└─ Cross-session? → knowledge (curated memory)
|
|
75
|
+
|
|
76
|
+
Need tool discovery?
|
|
77
|
+
├─ Full live catalog? → list_tools
|
|
78
|
+
├─ Know capability, not name? → search_tools
|
|
79
|
+
└─ Need details first? → describe_tool or guide
|
|
80
|
+
~~~
|
|
81
|
+
|
|
82
|
+
## Session Protocol
|
|
83
|
+
|
|
84
|
+
### Why This Matters
|
|
85
|
+
|
|
86
|
+
Without session discipline, agents repeat work, miss context, and make decisions that contradict earlier choices. These steps exist to keep work cumulative.
|
|
87
|
+
|
|
88
|
+
### Start (do first, every session)
|
|
89
|
+
|
|
90
|
+
1. \`status({})\` — Why: confirms index is built, tools are ready, and onboard state is known. Skipping this causes tool-avoidance and blind exploration.
|
|
91
|
+
2. \`search({ query: "SESSION CHECKPOINT", origin: "curated" })\` — Why: pulls prior session context so you do not re-solve finished work.
|
|
92
|
+
3. \`scope_map({ task })\` — Why: creates a reading plan before exploration, which prevents broad wandering.
|
|
93
|
+
4. If a flow may already exist, run \`flow({ action: 'status' })\` — Why: flow state is part of task state. Resuming the wrong way duplicates work.
|
|
94
|
+
5. If onboard is missing, run \`onboard({ path: "." })\` — Why: AI Kit is strongest after structure, patterns, and symbols are pre-analyzed.
|
|
95
|
+
|
|
96
|
+
### During (do continuously)
|
|
97
|
+
|
|
98
|
+
- \`stash({ action: "set", key, value })\` for intermediate results — Why: chat context compresses; stash survives it.
|
|
99
|
+
- \`knowledge({ action: "remember" })\` for decisions and conventions — Why: decisions must outlive the current conversation.
|
|
100
|
+
- \`checkpoint({ action: "save" })\` before risky multi-step changes — Why: it gives you a known milestone for recovery.
|
|
101
|
+
- \`blast_radius\` before shared-symbol edits — Why: public changes are rarely local.
|
|
102
|
+
- \`check\` and \`test_run\` after changes — Why: verification is cheaper than debugging assumptions later.
|
|
103
|
+
|
|
104
|
+
### End (do always)
|
|
105
|
+
|
|
106
|
+
- \`session_digest({ persist: true })\` — Why: captures tool trajectory and supports crash recovery.
|
|
107
|
+
- \`knowledge({ action: "remember", title: "Session checkpoint: <topic>" })\` — Why: the next session's first search is looking for exactly this.
|
|
108
|
+
- \`reindex\` after structural code changes — Why: stale index data makes every later search worse.
|
|
109
|
+
|
|
110
|
+
## Search Strategy
|
|
111
|
+
|
|
112
|
+
1. Start with \`search\` in hybrid mode unless you know you need exact identifiers.
|
|
113
|
+
2. Switch to \`symbol\` when the question is about one named thing.
|
|
114
|
+
3. Switch to \`trace\` when the question is flow, not location.
|
|
115
|
+
4. Switch to \`graph\` when the question is relationships between modules or importers.
|
|
116
|
+
5. Use \`compact\`, not raw file reads, once you know the file and the question.
|
|
117
|
+
|
|
118
|
+
## Judgment Patterns
|
|
119
|
+
|
|
120
|
+
### Understanding a New Area
|
|
121
|
+
|
|
122
|
+
~~~text
|
|
123
|
+
search → scope_map → file_summary/compact → graph or trace → stash
|
|
124
|
+
~~~
|
|
125
|
+
|
|
126
|
+
Use this when you need a fast mental model. Do not start with \`read_file\`.
|
|
127
|
+
|
|
128
|
+
### Investigating a Bug
|
|
129
|
+
|
|
130
|
+
~~~text
|
|
131
|
+
search → symbol → trace → compact → check/test_run → knowledge remember
|
|
132
|
+
~~~
|
|
133
|
+
|
|
134
|
+
Use this when the failure path matters more than file ownership.
|
|
135
|
+
|
|
136
|
+
### Refactoring Shared Code
|
|
137
|
+
|
|
138
|
+
~~~text
|
|
139
|
+
blast_radius → checkpoint → compact/file_summary → rename or codemod → check → test_run
|
|
140
|
+
~~~
|
|
141
|
+
|
|
142
|
+
Use this when contract breakage is more dangerous than local implementation detail.
|
|
143
|
+
|
|
144
|
+
### Picking the Right Tool
|
|
145
|
+
|
|
146
|
+
~~~text
|
|
147
|
+
list_tools → search_tools → describe_tool → execute
|
|
148
|
+
~~~
|
|
149
|
+
|
|
150
|
+
Use this instead of baking a static catalog into the skill. Tool metadata is live at runtime.
|
|
151
|
+
|
|
152
|
+
## Memory Discipline
|
|
153
|
+
|
|
154
|
+
- Use \`stash\` for temporary state you may need again in the same task.
|
|
155
|
+
- Use \`checkpoint\` for recoverable milestones in longer sessions.
|
|
156
|
+
- Use \`knowledge\` for decisions, conventions, non-obvious findings, and reusable lessons.
|
|
157
|
+
- Search curated memory before inventing a new pattern.
|
|
158
|
+
- Keep memory high-signal. Store what must survive, not everything you observed.
|
|
159
|
+
|
|
160
|
+
## Flows
|
|
161
|
+
|
|
162
|
+
Flows are the preferred path for guided multi-step work.
|
|
163
|
+
|
|
164
|
+
- Use \`flow({ action: 'status' })\` first to detect active work.
|
|
165
|
+
- Use \`flow({ action: 'list' })\` when the task looks repeatable or cross-cutting.
|
|
166
|
+
- Use \`flow({ action: 'read' })\` before acting inside a started flow.
|
|
167
|
+
- Use native agent workflow only when no flow matches the problem.
|
|
168
|
+
|
|
169
|
+
## Reference Docs
|
|
170
|
+
|
|
171
|
+
Load these only when the main skill is not enough:
|
|
172
|
+
|
|
173
|
+
- \`references/coordination.md\` — queue, lanes, stash, checkpoints, signaling
|
|
174
|
+
- \`references/forge-protocol.md\` — tiering, evidence, gates
|
|
175
|
+
- \`references/search-patterns.md\` — search, trace, graph, compression patterns
|
|
176
|
+
|
|
177
|
+
## NEVER
|
|
178
|
+
|
|
179
|
+
- NEVER use \`read_file\` to "understand" a file. \`file_summary\` gives structure in ~50 tokens instead of hundreds.
|
|
180
|
+
- NEVER use \`grep_search\` or \`semantic_search\` when \`search\` is available. \`search\` combines both strategies and ranks them.
|
|
181
|
+
- NEVER run tsc, lint, or tests through the terminal when \`check()\` and \`test_run()\` exist. Structured output beats terminal noise.
|
|
182
|
+
- NEVER skip \`status()\` at session start. If index state is unknown, every later choice is lower quality.
|
|
183
|
+
- NEVER call \`knowledge({ action: 'remember' })\` for trivial facts. Memory is for decisions, conventions, lessons, and durable findings.
|
|
184
|
+
- NEVER search the same thing twice without checking \`stash\` or prior results.
|
|
185
|
+
- NEVER use a long flat tool catalog as your primary routing aid. Use runtime discovery when you need exact tool metadata.
|
|
186
|
+
- NEVER jump to \`analyze\` for simple local questions. Start with cheaper retrieval and escalate only if needed.
|
|
187
|
+
- NEVER leave structural changes unindexed. Run \`reindex\` when symbols, files, or imports change.
|
|
188
|
+
|
|
189
|
+
## Complementary Skills
|
|
190
|
+
|
|
191
|
+
- Load \`typescript\` before TypeScript-heavy implementation work.
|
|
192
|
+
- Load \`react\` before React component or hooks work.
|
|
193
|
+
- Load \`session-handoff\` when context is filling up or a pause is imminent.
|
|
194
|
+
- Load \`repo-access\` when repo auth fails.
|
|
195
|
+
|
|
196
|
+
## Practical Defaults
|
|
197
|
+
|
|
198
|
+
- Default search mode: \`search\` with hybrid ranking.
|
|
199
|
+
- Default read path: \`file_summary\` then \`compact\`.
|
|
200
|
+
- Default validation pair: \`check\` then \`test_run\`.
|
|
201
|
+
- Default persistence: \`knowledge remember\` for durable findings, \`stash\` for everything temporary.
|
|
202
|
+
|
|
203
|
+
## Self-Dogfooding
|
|
204
|
+
|
|
205
|
+
When developing AI Kit itself, rebuild generated output before trusting runtime behavior, and reindex after structural changes so the toolkit can see its own new shape.
|
|
206
|
+
`},{file:`references/coordination.md`,content:`# Coordination
|
|
207
|
+
|
|
208
|
+
Use coordination tools when work is parallel, long-running, or easy to repeat incorrectly.
|
|
209
|
+
|
|
210
|
+
## Pick the Right Primitive
|
|
211
|
+
|
|
212
|
+
- \`queue\` for ordered task execution or DAG-style dependencies.
|
|
213
|
+
- \`lane\` for isolated exploration of alternative approaches.
|
|
214
|
+
- \`workset\` for named file groups you will revisit.
|
|
215
|
+
- \`stash\` for temporary intermediate results between tool calls.
|
|
216
|
+
- \`checkpoint\` for recoverable milestones before risky changes.
|
|
217
|
+
- \`signal\` for cross-agent status or file-level leases.
|
|
218
|
+
|
|
219
|
+
## Minimal Patterns
|
|
220
|
+
|
|
221
|
+
~~~text
|
|
222
|
+
Multi-step task: queue → next → done/fail
|
|
223
|
+
Try two approaches: lane create A/B → diff → merge winner
|
|
224
|
+
Need same files repeatedly: workset save → get
|
|
225
|
+
Need temporary findings later: stash set → get
|
|
226
|
+
About to make risky change: checkpoint save → edit → load only if recovery needed
|
|
227
|
+
Parallel agents: signal post/get or lease/unlease
|
|
228
|
+
~~~
|
|
229
|
+
|
|
230
|
+
## Rule of Thumb
|
|
231
|
+
|
|
232
|
+
If the problem is about sequence, use \`queue\`. If it is about comparison, use \`lane\`. If it is about memory within one effort, use \`stash\` or \`checkpoint\`.
|
|
233
|
+
`},{file:`references/forge-protocol.md`,content:`# FORGE Protocol
|
|
234
|
+
|
|
235
|
+
Use FORGE when the task is large enough that being "probably right" is not enough.
|
|
236
|
+
|
|
237
|
+
## Tiering
|
|
238
|
+
|
|
239
|
+
- Floor: single-file, low-blast-radius, few unknowns.
|
|
240
|
+
- Standard: multi-file or non-trivial. Default when unsure.
|
|
241
|
+
- Critical: schema, security, cross-service, or high-blast-radius work.
|
|
242
|
+
|
|
243
|
+
Start with \`forge_classify\` if tier is unknown. Use \`forge_ground\` when you want one call to classify, scope, load constraints, and seed evidence.
|
|
244
|
+
|
|
245
|
+
## Flow
|
|
246
|
+
|
|
247
|
+
~~~text
|
|
248
|
+
Ground → Build → Break → Gate
|
|
249
|
+
~~~
|
|
250
|
+
|
|
251
|
+
- Ground: classify task, gather constraints, identify unknowns.
|
|
252
|
+
- Build: implement with evidence-backed claims.
|
|
253
|
+
- Break: challenge assumptions and edge cases.
|
|
254
|
+
- Gate: evaluate evidence quality before declaring completion.
|
|
255
|
+
|
|
256
|
+
## Core Tools
|
|
257
|
+
|
|
258
|
+
- \`forge_classify\` to size ceremony.
|
|
259
|
+
- \`forge_ground\` to bootstrap full context.
|
|
260
|
+
- \`evidence_map\` to track verified, assumed, and unresolved claims.
|
|
261
|
+
- \`blast_radius\`, \`check\`, and \`test_run\` to verify the implementation actually holds.
|
|
262
|
+
|
|
263
|
+
## Rule of Thumb
|
|
264
|
+
|
|
265
|
+
If the task crosses boundaries or would be expensive to get wrong, pay the FORGE cost up front.
|
|
266
|
+
`},{file:`references/search-patterns.md`,content:`# Search Patterns
|
|
267
|
+
|
|
268
|
+
Use the smallest search primitive that answers the real question.
|
|
269
|
+
|
|
270
|
+
## Routing
|
|
271
|
+
|
|
272
|
+
~~~text
|
|
273
|
+
Need rough discovery? → search
|
|
274
|
+
Need one named thing? → symbol
|
|
275
|
+
Need real usage examples? → find({ mode: 'examples' })
|
|
276
|
+
Need call/data flow? → trace
|
|
277
|
+
Need import/module graph? → graph
|
|
278
|
+
Need file reading plan? → scope_map
|
|
279
|
+
Need one file section? → compact
|
|
280
|
+
Need many files compressed? → digest
|
|
281
|
+
~~~
|
|
282
|
+
|
|
283
|
+
## Heuristics
|
|
284
|
+
|
|
285
|
+
- Use \`search\` first when you know the topic but not the owner.
|
|
286
|
+
- Use \`symbol\` when the question is definition, imports, or refs.
|
|
287
|
+
- Use \`trace\` when you care about execution path.
|
|
288
|
+
- Use \`graph\` when you care about who depends on what.
|
|
289
|
+
- Use \`compact\` after you already know the file and the question.
|
|
290
|
+
- Use \`file_summary\` before \`compact\` if you still need structure.
|
|
291
|
+
|
|
292
|
+
## Compression Ladder
|
|
293
|
+
|
|
294
|
+
~~~text
|
|
295
|
+
file_summary → compact → digest → read_file only for edit lines
|
|
296
|
+
~~~
|
|
297
|
+
|
|
298
|
+
## Rule of Thumb
|
|
299
|
+
|
|
300
|
+
If you are about to read raw code, ask whether the answer is really about structure, relevance, flow, or relationships. AI Kit has a smaller tool for each of those.
|
|
328
301
|
`}];export{e as default};
|