@vpxa/aikit 0.1.308 → 0.1.310

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/package.json +1 -1
  2. package/packages/blocks-core/dist/index.mjs +5 -5
  3. package/packages/blocks-interactive/dist/index.d.mts +1 -1
  4. package/packages/blocks-interactive/dist/index.mjs +2 -2
  5. package/packages/browser/dist/index.js +8 -7
  6. package/packages/cli/dist/index.js +3 -3
  7. package/packages/cli/dist/{init-CyjUXjQw.js → init-DokIBPoi.js} +1 -1
  8. package/packages/cli/dist/{templates-BQ1J4HzY.js → templates-WMcV7ag2.js} +8 -8
  9. package/packages/present/dist/index.html +137 -93
  10. package/packages/server/dist/bin.js +1 -1
  11. package/packages/server/dist/index.js +1 -1
  12. package/packages/server/dist/repair-json-B6Q_HRoP.js +3 -0
  13. package/packages/server/dist/repair-json-D4mft_HA.js +4 -0
  14. package/packages/server/dist/{server-D6sJEw0I.js → server-CUEJEod-.js} +162 -164
  15. package/packages/server/dist/{server-http-B1ixOw2x.js → server-http-C2Vv-0lq.js} +1 -1
  16. package/packages/server/dist/{server-http-BurquBLf.js → server-http-DLqbe1NN.js} +1 -1
  17. package/packages/server/dist/server-stdio-RjYFfC_c.js +1 -0
  18. package/packages/server/dist/server-stdio-h8m_nhNo.js +2 -0
  19. package/packages/server/dist/{server-BSvqfFcK.js → server-uxrUzJ0L.js} +162 -164
  20. package/packages/server/viewers/c4-viewer.html +1 -1
  21. package/packages/server/viewers/canvas.html +4 -4
  22. package/packages/server/viewers/report-template.html +52 -52
  23. package/packages/server/viewers/task-plan-static.html +1 -1
  24. package/packages/server/viewers/tour-viewer.html +4 -4
  25. package/packages/tools/dist/index.d.ts +7 -0
  26. package/packages/tools/dist/index.js +71 -71
  27. package/scaffold/INSTRUCTIONS.md +273 -0
  28. package/scaffold/dist/adapters/copilot.mjs +2 -9
  29. package/scaffold/dist/adapters/hermes-agent.mjs +2 -2
  30. package/scaffold/dist/adapters/hermes.mjs +8 -4
  31. package/scaffold/dist/adapters/intellij.mjs +7 -3
  32. package/scaffold/dist/adapters/skills.mjs +3 -1
  33. package/scaffold/dist/adapters/zed.mjs +6 -2
  34. package/scaffold/dist/definitions/agents.mjs +2 -2
  35. package/scaffold/dist/definitions/bodies.mjs +100 -362
  36. package/scaffold/dist/definitions/protocols.mjs +109 -549
  37. package/scaffold/dist/definitions/skills/adr-skill.mjs +41 -197
  38. package/scaffold/dist/definitions/skills/aikit.mjs +52 -205
  39. package/scaffold/dist/definitions/skills/brainstorming.mjs +74 -112
  40. package/scaffold/dist/definitions/skills/browser-use.mjs +128 -184
  41. package/scaffold/dist/definitions/skills/c4-architecture.mjs +46 -107
  42. package/scaffold/dist/definitions/skills/docs.mjs +70 -214
  43. package/scaffold/dist/definitions/skills/frontend-design.mjs +96 -193
  44. package/scaffold/dist/definitions/skills/lesson-learned.mjs +57 -184
  45. package/scaffold/dist/definitions/skills/multi-agents-development.mjs +98 -408
  46. package/scaffold/dist/definitions/skills/present.mjs +193 -1
  47. package/scaffold/dist/definitions/skills/react.mjs +68 -111
  48. package/scaffold/dist/definitions/skills/repo-access.mjs +24 -169
  49. package/scaffold/dist/definitions/skills/requirements-clarity.mjs +45 -94
  50. package/scaffold/dist/definitions/skills/typescript.mjs +162 -230
  51. package/packages/server/dist/server-stdio-CBmXDMpq.js +0 -1
  52. package/packages/server/dist/server-stdio-z3_zG1HF.js +0 -2
