@rkarim08/sia 1.0.0

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 (355) hide show
  1. package/.claude-plugin/marketplace.json +35 -0
  2. package/.claude-plugin/plugin.json +27 -0
  3. package/.mcp.json +13 -0
  4. package/CLAUDE.md +226 -0
  5. package/LICENSE +202 -0
  6. package/PLUGIN_README.md +253 -0
  7. package/README.md +1013 -0
  8. package/agents/sia-changelog-writer.md +89 -0
  9. package/agents/sia-code-reviewer.md +86 -0
  10. package/agents/sia-conflict-resolver.md +100 -0
  11. package/agents/sia-convention-enforcer.md +69 -0
  12. package/agents/sia-debug.md +106 -0
  13. package/agents/sia-decision-reviewer.md +101 -0
  14. package/agents/sia-dependency-tracker.md +80 -0
  15. package/agents/sia-explain.md +126 -0
  16. package/agents/sia-feature.md +116 -0
  17. package/agents/sia-knowledge-capture.md +117 -0
  18. package/agents/sia-lead-architecture-advisor.md +93 -0
  19. package/agents/sia-lead-team-health.md +107 -0
  20. package/agents/sia-migration.md +100 -0
  21. package/agents/sia-onboarding.md +115 -0
  22. package/agents/sia-orientation.md +99 -0
  23. package/agents/sia-pm-briefing.md +106 -0
  24. package/agents/sia-pm-risk-advisor.md +82 -0
  25. package/agents/sia-qa-analyst.md +116 -0
  26. package/agents/sia-qa-regression-map.md +94 -0
  27. package/agents/sia-refactor.md +115 -0
  28. package/agents/sia-regression.md +112 -0
  29. package/agents/sia-security-audit.md +125 -0
  30. package/agents/sia-test-advisor.md +91 -0
  31. package/hooks/hooks.json +98 -0
  32. package/migrations/bridge/001_initial.sql +34 -0
  33. package/migrations/episodic/001_initial.sql +35 -0
  34. package/migrations/meta/001_initial.sql +68 -0
  35. package/migrations/semantic/001_initial.sql +292 -0
  36. package/migrations/semantic/002_ontology.sql +89 -0
  37. package/migrations/semantic/003_freshness.sql +63 -0
  38. package/migrations/semantic/004_v5_unified_schema.sql +194 -0
  39. package/migrations/semantic/005_backfill_event_kinds.sql +8 -0
  40. package/migrations/semantic/006_tree_sitter.sql +6 -0
  41. package/migrations/semantic/007_branch_snapshots.sql +22 -0
  42. package/package.json +110 -0
  43. package/scripts/branch-switch.sh +13 -0
  44. package/scripts/build-wasm-grammars.sh +81 -0
  45. package/scripts/post-compact.sh +8 -0
  46. package/scripts/post-tool-use.sh +10 -0
  47. package/scripts/pre-compact.sh +8 -0
  48. package/scripts/session-end.sh +8 -0
  49. package/scripts/session-start.sh +8 -0
  50. package/scripts/start-mcp.ts +45 -0
  51. package/scripts/stop-hook.sh +8 -0
  52. package/scripts/user-prompt-submit.sh +8 -0
  53. package/scripts/viz-server.ts +152 -0
  54. package/skills/sia-brainstorm/SKILL.md +156 -0
  55. package/skills/sia-brainstorm/scripts/frame-template.html +214 -0
  56. package/skills/sia-brainstorm/scripts/helper.js +95 -0
  57. package/skills/sia-brainstorm/scripts/server.cjs +338 -0
  58. package/skills/sia-brainstorm/scripts/start-server.sh +153 -0
  59. package/skills/sia-brainstorm/scripts/stop-server.sh +55 -0
  60. package/skills/sia-brainstorm/spec-document-reviewer-prompt.md +49 -0
  61. package/skills/sia-brainstorm/visual-companion.md +286 -0
  62. package/skills/sia-capture/SKILL.md +64 -0
  63. package/skills/sia-compare/SKILL.md +33 -0
  64. package/skills/sia-conflicts/SKILL.md +38 -0
  65. package/skills/sia-debug-workflow/SKILL.md +120 -0
  66. package/skills/sia-debug-workflow/root-cause-tracing.md +70 -0
  67. package/skills/sia-debug-workflow/scripts/find-polluter.sh +64 -0
  68. package/skills/sia-debug-workflow/temporal-investigation.md +72 -0
  69. package/skills/sia-digest/SKILL.md +23 -0
  70. package/skills/sia-dispatch/SKILL.md +69 -0
  71. package/skills/sia-dispatch/agent-task-template.md +99 -0
  72. package/skills/sia-doctor/SKILL.md +39 -0
  73. package/skills/sia-execute/SKILL.md +70 -0
  74. package/skills/sia-execute-plan/SKILL.md +85 -0
  75. package/skills/sia-export-import/SKILL.md +49 -0
  76. package/skills/sia-export-knowledge/SKILL.md +46 -0
  77. package/skills/sia-finish/SKILL.md +100 -0
  78. package/skills/sia-finish/pr-summary-template.md +54 -0
  79. package/skills/sia-freshness/SKILL.md +38 -0
  80. package/skills/sia-history/SKILL.md +42 -0
  81. package/skills/sia-impact/SKILL.md +70 -0
  82. package/skills/sia-index/SKILL.md +54 -0
  83. package/skills/sia-install/SKILL.md +39 -0
  84. package/skills/sia-lead-compliance/SKILL.md +16 -0
  85. package/skills/sia-lead-drift-report/SKILL.md +16 -0
  86. package/skills/sia-lead-knowledge-map/SKILL.md +16 -0
  87. package/skills/sia-learn/SKILL.md +58 -0
  88. package/skills/sia-plan/SKILL.md +68 -0
  89. package/skills/sia-plan/plan-reviewer-prompt.md +63 -0
  90. package/skills/sia-playbooks/SKILL.md +29 -0
  91. package/skills/sia-playbooks/reference-feature.md +100 -0
  92. package/skills/sia-playbooks/reference-flagging.md +50 -0
  93. package/skills/sia-playbooks/reference-orientation.md +92 -0
  94. package/skills/sia-playbooks/reference-regression.md +115 -0
  95. package/skills/sia-playbooks/reference-review.md +64 -0
  96. package/skills/sia-playbooks/reference-tools.md +239 -0
  97. package/skills/sia-pm-decision-log/SKILL.md +28 -0
  98. package/skills/sia-pm-risk-dashboard/SKILL.md +24 -0
  99. package/skills/sia-pm-sprint-summary/SKILL.md +27 -0
  100. package/skills/sia-prune/SKILL.md +45 -0
  101. package/skills/sia-qa-coverage/SKILL.md +28 -0
  102. package/skills/sia-qa-flaky/SKILL.md +20 -0
  103. package/skills/sia-qa-report/SKILL.md +26 -0
  104. package/skills/sia-reindex/SKILL.md +30 -0
  105. package/skills/sia-review-respond/SKILL.md +88 -0
  106. package/skills/sia-review-respond/pushback-patterns.md +90 -0
  107. package/skills/sia-search/SKILL.md +47 -0
  108. package/skills/sia-setup/SKILL.md +82 -0
  109. package/skills/sia-setup/setup-checklist.md +97 -0
  110. package/skills/sia-stats/SKILL.md +36 -0
  111. package/skills/sia-status/SKILL.md +44 -0
  112. package/skills/sia-sync/SKILL.md +46 -0
  113. package/skills/sia-team/SKILL.md +64 -0
  114. package/skills/sia-test/SKILL.md +92 -0
  115. package/skills/sia-test/testing-anti-patterns.md +104 -0
  116. package/skills/sia-tour/SKILL.md +29 -0
  117. package/skills/sia-upgrade/SKILL.md +43 -0
  118. package/skills/sia-verify/SKILL.md +81 -0
  119. package/skills/sia-visualize/SKILL.md +28 -0
  120. package/skills/sia-visualize-live/SKILL.md +55 -0
  121. package/skills/sia-visualize-live/scripts/graph-template.html +389 -0
  122. package/skills/sia-visualize-live/scripts/start-visualizer.sh +161 -0
  123. package/skills/sia-visualize-live/scripts/stop-visualizer.sh +55 -0
  124. package/skills/sia-visualize-live/scripts/visualizer-server.cjs +264 -0
  125. package/skills/sia-workspace/SKILL.md +57 -0
  126. package/src/agent/claude-md-template-flagging.md +219 -0
  127. package/src/agent/claude-md-template.md +213 -0
  128. package/src/agent/modules/sia-feature.md +100 -0
  129. package/src/agent/modules/sia-flagging.md +50 -0
  130. package/src/agent/modules/sia-orientation.md +92 -0
  131. package/src/agent/modules/sia-regression.md +115 -0
  132. package/src/agent/modules/sia-review.md +64 -0
  133. package/src/agent/modules/sia-tools.md +239 -0
  134. package/src/ast/extractors/c-include.ts +189 -0
  135. package/src/ast/extractors/csharp-project.ts +260 -0
  136. package/src/ast/extractors/prisma-schema.ts +44 -0
  137. package/src/ast/extractors/project-manifest.ts +111 -0
  138. package/src/ast/extractors/sql-schema.ts +67 -0
  139. package/src/ast/extractors/tier-a.ts +423 -0
  140. package/src/ast/extractors/tier-b.ts +289 -0
  141. package/src/ast/extractors/tier-dispatch.ts +247 -0
  142. package/src/ast/index-worker.ts +108 -0
  143. package/src/ast/indexer.ts +484 -0
  144. package/src/ast/languages.ts +408 -0
  145. package/src/ast/pagerank-builder.ts +125 -0
  146. package/src/ast/path-utils.ts +137 -0
  147. package/src/ast/tree-sitter/backends/native.ts +57 -0
  148. package/src/ast/tree-sitter/backends/wasm.ts +39 -0
  149. package/src/ast/tree-sitter/call-walker.ts +44 -0
  150. package/src/ast/tree-sitter/edit-computer.ts +55 -0
  151. package/src/ast/tree-sitter/query-runner.ts +46 -0
  152. package/src/ast/tree-sitter/service.ts +174 -0
  153. package/src/ast/tree-sitter/tree-cache.ts +39 -0
  154. package/src/ast/tree-sitter/types.ts +79 -0
  155. package/src/ast/watcher.ts +322 -0
  156. package/src/capture/chunker.ts +169 -0
  157. package/src/capture/consolidate.ts +127 -0
  158. package/src/capture/edge-inferrer.ts +161 -0
  159. package/src/capture/embedder.ts +166 -0
  160. package/src/capture/embedding-cache.ts +73 -0
  161. package/src/capture/flag-processor.ts +64 -0
  162. package/src/capture/hook.ts +67 -0
  163. package/src/capture/pipeline.ts +450 -0
  164. package/src/capture/prompts/consolidate.ts +25 -0
  165. package/src/capture/prompts/edge-infer.ts +29 -0
  166. package/src/capture/prompts/extract-flagged.ts +36 -0
  167. package/src/capture/prompts/extract.ts +42 -0
  168. package/src/capture/tokenizer.ts +147 -0
  169. package/src/capture/track-a-ast.ts +93 -0
  170. package/src/capture/track-b-llm.ts +149 -0
  171. package/src/capture/types.ts +64 -0
  172. package/src/cli/commands/community.ts +137 -0
  173. package/src/cli/commands/compare.ts +123 -0
  174. package/src/cli/commands/conflicts.ts +41 -0
  175. package/src/cli/commands/digest.ts +197 -0
  176. package/src/cli/commands/disable-flagging.ts +34 -0
  177. package/src/cli/commands/doctor.ts +240 -0
  178. package/src/cli/commands/download-model.ts +161 -0
  179. package/src/cli/commands/enable-flagging.ts +34 -0
  180. package/src/cli/commands/export-knowledge.ts +208 -0
  181. package/src/cli/commands/export.ts +85 -0
  182. package/src/cli/commands/freshness.ts +164 -0
  183. package/src/cli/commands/graph.ts +51 -0
  184. package/src/cli/commands/history.ts +139 -0
  185. package/src/cli/commands/import.ts +335 -0
  186. package/src/cli/commands/install.ts +156 -0
  187. package/src/cli/commands/lead-report.ts +241 -0
  188. package/src/cli/commands/learn.ts +321 -0
  189. package/src/cli/commands/pm-report.ts +413 -0
  190. package/src/cli/commands/prune.ts +75 -0
  191. package/src/cli/commands/qa-report.ts +278 -0
  192. package/src/cli/commands/reindex.ts +104 -0
  193. package/src/cli/commands/rollback.ts +70 -0
  194. package/src/cli/commands/search.ts +103 -0
  195. package/src/cli/commands/server.ts +91 -0
  196. package/src/cli/commands/share.ts +33 -0
  197. package/src/cli/commands/stats.ts +79 -0
  198. package/src/cli/commands/status.ts +176 -0
  199. package/src/cli/commands/sync.ts +96 -0
  200. package/src/cli/commands/team.ts +118 -0
  201. package/src/cli/commands/tour.ts +157 -0
  202. package/src/cli/commands/visualize-live.ts +162 -0
  203. package/src/cli/commands/workspace.ts +117 -0
  204. package/src/cli/index.ts +424 -0
  205. package/src/cli/learn-progress.ts +87 -0
  206. package/src/community/detection-bridge.ts +344 -0
  207. package/src/community/leiden.ts +462 -0
  208. package/src/community/raptor.ts +210 -0
  209. package/src/community/scheduler.ts +74 -0
  210. package/src/community/summarize.ts +115 -0
  211. package/src/decay/archiver.ts +73 -0
  212. package/src/decay/bridge-orphan-cleanup.ts +212 -0
  213. package/src/decay/consolidation-sweep.ts +112 -0
  214. package/src/decay/decay.ts +116 -0
  215. package/src/decay/deep-validator.ts +62 -0
  216. package/src/decay/episodic-promoter.ts +132 -0
  217. package/src/decay/maintenance-scheduler.ts +326 -0
  218. package/src/decay/scheduler.ts +6 -0
  219. package/src/decay/session-sweeper.ts +79 -0
  220. package/src/decay/types.ts +17 -0
  221. package/src/freshness/confidence-decay.ts +122 -0
  222. package/src/freshness/cuckoo-filter.ts +176 -0
  223. package/src/freshness/deep-validation.ts +345 -0
  224. package/src/freshness/dirty-tracker.ts +237 -0
  225. package/src/freshness/file-watcher-layer.ts +119 -0
  226. package/src/freshness/firewall.ts +64 -0
  227. package/src/freshness/git-reconcile-layer.ts +161 -0
  228. package/src/freshness/inverted-index.ts +158 -0
  229. package/src/freshness/stale-read-layer.ts +222 -0
  230. package/src/graph/audit.ts +69 -0
  231. package/src/graph/bridge-db.ts +141 -0
  232. package/src/graph/communities.ts +195 -0
  233. package/src/graph/db-interface.ts +259 -0
  234. package/src/graph/edges.ts +163 -0
  235. package/src/graph/entities.ts +327 -0
  236. package/src/graph/episodic-db.ts +113 -0
  237. package/src/graph/flags.ts +31 -0
  238. package/src/graph/meta-db.ts +200 -0
  239. package/src/graph/semantic-db.ts +101 -0
  240. package/src/graph/session-resume.ts +56 -0
  241. package/src/graph/snapshots.ts +342 -0
  242. package/src/graph/staging.ts +151 -0
  243. package/src/graph/types.ts +128 -0
  244. package/src/hooks/adapters/claude-code.ts +21 -0
  245. package/src/hooks/adapters/cline.ts +43 -0
  246. package/src/hooks/adapters/cursor.ts +65 -0
  247. package/src/hooks/adapters/generic.ts +12 -0
  248. package/src/hooks/agent-detect.ts +34 -0
  249. package/src/hooks/claude-md-directives.ts +32 -0
  250. package/src/hooks/event-router.ts +182 -0
  251. package/src/hooks/extractors/pattern-detector.ts +111 -0
  252. package/src/hooks/handlers/post-compact.ts +30 -0
  253. package/src/hooks/handlers/post-tool-use.ts +403 -0
  254. package/src/hooks/handlers/pre-compact.ts +100 -0
  255. package/src/hooks/handlers/session-end.ts +47 -0
  256. package/src/hooks/handlers/session-start.ts +154 -0
  257. package/src/hooks/handlers/stop.ts +128 -0
  258. package/src/hooks/handlers/user-prompt-submit.ts +68 -0
  259. package/src/hooks/plugin-branch-switch.ts +68 -0
  260. package/src/hooks/plugin-common.ts +47 -0
  261. package/src/hooks/plugin-post-compact.ts +28 -0
  262. package/src/hooks/plugin-post-tool-use.ts +38 -0
  263. package/src/hooks/plugin-pre-compact.ts +37 -0
  264. package/src/hooks/plugin-session-end.ts +37 -0
  265. package/src/hooks/plugin-session-start.ts +75 -0
  266. package/src/hooks/plugin-stop.ts +61 -0
  267. package/src/hooks/plugin-user-prompt-submit.ts +47 -0
  268. package/src/hooks/types.ts +43 -0
  269. package/src/knowledge/discovery.ts +238 -0
  270. package/src/knowledge/external-refs.ts +98 -0
  271. package/src/knowledge/freshness.ts +221 -0
  272. package/src/knowledge/ingest.ts +330 -0
  273. package/src/knowledge/markdown-export.ts +229 -0
  274. package/src/knowledge/markdown-import.ts +359 -0
  275. package/src/knowledge/patterns.ts +74 -0
  276. package/src/knowledge/templates.ts +307 -0
  277. package/src/llm/ai-sdk-adapter.ts +46 -0
  278. package/src/llm/config.ts +88 -0
  279. package/src/llm/cost-tracker.ts +110 -0
  280. package/src/llm/prompts/extraction.ts +55 -0
  281. package/src/llm/prompts/summarization.ts +36 -0
  282. package/src/llm/prompts/validation.ts +37 -0
  283. package/src/llm/provider-registry.ts +68 -0
  284. package/src/llm/reliability.ts +179 -0
  285. package/src/llm/schemas.ts +52 -0
  286. package/src/mcp/freshness-annotator.ts +69 -0
  287. package/src/mcp/server.ts +949 -0
  288. package/src/mcp/tools/sia-ast-query.ts +225 -0
  289. package/src/mcp/tools/sia-at-time.ts +151 -0
  290. package/src/mcp/tools/sia-backlinks.ts +87 -0
  291. package/src/mcp/tools/sia-batch-execute.ts +169 -0
  292. package/src/mcp/tools/sia-by-file.ts +89 -0
  293. package/src/mcp/tools/sia-community.ts +113 -0
  294. package/src/mcp/tools/sia-doctor.ts +73 -0
  295. package/src/mcp/tools/sia-execute-file.ts +122 -0
  296. package/src/mcp/tools/sia-execute.ts +104 -0
  297. package/src/mcp/tools/sia-expand.ts +158 -0
  298. package/src/mcp/tools/sia-fetch-and-index.ts +241 -0
  299. package/src/mcp/tools/sia-flag.ts +65 -0
  300. package/src/mcp/tools/sia-index.ts +111 -0
  301. package/src/mcp/tools/sia-note.ts +134 -0
  302. package/src/mcp/tools/sia-search.ts +105 -0
  303. package/src/mcp/tools/sia-stats.ts +63 -0
  304. package/src/mcp/tools/sia-sync-status.ts +44 -0
  305. package/src/mcp/tools/sia-upgrade.ts +247 -0
  306. package/src/mcp/truncate.ts +231 -0
  307. package/src/native/bridge.ts +167 -0
  308. package/src/native/fallback-ast-diff.ts +144 -0
  309. package/src/native/fallback-graph.ts +325 -0
  310. package/src/ontology/constraints.ts +56 -0
  311. package/src/ontology/errors.ts +8 -0
  312. package/src/ontology/middleware.ts +266 -0
  313. package/src/retrieval/bm25-search.ts +151 -0
  314. package/src/retrieval/context-assembly.ts +76 -0
  315. package/src/retrieval/graph-traversal.ts +168 -0
  316. package/src/retrieval/pagerank.ts +40 -0
  317. package/src/retrieval/query-classifier.ts +106 -0
  318. package/src/retrieval/reranker.ts +156 -0
  319. package/src/retrieval/search.ts +236 -0
  320. package/src/retrieval/throttle.ts +102 -0
  321. package/src/retrieval/vector-search.ts +203 -0
  322. package/src/retrieval/workspace-search.ts +130 -0
  323. package/src/sandbox/context-mode.ts +285 -0
  324. package/src/sandbox/credential-pass.ts +55 -0
  325. package/src/sandbox/executor.ts +235 -0
  326. package/src/security/pattern-detector.ts +127 -0
  327. package/src/security/rule-of-two.ts +50 -0
  328. package/src/security/sanitize.ts +46 -0
  329. package/src/security/semantic-consistency.ts +93 -0
  330. package/src/security/staging-promoter.ts +154 -0
  331. package/src/shared/config.ts +302 -0
  332. package/src/shared/diagnostics.ts +210 -0
  333. package/src/shared/errors.ts +48 -0
  334. package/src/shared/git-utils.ts +143 -0
  335. package/src/shared/llm-client.ts +120 -0
  336. package/src/shared/logger.ts +99 -0
  337. package/src/shared/types.ts +79 -0
  338. package/src/sync/client.ts +43 -0
  339. package/src/sync/conflict.ts +106 -0
  340. package/src/sync/dedup.ts +183 -0
  341. package/src/sync/hlc.ts +117 -0
  342. package/src/sync/keychain.ts +144 -0
  343. package/src/sync/pull.ts +232 -0
  344. package/src/sync/push.ts +131 -0
  345. package/src/types/chokidar.d.ts +23 -0
  346. package/src/visualization/graph-renderer.ts +312 -0
  347. package/src/visualization/subgraph-extract.ts +208 -0
  348. package/src/visualization/views/community-clusters.ts +246 -0
  349. package/src/visualization/views/dependency-map.ts +189 -0
  350. package/src/visualization/views/graph-explorer.ts +364 -0
  351. package/src/visualization/views/timeline.ts +247 -0
  352. package/src/workspace/api-contracts.ts +226 -0
  353. package/src/workspace/cross-repo.ts +61 -0
  354. package/src/workspace/detector.ts +190 -0
  355. package/src/workspace/manifest.ts +141 -0