@@ -421,7 +421,7 @@ Count checked items.
421
421
  | Verification says "it works" | Not testable | Ask: "what command proves it works?" |
422
422
  `},{file:`references/template-variants.md`,content:`# Template Variants
423
423
 
424
- This skill ships two templates in \`assets/templates/\`.
424
+ This skill ships decision templates and a README in \`assets/templates/\`.
425
425
 
426
426
  ## Simple
427
427
 
@@ -470,6 +470,12 @@ Aligns with [MADR 4.0](https://adr.github.io/madr/) plus agent-first sections.
470
470
  | Needs stakeholder review | No | Yes |
471
471
 
472
472
  When in doubt, start with Simple. Expand to MADR if needed.
473
+
474
+ ## Readme
475
+
476
+ File: \`assets/templates/adr-readme.md\`
477
+
478
+ A directory README that documents conventions, naming, status values, and lists ADRs. Use when introducing ADRs to a repo that has none — place alongside the ADR index.
473
479
  `},{file:`scripts/bootstrap_adr.js`,content:`#!/usr/bin/env node
474
480
  const fs=require('node:fs');
475
481
  const path=require('node:path');
@@ -868,211 +874,49 @@ metadata:
868
874
 
869
875
  # ADR Skill
870
876
 
871
- ## Quick Reference
872
-
873
- **Purpose:** Create ADRs agents can implement from without follow-up.
874
-
875
- **Write an ADR when:** decision changes system shape, is hard to reverse, affects other people/agents, or has real alternatives.
876
-
877
- **Four-Phase Workflow:**
878
- 1. **Discover** — surface intent, constraints, alternatives
879
- 2. **Draft** — fill Simple or MADR template with concrete constraints
880
- 3. **Validate** — review for agent-readiness (target ≥ 80%)
881
- 4. **Record** — save to \`docs/decisions/\` or \`adr/\`, update index
882
-
883
- **Two templates:**
884
- - **Simple** (≤3 options, single-team) — Context → Decision → Consequences → Implementation Plan → Alternatives
885
- - **MADR** (complex, multi-team) — adds drivers, options matrix, deeper plan
886
-
887
- **Commands:** Consult existing ADRs before impl. Create/update with scripts below.
888
-
889
- **Agent-readiness gate:** target ≥ 80%.
890
-
891
- ## Mindset
892
-
893
- Write for future readers with zero context. ADR = decision record, not meeting notes.
894
-
895
- ## Philosophy
896
-
897
- ADR must let an agent implement without follow-up: explicit constraints, concrete decision, follow-up tasks, non-goals, self-contained context, and an implementation plan.
898
-
899
- ## ADR Quality Criteria
900
-
901
- An ADR is agent-ready when it passes:
902
- - [ ] **Context is self-contained**
903
- - [ ] **Options include at least 2 genuine alternatives**
904
- - [ ] **Decision rationale cites concrete evidence**
905
- - [ ] **Consequences are bidirectional**
906
- - [ ] **Status is explicit**
907
- - [ ] **Superseded ADRs link to their replacement**
908
-
909
- ## When to Write an ADR
910
-
911
- Write an ADR when a decision:
912
-
913
- - **Changes how system is built or operated** (new dep, pattern, infra choice, API design)
914
- - **Is hard to reverse** once code is written against it
915
- - **Affects other people or agents** who will work in codebase later
916
- - **Has real alternatives** that were considered and rejected
917
-
918
- ## NEVER
919
-
920
- - **NEVER write ADR after impl** unless documenting discovery
921
- - **NEVER include only one option**
922
- - **NEVER use vague consequences**
923
- - **NEVER let ADRs linger in stale proposed state**
924
- - **NEVER modify an accepted ADR**; supersede instead
925
- - **NEVER write ADR for trivial decisions**
926
- - **NEVER skip rejected alternatives**
927
-
928
-
929
-
930
- ### Proactive ADR Triggers (For Agents)
931
-
932
- Stop and propose an ADR when you hit a new dependency, a new shared pattern, a non-obvious tradeoff, a conflict with an accepted ADR, or a long code comment explaining "why".
933
-
934
- **How to propose**: state decision, why it matters, ask whether to capture as ADR. If yes, run workflow. If no, note reasoning in code comment and move on.
935
-
936
- ## Creating an ADR: Four-Phase Workflow
937
-
938
- Every ADR goes through four phases. Do not skip them.
939
-
940
- ### Phase 0: Scan the Codebase
941
-
942
- Before questions, gather enough repo context to avoid contradictory ADRs:
943
-
944
- 1. **Find existing ADRs.** Check \`contributing/decisions/\`, \`docs/decisions/\`, \`adr/\`, \`docs/adr/\`, \`decisions/\`. Note dir, naming, status style, related ADRs, possible supersession.
945
- 2. **Check tech stack.** Read \`package.json\`, \`go.mod\`, \`requirements.txt\`, \`Cargo.toml\`, or equivalent for relevant deps and versions.
946
- 3. **Find related code patterns.** Identify files, dirs, and impl patterns affected.
947
- 4. **Look for ADR references in code.** Comments and docs often reveal governing decisions.
948
-
949
- ### Phase 1: Capture Intent (Socratic)
950
-
951
- Ask questions **one at a time**.
877
+ Use for consequential technical decisions: architecture, tech choice, hard-to-reverse tradeoff, public contract, >3 files, >1 team/agent, or user asks for ADR/decision record.
952
878
 
953
- **Core questions** (skip what Phase 0 or context already answered): title, why now, constraints, success criteria, real options, current lean, who decides, and what an agent needs to implement.
879
+ ## Workflow
954
880
 
955
- **Adaptive follow-ups**: probe fuzzy areas. Useful prompts: "What's worst case if this is wrong?", "What would make you revisit this in 6 months?", "I found [existing ADR/pattern] — does this interact with it?"
881
+ 1. Discover: decision, forces, constraints, alternatives, reversibility.
882
+ 2. Choose template: simple for small decisions, MADR for bigger context/tradeoffs.
883
+ 3. Draft ADR with status, context, decision, consequences, options considered.
884
+ 4. Validate agent-readiness: can an implementation agent act without follow-up?
885
+ 5. Update index/status links; mark supersedes/superseded-by when relevant.
956
886
 
957
- **When to stop**: stop only when every ADR section, especially Implementation Plan and Verification, can be filled without guessing.
887
+ ## Questions
958
888
 
959
- **Intent Summary Gate**: Before Phase 2, summarize title, trigger, constraints, options, lean, non-goals, related ADRs/code, affected files, and verification plan. Ask: **Does this capture your intent? Anything to add or correct?**
889
+ Ask only missing critical facts:
890
+ - What decision is being made?
891
+ - Why now?
892
+ - What alternatives are plausible?
893
+ - What constraints are fixed?
894
+ - What breaks if wrong?
895
+ - Who/what must implement or maintain it?
960
896
 
961
- Do NOT proceed to Phase 2 until human confirms summary.
897
+ ## Readiness Bar
962
898
 
963
- ### Phase 2: Draft the ADR
899
+ ADR is ready when it has:
900
+ - Decision stated in one sentence.
901
+ - Scope and non-goals.
902
+ - At least 2 alternatives or reason no real alternative exists.
903
+ - Consequences: benefits, costs, risks, migration work.
904
+ - Acceptance/rollback signals for future agents.
905
+ - Links to code/docs/issues when available.
964
906
 
965
- 1. **Choose the ADR directory.**
966
- - If one exists, use it.
967
- - If none exists, create \`contributing/decisions/\` (if \`contributing/\` exists), \`docs/decisions/\`, or \`adr/\`.
968
- 2. **Choose a filename strategy.**
969
- - If existing ADRs use date prefixes (\`YYYY-MM-DD-...\`), continue that.
970
- - Otherwise use slug-only filenames (\`choose-database.md\`).
971
- 3. **Choose a template.**
972
- - Use \`assets/templates/adr-simple.md\` for straightforward decisions.
973
- - Use \`assets/templates/adr-madr.md\` for multiple options with structured tradeoffs.
974
- - See \`references/template-variants.md\` if unsure.
975
- 4. **Fill every section from confirmed intent summary.** Remove placeholders.
976
- 5. **Write the Implementation Plan.** It tells next agent exactly what to do.
977
- 6. **Write Verification criteria as checkboxes.** They must be specific enough for manual or programmatic checking.
978
- 7. **Generate the file.** Preferred: run \`scripts/new_adr.js\`. Otherwise copy a template and fill it manually.
907
+ ## Files
979
908
 
980
- ### Phase 3: Review Against Checklist
909
+ Use bundled scripts/templates when available:
910
+ - scripts/bootstrap_adr.js — bootstrap ADR directory
911
+ - scripts/new_adr.js — create new ADR from template
912
+ - scripts/set_adr_status.js — update ADR status
913
+ - assets/templates/adr-simple.md — lightweight decision template
914
+ - assets/templates/adr-madr.md — options-heavy MADR template
915
+ - assets/templates/adr-readme.md — ADR directory README
981
916
 
982
- Review against inline quality criteria, then use \`references/review-checklist.md\` for full pass.
917
+ Load references on demand: references/adr-conventions.md, references/examples.md, references/review-checklist.md, references/template-variants.md.
983
918
 
984
- **Present the review as summary**, not raw checklist dump. Format:
985
-
986
- > **ADR Review**
987
- >
988
- > ✅ **Passes**: {list what's solid — e.g., "context is self-contained, implementation plan covers affected files, verification criteria are checkable"}
989
- >
990
- > ⚠️ **Gaps found**:
991
- >
992
- > - {specific gap 1 — e.g., "Implementation Plan doesn't mention test files — which test suite should cover this?"}
993
- > - {specific gap 2}
994
- >
995
- > **Recommendation**: {Ship it / Fix the gaps first / Needs more Phase 1 work}
996
-
997
- Surface failures and notable strengths only. If gaps exist, propose fixes. Do not finalize until ADR passes or human accepts gaps.
998
-
999
- ## Consulting ADRs (Read Workflow)
1000
-
1001
- Read existing ADRs **before implementing changes** in repos that have them.
1002
-
1003
- 1. **Before architecture work.**
1004
- 2. **Find ADR dir and index.** Start with accepted ADRs.
1005
- 3. **Read full ADR, not just title.**
1006
- 4. **Follow the Implementation Plan.**
1007
- 5. **Escalate conflicts or contradictions.**
1008
- 6. **Reference governing ADR in your work.**
1009
-
1010
- ## Code ↔ ADR Linking
1011
-
1012
- - **ADR → Code**: Implementation Plan names affected paths, patterns, config changes, verification commands.
1013
- - **Code → ADR**: add one lightweight comment at entry point linking back to governing ADR.
1014
-
1015
- ## Other Operations
1016
-
1017
- ### Update an Existing ADR
1018
-
1019
- 1. Identify intent: accept/reject, deprecate, supersede, or add learnings.
1020
- 2. Use \`scripts/set_adr_status.js\` for status changes.
1021
-
1022
- ### Post-Acceptance Lifecycle
1023
-
1024
- After an ADR is accepted:
1025
-
1026
- 1. **Create implementation tasks.**
1027
- 2. **Reference ADR in PRs.**
1028
- 3. **Add code references.**
1029
- 4. **Check verification criteria.** Update ADR with results in \`## More Information\`.
1030
- 5. **Revisit when triggers fire.**
1031
-
1032
- ### Index
1033
-
1034
- If repo has ADR index/log file, keep it updated.
1035
-
1036
- - Let \`scripts/new_adr.js --update-index\` handle it when possible.
1037
- - Otherwise add new ADR entry and keep ordering consistent.
1038
-
1039
- ### Bootstrap
1040
-
1041
- When introducing ADRs to repo that has none:
1042
-
1043
- \`\`\`bash
1044
- node scripts/bootstrap_adr.js
1045
- \`\`\`
1046
-
1047
- Creates dir, index, and first ADR.
1048
-
1049
- ## Resources
1050
-
1051
- ### scripts/
1052
-
1053
- - \`scripts/new_adr.js\`
1054
- - \`scripts/set_adr_status.js\`
1055
- - \`scripts/bootstrap_adr.js\`
1056
-
1057
- ### references/
1058
-
1059
- - \`references/review-checklist.md\`
1060
- - \`references/adr-conventions.md\`
1061
- - \`references/template-variants.md\`
1062
- - \`references/examples.md\`
1063
-
1064
- ### assets/
1065
-
1066
- - \`assets/templates/adr-simple.md\`
1067
- - \`assets/templates/adr-madr.md\`
1068
- - \`assets/templates/adr-readme.md\`
1069
-
1070
- ### Script Usage
1071
-
1072
- \`\`\`bash
1073
- node scripts/new_adr.js --title "Choose database" --status proposed
1074
- node scripts/bootstrap_adr.js --dir docs/decisions
1075
- \`\`\`
919
+ ## Output
1076
920
 
1077
- Use \`--dir\`, \`--strategy\`, and \`--json\` as needed.
921
+ Return created/updated ADR path, status, key decision, open questions, and implementation implications. Do not invent missing team intent; mark ASK USER.
1078
922
  `}];export{e as default};