@@ -0,0 +1,85 @@
1
+ ---
2
+ name: sia-execute-plan
3
+ description: Executes implementation plans with SIA's staleness detection, per-task convention checks, and session resumption. Use when following a written implementation plan, resuming plan execution, or running through task checklists.
4
+ ---
5
+
6
+ ## Invariants
7
+
8
+ > These rules have NO exceptions. Executing a stale plan wastes more time than checking.
9
+ >
10
+ > 1. YOU MUST run the staleness check before executing any task. If a plan-referenced
11
+ > file has been modified after the plan was written, STOP and alert the developer.
12
+ > Do NOT proceed with a stale plan without explicit developer approval.
13
+ > 2. YOU MUST query SIA for conventions before each task. "The plan already says how
14
+ > to do it" is not an excuse — conventions may have changed since the plan was written.
15
+ > 3. YOU MUST NOT invoke sia-finish until ALL plan tasks are complete and verified.
16
+ > Partial completion is not completion.
17
+
18
+ ## Red Flags — If You Think Any of These, STOP
19
+
20
+ | Thought | Why It's Wrong |
21
+ |---------|---------------|
22
+ | "The plan is recent, I can skip the staleness check" | Plans go stale faster than you expect. The check takes seconds; a stale-plan bug takes hours. |
23
+ | "The plan already specifies conventions" | Conventions evolve. The graph is current; the plan may not be. |
24
+ | "I'll finish the remaining tasks later" | sia-finish on a partial plan creates a misleading PR. Complete ALL tasks first. |
25
+ | "This task is simple enough to skip the convention query" | Simple tasks done wrong compound into complex problems. Always query. |
26
+
27
+ # SIA-Enhanced Plan Execution
28
+
29
+ Execute plans with staleness detection, per-task convention injection, and session resumption from SIA's knowledge graph.
30
+
31
+ ## Checklist
32
+
33
+ ```
34
+ - [ ] Step 0: YOU MUST run staleness check — sia_by_file for each plan-referenced file. If any file changed since plan creation, STOP and alert. No exceptions.
35
+ - [ ] Step 1: Load and review plan, cross-reference against current graph state. Flag any contradictions.
36
+ - [ ] Step 2: For EACH task, YOU MUST query SIA for area conventions before starting. A task executed without this query may violate project standards.
37
+ - [ ] Step 3: Invoke sia-finish ONLY after ALL tasks are complete and verified. Partial completion is not completion.
38
+ ```
39
+
40
+ ## Workflow
41
+
42
+ ### Step 0 — Staleness Check (NEW)
43
+
44
+ Before starting execution:
45
+
46
+ ```
47
+ sia_search({ query: "<plan area>", limit: 10 })
48
+ ```
49
+
50
+ For each file referenced in the plan, check if it was modified after the plan was written:
51
+
52
+ ```
53
+ sia_by_file({ file_path: "<referenced_file>" })
54
+ ```
55
+
56
+ If entities show recent modifications not accounted for in the plan, warn:
57
+
58
+ > "The plan references `src/auth/login.ts` which was modified after the plan was written. The plan may need updating."
59
+
60
+ ### Step 1 — Load and Review Plan (enhanced)
61
+
62
+ Standard: read the plan file, identify concerns.
63
+
64
+ **Enhancement:** Cross-reference plan files against graph entities to identify any that have changed or have new conventions since the plan was written.
65
+
66
+ ### Step 2 — Execute Tasks (ENHANCED)
67
+
68
+ For each task, before starting:
69
+
70
+ ```
71
+ sia_search({ query: "conventions <task area>", node_types: ["Convention"], limit: 5 })
72
+ sia_by_file({ file_path: "<task target file>" })
73
+ ```
74
+
75
+ Include relevant conventions in the task context so the implementation follows project patterns.
76
+
77
+ After each task, the session resume system (Phase J) captures progress automatically.
78
+
79
+ ### Step 3 — Complete Development (same as standard)
80
+
81
+ Invoke sia-finish for branch completion.
82
+
83
+ ## Key Principle
84
+
85
+ **Plans go stale. The graph knows what changed.** Always verify plan assumptions against current graph state before executing.
@@ -0,0 +1,49 @@
1
+ ---
2
+ name: sia-export-import
3
+ description: Exports and imports SIA knowledge graphs as portable JSON for backup, migration, or sharing. Use when backing up the graph, migrating to a new machine, or sharing knowledge between projects.
4
+ ---
5
+
6
+ # SIA Export & Import
7
+
8
+ Export the knowledge graph to portable JSON or import from a previous export.
9
+
10
+ ## Export
11
+
12
+ Serialize the active graph (entities, edges, communities, cross-repo edges) to JSON:
13
+
14
+ ```bash
15
+ bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/commands/export.ts --output graph-export.json
16
+ ```
17
+
18
+ The export includes:
19
+ - All active entities (not invalidated, not archived)
20
+ - All active edges
21
+ - All communities
22
+ - Cross-repo edges (if in a workspace)
23
+
24
+ ## Import
25
+
26
+ Load a previously exported graph:
27
+
28
+ ```bash
29
+ bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/commands/import.ts --input graph-export.json --mode merge
30
+ ```
31
+
32
+ ### Import Modes
33
+
34
+ - **merge** (default): Runs imported entities through the consolidation pipeline — deduplicates against existing entities and only creates new edges when both endpoints exist
35
+ - **replace**: Archives all existing active entities, then bulk-inserts everything from the export
36
+
37
+ ## When To Use
38
+
39
+ - **Backup**: Export before major refactoring or destructive operations
40
+ - **Migration**: Move knowledge between machines or environments
41
+ - **Sharing**: Share project knowledge with team members who haven't run SIA
42
+ - **Recovery**: Restore from a previous export if something goes wrong (also see `sia-rollback`)
43
+
44
+ ## Related
45
+
46
+ - Use `rollback` to restore from automatic snapshots:
47
+ ```bash
48
+ bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/commands/rollback.ts
49
+ ```
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: sia-export-knowledge
3
+ description: Exports the knowledge graph as a human-readable markdown document covering decisions, conventions, bugs, and architecture. Use for team onboarding, documentation generation, or sharing knowledge outside SIA.
4
+ ---
5
+
6
+ # SIA Knowledge Export
7
+
8
+ Generate a comprehensive markdown document summarizing everything SIA knows about your project.
9
+
10
+ ## Usage
11
+
12
+ **Default** (writes to `KNOWLEDGE.md`):
13
+ ```bash
14
+ bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/index.ts export-knowledge
15
+ ```
16
+
17
+ **Custom output path:**
18
+ ```bash
19
+ bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/index.ts export-knowledge --output docs/project-knowledge.md
20
+ ```
21
+
22
+ **Custom project name:**
23
+ ```bash
24
+ bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/index.ts export-knowledge --name "My Project"
25
+ ```
26
+
27
+ ## What It Generates
28
+
29
+ A structured markdown document with:
30
+
31
+ 1. **Architectural Decisions** — what was chosen, why, and what was rejected
32
+ 2. **Coding Conventions** — patterns and rules to follow
33
+ 3. **Known Issues** — active bugs with descriptions
34
+ 4. **Solutions** — how past bugs were fixed
35
+ 5. **Key Concepts** — domain terminology and system behavior
36
+ 6. **Architecture** — community structure showing module clusters
37
+
38
+ Each entry includes: date captured, trust tier (verified/code-derived/inferred/external), and affected files.
39
+
40
+ ## When To Use
41
+
42
+ - **Team onboarding** — share with new developers before their first session
43
+ - **Knowledge audit** — review what SIA has captured, identify gaps
44
+ - **External sharing** — generate a knowledge summary for stakeholders
45
+ - **Backup** — human-readable export of the knowledge graph
46
+ - **Documentation** — commit as living documentation alongside code
@@ -0,0 +1,100 @@
1
+ ---
2
+ name: sia-finish
3
+ description: Finishes development branches using SIA — generates semantic PR summaries from the knowledge graph, captures branch decisions, and updates the graph post-merge. Use when implementation is complete, all tests pass, and the branch is ready for merge or PR.
4
+ ---
5
+
6
+ ## Invariants
7
+
8
+ > These rules have NO exceptions. A PR without knowledge context is a missed opportunity.
9
+ >
10
+ > 1. YOU MUST query SIA for branch decisions before creating the PR. "I remember
11
+ > what I did" is not sufficient — the graph contains entities from sessions
12
+ > you may not recall.
13
+ > 2. NEVER create a PR without a Knowledge Captured section. If the branch truly
14
+ > captured zero entities, state explicitly: "No decisions, conventions, or bugs
15
+ > were captured during this branch." An empty omission is not acceptable.
16
+ > 3. YOU MUST call `sia_note` after merge to capture the branch summary.
17
+ > A merge without post-merge capture is incomplete.
18
+
19
+ ## Red Flags — If You Think Any of These, STOP
20
+
21
+ | Thought | Why It's Wrong |
22
+ |---------|---------------|
23
+ | "This PR is too small for a knowledge section" | Small PRs with undocumented decisions are how institutional knowledge is lost. |
24
+ | "The PR description already explains everything" | PR descriptions are not queryable by future sessions. The graph is. Capture anyway. |
25
+ | "I'll add the knowledge section later" | You won't. Do it now. |
26
+ | "Tests passed, so I can skip the SIA query" | Tests verify correctness, not knowledge. The SIA query surfaces decisions worth documenting. |
27
+ | "No decisions were made on this branch" | Every branch makes decisions — even "keep the existing approach" is a decision worth noting. |
28
+
29
+ # SIA-Enhanced Branch Finishing
30
+
31
+ Finish a development branch with graph-powered semantic PR summaries and post-merge knowledge capture.
32
+
33
+ ## Checklist
34
+
35
+ ```
36
+ - [ ] Step 0: YOU MUST query SIA for branch decisions/conventions/bugs before creating any PR. No exceptions.
37
+ - [ ] Step 1: Hard gate — tests MUST pass. A PR with failing tests is not ready. Period.
38
+ - [ ] Steps 2-3: Determine base branch, present options (merge/PR/cleanup)
39
+ - [ ] Step 4: Create PR with Knowledge Summary section from graph entities. NEVER omit this section.
40
+ - [ ] Post-merge: YOU MUST capture branch summary to graph via sia_note. A merge without this call is incomplete.
41
+ ```
42
+
43
+ ## Workflow
44
+
45
+ ### Step 0 — Branch Knowledge Summary (NEW)
46
+
47
+ Before running tests or creating a PR:
48
+
49
+ ```
50
+ sia_search({ query: "decisions conventions <branch work area>", limit: 20 })
51
+ ```
52
+
53
+ Collect all entities captured during this branch's lifetime. These become the PR's semantic summary.
54
+
55
+ ### Step 1 — Verify Tests (same as standard)
56
+
57
+ Hard gate — tests must pass.
58
+
59
+ ### Step 2-3 — Determine Base Branch + Present Options (same as standard)
60
+
61
+ ### Step 4, Option 2 — Create PR (ENHANCED)
62
+
63
+ **For the full PR template:** See [pr-summary-template.md](pr-summary-template.md)
64
+
65
+ When creating a PR, include a **Knowledge Summary** section built from graph entities:
66
+
67
+ ```markdown
68
+ ## Summary
69
+ - [Standard git diff summary]
70
+
71
+ ## Knowledge Captured
72
+ ### Decisions Made
73
+ - [Decision entities created during this branch]
74
+
75
+ ### Conventions Established
76
+ - [Convention entities]
77
+
78
+ ### Bugs Found & Fixed
79
+ - [Bug + Solution entity pairs]
80
+ ```
81
+
82
+ This gives reviewers semantic context — not just what changed, but WHY.
83
+
84
+ ### Post-Merge — Knowledge Capture (NEW)
85
+
86
+ After merge:
87
+
88
+ ```
89
+ sia_note({ kind: "Decision", name: "Merged: <branch purpose>", content: "<summary of all work done on this branch>" })
90
+ ```
91
+
92
+ If branch snapshots exist (Phase D.5), trigger cleanup:
93
+
94
+ ```
95
+ sia_snapshot_prune({ branch_names: ["<merged_branch>"] })
96
+ ```
97
+
98
+ ## Key Principle
99
+
100
+ **PR descriptions should tell the story, not just list the diff.** SIA knows the decisions, conventions, and bugs from this branch — use them.
@@ -0,0 +1,54 @@
1
+ # Semantic PR Summary Template
2
+
3
+ Use this template when creating PRs via sia-finish. The "Knowledge Captured" section is built from SIA graph entities collected during the branch's lifetime.
4
+
5
+ ## Template
6
+
7
+ ```markdown
8
+ ## Summary
9
+ <Standard git diff summary — what changed, why>
10
+
11
+ ## Knowledge Captured
12
+
13
+ ### Decisions Made
14
+ <For each Decision entity captured during this branch:>
15
+ - **{decision.name}** — {decision.content} (rationale: {why})
16
+
17
+ ### Conventions Established
18
+ <For each Convention entity:>
19
+ - **{convention.name}** — {convention.content}
20
+
21
+ ### Bugs Found & Fixed
22
+ <For each Bug + Solution pair:>
23
+ - **{bug.name}** → Fixed by: {solution.name}
24
+ - Root cause: {bug.content}
25
+ - Fix: {solution.content}
26
+
27
+ ### Architecture Changes
28
+ <If any community structure or module boundaries changed:>
29
+ - {description of structural change}
30
+ ```
31
+
32
+ ## How to Populate
33
+
34
+ ### Step 1 — Query branch entities
35
+
36
+ ```
37
+ sia_search({ query: "decisions conventions <branch work area>", limit: 20 })
38
+ ```
39
+
40
+ ### Step 2 — Filter to branch lifetime
41
+
42
+ Only include entities captured AFTER the branch was created. Check `t_valid_from` against the branch creation date (from `git log --oneline --reverse HEAD...main | head -1`).
43
+
44
+ ### Step 3 — Pair Bugs with Solutions
45
+
46
+ For each Bug entity, check if a Solution entity references it (via `relates_to` or matching name). Present them as pairs.
47
+
48
+ ### Step 4 — Omit empty sections
49
+
50
+ If no Conventions were established, omit that section. Don't include empty headers.
51
+
52
+ ## Why This Matters
53
+
54
+ Standard PR descriptions list the diff — WHAT changed. Graph-powered summaries add WHY: the decisions that drove the changes, the bugs that motivated fixes, the conventions that were established. Reviewers get semantic context, not just code context.
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: sia-freshness
3
+ description: Generates a freshness report for the SIA knowledge graph — identifies stale, rotten, and fresh entities. Use when checking knowledge quality, before pruning, or when results seem outdated.
4
+ ---
5
+
6
+ # SIA Freshness
7
+
8
+ Generate a report on the health and freshness of knowledge in the graph.
9
+
10
+ ## Steps
11
+
12
+ Run the freshness report:
13
+
14
+ ```bash
15
+ bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/commands/freshness.ts
16
+ ```
17
+
18
+ ## Report Contents
19
+
20
+ The report classifies entities into three tiers:
21
+
22
+ - **Fresh** (confidence >= 0.7): Recently validated, high-confidence knowledge
23
+ - **Stale** (0.3 <= confidence < 0.7): May need revalidation
24
+ - **Rotten** (confidence < 0.3): Likely outdated, candidates for pruning
25
+
26
+ Additional metrics:
27
+ - **Pending revalidation**: Entities flagged for review
28
+ - **Average confidence by tier**: How confident the graph is in each trust level
29
+ - **Last deep validation**: When the graph was last fully validated
30
+ - **Index coverage**: Percentage of entities with source file mappings
31
+ - **Native module status**: Whether tree-sitter is using native, WASM, or TypeScript fallback
32
+
33
+ ## When To Use
34
+
35
+ - As a regular health check (weekly recommended)
36
+ - Before major refactoring to understand graph quality
37
+ - When search results seem outdated
38
+ - After `sia-prune` to confirm cleanup effectiveness
@@ -0,0 +1,42 @@
1
+ ---
2
+ name: sia-history
3
+ description: Explores how the knowledge graph evolved over time with temporal filtering. Use when reviewing recent decisions, tracking knowledge evolution, or investigating when something was captured.
4
+ ---
5
+
6
+ # SIA History
7
+
8
+ Interactive temporal exploration of the project's knowledge graph.
9
+
10
+ ## Usage
11
+
12
+ **Last 7 days** (default):
13
+ ```bash
14
+ bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/index.ts history
15
+ ```
16
+
17
+ **Since a specific date:**
18
+ ```bash
19
+ bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/index.ts history --since 2026-03-01
20
+ ```
21
+
22
+ **Filter by type:**
23
+ ```bash
24
+ bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/index.ts history --types Decision,Convention
25
+ ```
26
+
27
+ **Filter by file:**
28
+ ```bash
29
+ bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/index.ts history --file src/auth/login.ts
30
+ ```
31
+
32
+ ## When To Use
33
+
34
+ - "What decisions were made this week?"
35
+ - "Show me the bug history for this module"
36
+ - "What changed in the graph since last release?"
37
+ - "What conventions were established recently?"
38
+
39
+ ## Also Available
40
+
41
+ - `sia_at_time` MCP tool — query the graph at a specific point in time
42
+ - `/sia-compare` — compare graph state between two time points
@@ -0,0 +1,70 @@
1
+ ---
2
+ name: sia-impact
3
+ description: Analyzes the impact of a planned code change — maps dependencies, callers, importers, and downstream effects using the knowledge graph. Use before refactoring, renaming, or modifying shared code.
4
+ ---
5
+
6
+ # SIA Impact Analysis
7
+
8
+ Before making a structural change (rename, move, split, delete, signature change), analyze what will be affected.
9
+
10
+ ## How To Use
11
+
12
+ Provide the entity or file you plan to change:
13
+
14
+ - `/sia-impact src/auth/login.ts` — impact of changing this file
15
+ - `/sia-impact processPayment` — impact of changing this function
16
+ - `/sia-impact UserProfile type` — impact of changing this type
17
+
18
+ ## Analysis Steps
19
+
20
+ The impact analysis chains these SIA tools:
21
+
22
+ ### 1. Find the entity
23
+ ```
24
+ sia_search({ query: "$ARGUMENTS", node_types: ["CodeEntity", "CodeSymbol"] })
25
+ sia_by_file({ file_path: "$ARGUMENTS" })
26
+ ```
27
+
28
+ ### 2. Map incoming dependencies
29
+ ```
30
+ sia_backlinks({ node_id: "<entity_id>" })
31
+ ```
32
+ This shows everything that imports, calls, or depends on the target.
33
+
34
+ ### 3. Trace the ripple effect
35
+ ```
36
+ sia_expand({ entity_id: "<dependent_id>", depth: 2, edge_types: ["calls", "imports", "depends_on"] })
37
+ ```
38
+ For each direct dependent, check what depends on THEM.
39
+
40
+ ### 4. AST-level verification
41
+ ```
42
+ sia_ast_query({ file_path: "<affected_file>", query_type: "imports" })
43
+ sia_ast_query({ file_path: "<affected_file>", query_type: "calls" })
44
+ ```
45
+ Get precise import and call sites in affected files.
46
+
47
+ ### 5. Check conventions
48
+ ```
49
+ sia_search({ query: "conventions <area>", node_types: ["Convention"] })
50
+ ```
51
+ Are there conventions about how changes should be made in this area?
52
+
53
+ ## Output Format
54
+
55
+ Present the impact as a structured report:
56
+
57
+ | File | Dependency | Impact Type | Action Needed |
58
+ |---|---|---|---|
59
+ | path/file.ts | imports X | Direct | Update import |
60
+ | path/other.ts | calls X | Direct | Update call site |
61
+ | path/test.ts | tests X | Direct | Update test |
62
+ | path/downstream.ts | uses Y which uses X | Indirect | Verify behavior |
63
+
64
+ ## When To Use
65
+
66
+ - Before renaming a function, class, or type
67
+ - Before moving files between directories
68
+ - Before changing a function's signature
69
+ - Before splitting or merging modules
70
+ - Before removing exports or APIs
@@ -0,0 +1,54 @@
1
+ ---
2
+ name: sia-index
3
+ description: Indexes external content into SIA's knowledge graph — markdown, URLs, and documents with automatic chunking. Use when adding documentation, design docs, or external references to the graph.
4
+ ---
5
+
6
+ # SIA Index
7
+
8
+ Index external content into the knowledge graph for future retrieval.
9
+
10
+ ## When To Use
11
+
12
+ Use this skill when you need to:
13
+ - Index documentation, meeting notes, or design docs
14
+ - Fetch and index content from a URL
15
+ - Add external knowledge to the project graph
16
+
17
+ ## MCP Tools
18
+
19
+ ### sia_index — Index text content
20
+
21
+ ```
22
+ sia_index({
23
+ content: "## Architecture Decision\n\nWe chose PostgreSQL over MongoDB because...",
24
+ source: "architecture-review-2026-03",
25
+ tags: ["decision", "database", "architecture"]
26
+ })
27
+ ```
28
+
29
+ Parameters:
30
+ - **content** (required): Markdown or plain text to index
31
+ - **source** (optional): Source identifier for provenance tracking
32
+ - **tags** (optional): Tags for categorization
33
+
34
+ ### sia_fetch_and_index — Fetch a URL and index its content
35
+
36
+ ```
37
+ sia_fetch_and_index({
38
+ url: "https://docs.example.com/api-reference",
39
+ intent: "Index API documentation for reference",
40
+ tags: ["api", "documentation"]
41
+ })
42
+ ```
43
+
44
+ Parameters:
45
+ - **url** (required): URL to fetch (must be a valid URL)
46
+ - **intent** (optional): Why this content is being indexed
47
+ - **tags** (optional): Tags for categorization
48
+
49
+ ## Notes
50
+
51
+ - Content is chunked using content-type-aware strategies (heading-based for markdown, line-based for plain text)
52
+ - Entities and relationships are automatically extracted from chunks
53
+ - SSRF protection is built in — private IPs and DNS rebinding are blocked
54
+ - Requires the ONNX embedding model for vector indexing (run `sia-doctor` to check)
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: sia-install
3
+ description: Initializes SIA persistent memory in the current project — creates databases, registers repo, and configures hooks. Use for first-time SIA setup in a new project or repository.
4
+ ---
5
+
6
+ # SIA Install
7
+
8
+ Initialize SIA's persistent graph memory for the current project.
9
+
10
+ ## What This Does
11
+
12
+ 1. Creates the SIA databases (graph.db, episodic.db) for this repository
13
+ 2. Registers the repo in the global meta.db registry
14
+ 3. Runs an initial AST index of the codebase using tree-sitter
15
+
16
+ ## Steps
17
+
18
+ 1. Run the SIA install command:
19
+
20
+ ```bash
21
+ bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/commands/install.ts
22
+ ```
23
+
24
+ 2. Verify the databases were created by checking `~/.sia/` (or `$CLAUDE_PLUGIN_DATA` in plugin mode)
25
+
26
+ 3. Run an initial reindex to populate the knowledge graph:
27
+
28
+ ```bash
29
+ bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/commands/reindex.ts
30
+ ```
31
+
32
+ 4. Confirm SIA is working by running a test search using the `sia_search` MCP tool with query "project overview".
33
+
34
+ ## Troubleshooting
35
+
36
+ If installation fails:
37
+ - Run `sia-doctor` to check system health
38
+ - Ensure bun is installed (`bun --version`)
39
+ - Check that the project is a git repository (`git rev-parse --git-dir`)
@@ -0,0 +1,16 @@
1
+ ---
2
+ name: sia-lead-compliance
3
+ description: Audits convention compliance across the codebase — checks every known convention against current code and reports violations. Use for code quality audits, tech lead reviews, or enforcing team standards.
4
+ ---
5
+
6
+ # SIA Convention Compliance Audit
7
+
8
+ Full-codebase audit of convention compliance.
9
+
10
+ ## Usage
11
+
12
+ ```bash
13
+ bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/index.ts lead-report --type compliance
14
+ ```
15
+
16
+ Shows: each convention with compliance %, specific violations with file paths, overall compliance score.
@@ -0,0 +1,16 @@
1
+ ---
2
+ name: sia-lead-drift-report
3
+ description: Generates an architecture drift report — compares current codebase against captured decisions and conventions. Use when reviewing architectural health, during retrospectives, or checking for design divergence.
4
+ ---
5
+
6
+ # SIA Architecture Drift Report
7
+
8
+ Detect where the codebase has diverged from captured architectural decisions.
9
+
10
+ ## Usage
11
+
12
+ ```bash
13
+ bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/index.ts lead-report --type drift
14
+ ```
15
+
16
+ Shows: decisions not being followed, convention violations, stale architecture entities, community structure changes.
@@ -0,0 +1,16 @@
1
+ ---
2
+ name: sia-lead-knowledge-map
3
+ description: Generates a knowledge distribution map showing module coverage and gaps. Use for identifying bus-factor risks, planning knowledge sharing, or onboarding prioritization.
4
+ ---
5
+
6
+ # SIA Knowledge Distribution Map
7
+
8
+ Visualize how knowledge is distributed across the codebase and team.
9
+
10
+ ## Usage
11
+
12
+ ```bash
13
+ bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/index.ts lead-report --type knowledge-map
14
+ ```
15
+
16
+ Shows: entities per module, contributors per module, bus-factor risks, coverage gaps.