@@ -10,233 +10,80 @@ metadata:
10
10
  relatedSkills: [session-handoff, present]
11
11
  ---
12
12
 
13
- # @vpxa/aikit AI Kit
13
+ # @vpxa/aikit - AI Kit
14
14
 
15
- > This skill provides DEEP GUIDANCE beyond base instructions. For tool routing rules, see your base instructions.
15
+ Use AI Kit as compression, memory, validation, and coordination layer. Each call should reduce uncertainty or token load.
16
16
 
17
- Local-first AI developer toolkit with 60+ tools for search, analysis, compression, validation, memory, flows, and coordination.
17
+ ## Session Loop
18
18
 
19
- ## When to Use
19
+ Start:
20
+ 1. status({ includePrelude: true }); onboard if missing.
21
+ 2. search({ query: "SESSION CHECKPOINT", origin: "curated" }).
22
+ 3. flow({ action: 'status' }) when active flow may exist.
23
+ 4. scope_map({ task }) for non-trivial work.
20
24
 
21
- - You need to understand unfamiliar code without raw-reading large files.
22
- - You need structured search across code, docs, and prior decisions.
23
- - You need typecheck, test, or audit results in structured form.
24
- - You need memory across sessions, not just within one conversation.
25
- - You need to estimate blast radius before changing shared code.
26
- - You need guided flows, FORGE gates, or coordination primitives.
25
+ During:
26
+ - Prefer search/file_summary/compact/digest/symbol/trace/graph over raw reads.
27
+ - Use stash for temporary findings; knowledge for durable decisions.
28
+ - Run blast_radius before shared/public edits.
29
+ - Validate with check + relevant test_run.
27
30
 
28
- ## Mindset
31
+ End:
32
+ - reindex after structural changes.
33
+ - produce_knowledge for durable project updates.
34
+ - session_digest({ persist: true }).
35
+ - knowledge remember session checkpoint with done/decisions/next/blockers.
29
36
 
30
- AI Kit tools are a compression layer. Their job is to prevent agents from wasting tokens on raw file reads and flat text search.
37
+ ## Retrieval Ladder
31
38
 
32
- Every call should reduce context, not add to it.
39
+ | Need | Tool |
40
+ |---|---|
41
+ | Prior decisions/conventions | search / knowledge |
42
+ | File structure | file_summary |
43
+ | Exact relevant section | compact |
44
+ | Many files | digest |
45
+ | Symbol defs/refs | symbol |
46
+ | Call/data flow | trace |
47
+ | Module/import relationships | graph |
48
+ | Impact | blast_radius |
49
+ | Type/lint/test | check / test_run |
50
+ | Tool choice unknown | list_tools -> search_tools -> describe_tool |
33
51
 
34
- Think: what's the minimum I need to read to act? Then choose the tool that gives exactly that.
52
+ Raw read_file only for exact edit lines after compressed tools identify target.
35
53
 
36
- Common mistake: using \`read_file\` out of habit. That is the last resort, not the first.
54
+ ## Context Reuse
37
55
 
38
- Default progression: \`file_summary\` \`compact\` \`digest\` \`read_file\` only for exact edit lines.
56
+ Before rereading path/topic, search exact path/topic first. If response gives ctxc_..., reuse with compact({ ref }) or compact({ ref, query }). Use enrich: true on tools that support it after first pass.
39
57
 
40
- 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\`.
58
+ ## Patterns
41
59
 
42
- ## Operating Model
43
-
44
- 1. Orient with compressed retrieval, not raw reads.
45
- 2. Validate with structured tools, not noisy terminal output.
46
- 3. Persist decisions that future sessions must reuse.
47
- 4. Reuse previous context before searching again.
48
- 5. Use reference docs only when the main routing logic is not enough.
49
-
50
- **When tools return empty:**
51
- - \`search\` → 0 results? Broaden query terms OR fall back to \`find({ pattern })\` with regex
52
- - \`symbol\` → not found? Check spelling, try \`search\` with partial name
53
- - \`compact\` → irrelevant content? Refine \`query\` parameter or try different \`segmentation\`
54
-
55
- ## Session Protocol
56
-
57
- ### Why This Matters
58
-
59
- Without session discipline, agents repeat work, miss context, and make decisions that contradict earlier choices. These steps exist to keep work cumulative.
60
-
61
- ### Start (do first, every session)
62
-
63
- 1. \`status({})\` — Why: confirms index is built, tools are ready, and onboard state is known. Skipping this causes tool-avoidance and blind exploration.
64
- 2. \`search({ query: "SESSION CHECKPOINT", origin: "curated" })\` — Why: pulls prior session context so you do not re-solve finished work.
65
- 3. \`scope_map({ task })\` — Why: creates a reading plan before exploration, which prevents broad wandering.
66
- 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.
67
- 5. If onboard is missing, run \`onboard({ path: "." })\` — Why: AI Kit is strongest after structure, patterns, and symbols are pre-analyzed.
68
-
69
- ### During (do continuously)
70
-
71
- - \`stash({ action: "set", key, value })\` for intermediate results — Why: chat context compresses; stash survives it.
72
- - \`knowledge({ action: "remember" })\` for decisions and conventions — Why: decisions must outlive the current conversation.
73
- - \`checkpoint({ action: "save" })\` before risky multi-step changes — Why: it gives you a known milestone for recovery.
74
- - \`blast_radius\` before shared-symbol edits — Why: public changes are rarely local.
75
- - \`check\` and \`test_run\` after changes — Why: verification is cheaper than debugging assumptions later.
76
-
77
- ### End (do always)
78
-
79
- - \`session_digest({ persist: true })\` — Why: captures tool trajectory and supports crash recovery.
80
- - \`knowledge({ action: "remember", title: "Session checkpoint: <topic>" })\` — Why: the next session's first search is looking for exactly this.
81
- - \`reindex\` after structural code changes — Why: stale index data makes every later search worse.
82
- - \`knowledge({ action: "flagged" })\` periodically (not every session, but every few) — Why: decayed entries accumulate; reviewing them prevents stale advice from persisting.
83
-
84
- ## Anti-Patterns (NEVER)
85
-
86
- - NEVER \`search\` then immediately \`read_file\` the result — search already returns content snippets
87
- - NEVER call \`compact\` on a file you just \`file_summary\`'d — pick one retrieval depth
88
- - NEVER stash >10 items without \`checkpoint\` — stash has no TTL, checkpoints do
89
- - NEVER run \`reindex\` mid-implementation — wait until all edits are done
90
- - NEVER skip \`search\` before implementing — past decisions may exist that constrain your approach
91
- - NEVER echo full subagent output to user — compress with \`stash\` + brief summary
92
-
93
- ## Search Strategy
94
-
95
- 1. Start with \`search\` in hybrid mode unless you know you need exact identifiers.
96
- 2. Switch to \`symbol\` when the question is about one named thing.
97
- 3. Switch to \`trace\` when the question is flow, not location.
98
- 4. Switch to \`graph\` when the question is relationships between modules or importers.
99
- 5. Use \`compact\`, not raw file reads, once you know the file and the question.
100
-
101
- ## Judgment Patterns
102
-
103
- ### Understanding a New Area
104
-
105
- ~~~text
106
- search → scope_map → file_summary/compact → graph or trace → stash
107
- ~~~
108
-
109
- Use this when you need a fast mental model. Do not start with \`read_file\`.
110
-
111
- ### Investigating a Bug
112
-
113
- ~~~text
114
- search → symbol → trace → compact → check/test_run → knowledge remember
115
- ~~~
116
-
117
- Use this when the failure path matters more than file ownership.
118
-
119
- ### Refactoring Shared Code
120
-
121
- ~~~text
122
- blast_radius → checkpoint → compact/file_summary → rename or codemod → check → test_run
123
- ~~~
124
-
125
- Use this when contract breakage is more dangerous than local implementation detail.
126
-
127
- ### Picking the Right Tool
128
-
129
- ~~~text
130
- list_tools → search_tools → describe_tool → execute
131
- ~~~
132
-
133
- Use this instead of baking a static catalog into the skill. Tool metadata is live at runtime.
60
+ - New area: search -> scope_map -> file_summary/compact -> graph/trace -> stash.
61
+ - Bug: search -> symbol -> trace -> compact -> test/check -> remember.
62
+ - Refactor shared code: blast_radius -> checkpoint -> compact -> rename/codemod -> check -> test_run.
63
+ - Web/API: web_search/web_fetch/http; browser only when JS/auth interaction needed.
134
64
 
135
65
  ## Memory Discipline
136
66
 
137
- - Use \`stash\` for temporary state you may need again in the same task.
138
- - Use \`checkpoint\` for recoverable milestones in longer sessions.
139
- - Use \`knowledge\` for decisions, conventions, non-obvious findings, and reusable lessons.
140
- - Search curated memory before inventing a new pattern.
141
- - Keep memory high-signal. Store what must survive, not everything you observed.
142
-
143
- ## Memory Lifecycle
144
-
145
- AI Kit auto-captures knowledge from tool outputs. Know what it captures so you can leverage it.
146
-
147
- ### Auto-Knowledge Capture
148
-
149
- Every tool call passes through extractors that capture reusable facts:
150
-
151
- | Extractor | Tools Covered | What It Captures |
152
- |-----------|--------------|-----------------|
153
- | **Content reads** | \`compact\`, \`file_summary\`, \`digest\`, \`lookup\`, \`stratum_card\` | File structure, exports, compressed sections |
154
- | **Symbol analysis** | \`symbol\`, \`trace\`, \`graph\` (read-only) | Definitions, references, call chains, module relationships |
155
- | **Research results** | \`web_search\`, \`web_fetch\`, \`search\`, \`find\` | Search findings, web content, code discoveries |
156
- | **Behavioral patterns** | ALL tools (ring buffer) | Tool preferences, search→edit sequences, error-fix cycles |
157
-
158
- **Refresh model:** High-use extractors should converge on stable facts keyed by path, task, query, or analysis scope. Revisiting the same thing should refresh or no-op instead of multiplying near-duplicate memory.
159
-
160
- **Retrieval:** Use \`enrich: true\` on any tool that supports it — the server automatically surfaces previously captured facts relevant to your query. Search/find/knowledge responses can also emit reusable \`ctxc_...\` refs; pass them as \`ref\` to \`compact({ ref })\` or \`compact({ ref, query? })\` instead of reopening the source. \`ctxc_...\` is a reversible ref, not an id or path.
161
-
162
- **Best practice:** Before re-reading a file you've already explored, try \`search({ query: "exact-file-path-or-topic" })\` first. If you already have a \`ctxc_...\` ref, reuse it with \`compact({ ref })\` or \`compact({ ref, query? })\`. Reach for fresh \`file_summary\` / \`scope_map\` calls only when the topic materially changed or retrieval came back thin.
163
-
164
- ### Retention & Tier Promotion
165
- - Memories start at **working** tier → promote on repeated access: episodic (2) → semantic (5) → procedural (10)
166
- - Unused entries decay via Ebbinghaus curve. Re-accessing important memories strengthens them.
167
- - Check decayed entries: \`knowledge({ action: "flagged" })\` — review, refresh important ones, forget stale ones.
168
-
169
- ### Lessons
170
-
171
- Capture reusable engineering insights via \`knowledge({ action: "lesson", subAction: "create" })\`. Confirm with \`confirm\`, contradict with \`contradict\`, list with \`list-lessons\`. Confidence 60-70 for single-observation, 80+ when multiple diffs confirm. Auto-archived below 20 confidence after contradictions.
172
-
173
- See the \`lesson-learned\` skill for the full extraction workflow.
174
-
175
- ### Lesson Lifecycle Management
176
-
177
- | SubAction | Purpose | Default |
178
- |-----------|---------|---------|
179
- | \`prune\` | Archive stale lessons (confidence < 15, idle > 30d) | dryRun: true |
180
- | \`group\` | Cluster similar lessons, add group tags | dryRun: true |
181
- | \`promote\` | Cross-workspace promotion to global store | dryRun: true |
182
- | \`demote\` | Remove from global store | -- |
183
- | \`auto-observe\` | Pattern detection from tool outputs | automatic |
184
-
185
- **Maintenance workflow** (periodic):
186
- \`\`\`
187
- knowledge({ action: "lesson", subAction: "prune" }) // review stale
188
- knowledge({ action: "lesson", subAction: "group" }) // organize
189
- knowledge({ action: "lesson", subAction: "promote" }) // share universal
190
- \`\`\`
191
-
192
- ### Session Prelude
193
- Request context-primed session start:
194
- \`\`\`
195
- status({ includePrelude: true })
196
- \`\`\`
197
- Returns: top 3 lessons (by decayed confidence), top 2 conventions (by recency), last session checkpoint.
198
- Use at session start for immediate situational awareness.
199
-
200
- ### Confidence Decay
201
- Lesson confidence decays over time via Ebbinghaus curve:
202
- - Accessing lessons (via withdraw, list-lessons) implicitly reinforces them
203
- - Unaccessed lessons gradually lose confidence
204
- - Below threshold 15 + idle > 30 days -> eligible for pruning
205
- - \`knowledge({ action: "flagged" })\` surfaces decayed entries for review
206
-
207
- ### Supersession (automatic dedup)
208
- When you \`remember()\`, similar entries are detected automatically:
209
- - Jaccard > 0.7 → flagged for review
210
- - Jaccard > 0.95 → auto-superseded (replaced)
211
- - Use \`force: true\` to explicitly supersede flagged entries
212
-
213
- ## Flows
214
-
215
- Flows are the preferred path for guided multi-step work.
216
-
217
- - Use \`flow({ action: 'status' })\` first to detect active work.
218
- - Use \`flow({ action: 'list' })\` when the task looks repeatable or cross-cutting.
219
- - Use \`flow({ action: 'read' })\` before acting inside a started flow.
220
- - Use native agent workflow only when no flow matches the problem.
221
-
222
- ## Reference Docs
67
+ Store only high-signal facts:
68
+ - Decisions and rationale.
69
+ - Conventions that constrain future work.
70
+ - Non-obvious root causes and fixes.
71
+ - Checkpoints and blockers.
223
72
 
224
- Load these only when the main skill is not enough:
73
+ Review decayed/stale entries periodically with knowledge({ action: 'flagged' }). Use lesson actions for reusable engineering lessons; load lesson-learned after implementation/review work.
225
74
 
226
- - \`references/coordination.md\` queue, lanes, stash, checkpoints, signaling
227
- - \`references/forge-protocol.md\` — tiering, evidence, gates
228
- - \`references/search-patterns.md\` — search, trace, graph, compression patterns
75
+ ## Flow + FORGE
229
76
 
230
- ## Complementary Skills
77
+ Flows guide multi-step work. Read active step before acting. FORGE handles tiering/evidence/gates; load references only when main skill is too thin.
231
78
 
232
- - Load \`typescript\` before TypeScript-heavy implementation work.
233
- - Load \`react\` before React component or hooks work.
234
- - Load \`session-handoff\` when context is filling up or a pause is imminent.
235
- - Load \`repo-access\` when repo auth fails.
79
+ Reference docs:
80
+ - references/coordination.md - queue, lanes, stash, checkpoints, signaling.
81
+ - references/forge-protocol.md - tiering, evidence, gates.
82
+ - references/search-patterns.md - search, trace, graph, compression recipes.
236
83
 
237
84
  ## Self-Dogfooding
238
85
 
239
- 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.
86
+ When developing AI Kit itself: regenerate scaffold output, run focused checks, rebuild, then reindex so future searches see new shape.
240
87
  `},{file:`references/coordination.md`,content:`# Coordination
241
88
 
242
89
  Use coordination tools when work is parallel, long-running, or easy to repeat incorrectly.