@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,239 @@
1
+ # Sia — Full Tool Parameter Reference
2
+
3
+ *Read this module when you need complete parameter documentation for any Sia tool,*
4
+ *or when the base module's condensed guidance is insufficient for the task at hand.*
5
+
6
+ ---
7
+
8
+ ## `sia_search` — General Memory Retrieval
9
+
10
+ Your primary tool. Call at the start of every non-trivial task.
11
+
12
+ ```
13
+ sia_search({
14
+ query: string,
15
+ // Conversational language works well: "session timeout expiry behavior"
16
+ // rather than keyword fragments: "timeout session".
17
+
18
+ task_type?: 'bug-fix' | 'feature' | 'review',
19
+ // Boosts entity types relevant to the task:
20
+ // bug-fix → Bug, Solution, Decision entities ranked higher
21
+ // feature → Concept, Decision entities ranked higher
22
+ // review → Convention entities ranked higher
23
+
24
+ node_types?: string[],
25
+ // Further narrow by type: ['Decision','Convention'], ['Bug','Solution'], etc.
26
+ // Use when you know the category of what you're looking for.
27
+
28
+ package_path?: string,
29
+ // Monorepo: scope to a specific package path. Reduces cross-package noise
30
+ // when working in a single package of a large monorepo.
31
+
32
+ workspace?: boolean,
33
+ // Default false. Set true ONLY for cross-repo tasks: API contracts between
34
+ // linked repositories, shared types, cross-service calls.
35
+ // Never use for single-repo tasks — adds 400ms latency and cross-repo noise.
36
+
37
+ paranoid?: boolean,
38
+ // Default false. Set true when auditing external dependencies or when you want
39
+ // to query the graph without surface-level exposure to Tier 4 content.
40
+ // Filters Tier 4 entities from retrieval results only — does NOT prevent Tier 4
41
+ // content from being captured into the graph, and does NOT guarantee memory
42
+ // integrity.
43
+ //
44
+ // If the developer expresses concern about memory poisoning or graph integrity,
45
+ // paranoid: true on queries is insufficient. Direct them to:
46
+ // paranoidCapture: true in ~/.sia/config.json
47
+ // which quarantines Tier 4 at the chunker stage (the hard guarantee). For past
48
+ // captures, suggest: sia rollback to inspect and revert if needed.
49
+
50
+ limit?: number,
51
+ // Default 5. Use 10 for architectural queries. Use 15 ONLY for PR review
52
+ // (full convention coverage required). Never use 15 as a default.
53
+
54
+ include_provenance?: boolean,
55
+ // Default false. When true, adds extraction_method to entity results.
56
+ // WHEN TO USE — set true only when:
57
+ // (a) two Tier 3 results contradict each other (spacy is more reliable
58
+ // than llm-haiku — provenance lets you choose the more reliable one)
59
+ // (b) the developer asks how a fact was captured
60
+ // (c) you are about to use a Tier 3 entity as a hard constraint on a
61
+ // security-critical or data-migration task
62
+ // DO NOT use by default — adds payload for no benefit on routine queries.
63
+ //
64
+ // Values when true:
65
+ // 'tree-sitter' = deterministic AST extraction (Tier 2, fully reliable)
66
+ // 'spacy' = deterministic NLP (Tier 3, highly reliable)
67
+ // 'llm-haiku' = probabilistic LLM extraction (Tier 3, can hallucinate)
68
+ // 'user-direct' = developer stated this explicitly (Tier 1)
69
+ // 'manifest' = declared in .sia-manifest.yaml (Tier 1)
70
+ // Conflict rule: prefer 'spacy' over 'llm-haiku' for Tier 3 disambiguation.
71
+ })
72
+ ```
73
+
74
+ ---
75
+
76
+ ## `sia_by_file` — File-Scoped Memory Retrieval
77
+
78
+ Call before modifying any file you have not worked on recently. Returns everything
79
+ Sia knows about that file: decisions made about it, bugs found in it, patterns it
80
+ implements, conventions that apply to it. This is a complement to `sia_search`,
81
+ not an alternative — use both.
82
+
83
+ ```
84
+ sia_by_file({
85
+ file_path: string, // relative path from project root
86
+ workspace?: boolean, // default false — include cross-repo edges for this file
87
+ limit?: number, // default 10
88
+ })
89
+ ```
90
+
91
+ ---
92
+
93
+ ## `sia_expand` — Graph Relationship Traversal
94
+
95
+ Call when a search result is relevant but you need to understand how it connects to
96
+ the rest of the graph. Use sparingly — the session budget is 2 calls.
97
+
98
+ ```
99
+ sia_expand({
100
+ entity_id: string, // the ID from a sia_search or sia_by_file result
101
+ depth?: 1 | 2 | 3, // default 1; see depth guide below
102
+ edge_types?: string[], // see edge type guide below
103
+ include_cross_repo?: boolean, // default false
104
+ })
105
+ ```
106
+
107
+ **Depth guide:**
108
+ `depth=1` — immediate neighbors only. Use for 90% of cases.
109
+ `depth=2` — multi-step causal chains. Use for regression tracing and dependency audits.
110
+ `depth=3` — full dependency impact. The 50-entity neighbor cap will usually bind here;
111
+ use only when a complete impact analysis is explicitly needed.
112
+
113
+ **Edge type guide:**
114
+ Regression investigation: `edge_types=['supersedes', 'caused_by', 'solves']`
115
+ Dependency analysis: `edge_types=['calls', 'imports', 'depends_on']`
116
+ Decision history: `edge_types=['supersedes', 'elaborates', 'contradicts']`
117
+ Bug-to-solution: `edge_types=['solves', 'caused_by']`
118
+
119
+ **Hard constraints:**
120
+ Never expand all results from a `sia_search` — context overflow is guaranteed.
121
+ Never call `sia_expand` on Community entities — they already contain synthesised summaries.
122
+ Budget: 2 calls per session maximum.
123
+
124
+ **Edge truncation:** `SiaExpandResult.edge_count` is the total active edges in the
125
+ neighborhood. `edges[]` is capped at 200. If `edge_count > edges.length`, the traversal
126
+ is incomplete. Narrow with an `edge_types` filter or reduce `depth` and re-call.
127
+
128
+ ---
129
+
130
+ ## `sia_community` — Architectural Summaries
131
+
132
+ Use for broad structural questions, architectural orientation, and module-level
133
+ understanding. Not for specific entity lookups — use `sia_search` for those.
134
+
135
+ ```
136
+ sia_community({
137
+ query?: string, // topic description for community selection
138
+ entity_id?: string, // OR: get the community containing this specific entity
139
+ level?: 0 | 1 | 2, // default 1; see level guide below
140
+ package_path?: string, // monorepo: scope to a specific package
141
+ })
142
+ ```
143
+
144
+ **Level guide:**
145
+ `level=2` — Coarse architectural overview. Use for: new developer orientation,
146
+ system-wide design questions, "how does this system work?" queries.
147
+ `level=1` — Subsystem / module level. Use for: "how does the auth module work?",
148
+ before implementing a feature that spans a module.
149
+ `level=0` — Fine-grained cluster view. Rarely needed by the agent; more useful
150
+ from the CLI. Avoid in agent workflows.
151
+
152
+ Never use `sia_search("architecture")` as a substitute for `sia_community` — it
153
+ returns raw entity snippets (a list of class names) rather than synthesised summaries.
154
+
155
+ ---
156
+
157
+ ## `sia_at_time` — Temporal Graph Query
158
+
159
+ Use for historical investigation: regressions, architecture evolution, "what changed
160
+ about X?", "what was true before this broke?"
161
+
162
+ ```
163
+ sia_at_time({
164
+ as_of: string, // ISO 8601 OR relative: "7 days ago", "3 months ago", "January"
165
+ entity_types?: string[], // narrow by entity type
166
+ tags?: string[], // narrow by tag
167
+ limit?: number, // default 20, max 50. Applies to BOTH entities[] and
168
+ // invalidated_entities[]. Increase for large regressions
169
+ // (many entities changed at once).
170
+ })
171
+ ```
172
+
173
+ **Output:** A `SiaTemporalResult` with two entity arrays and an edge array:
174
+ - `invalidated_entities[]` — facts that ENDED on or before `as_of`. The change history.
175
+ Sorted by `t_valid_until DESC` (most recently ended first — highest priority for
176
+ regression diagnosis). Each entry's `t_valid_until` is exactly when that fact ended.
177
+ - `entities[]` — facts still valid at `as_of`. Compare against current `sia_search`
178
+ output to see what has changed since.
179
+ - `edges[]` — edges valid at `as_of`, capped at 50.
180
+ - `edge_count` — total edges valid at `as_of` before the 50-cap truncation. If
181
+ `edge_count > edges.length`, the edge set is incomplete — narrow with `entity_types`
182
+ or `tags` to retrieve remaining edge context.
183
+
184
+ When `invalidated_count > invalidated_entities.length`, entity results are truncated.
185
+ Make additional narrowed calls with `entity_types` or `tags` filters to retrieve
186
+ remaining entries. Do not assume you have the complete picture until
187
+ `invalidated_count == invalidated_entities.length`.
188
+
189
+ `sia_at_time` has no meaning in isolation. Always compare its output against the current
190
+ graph (a current `sia_search` call) to identify what changed and what superseded each
191
+ invalidated fact.
192
+
193
+ **When `t_valid_from` is null in a result:** the entity was recorded but Sia could not
194
+ determine when it became true in the world. Say "this was the state at some point before
195
+ [as_of], but the exact start date is unknown."
196
+
197
+ ---
198
+
199
+ ## `sia_flag` — Mid-Session Capture Signal (If Enabled)
200
+
201
+ Available only when `sia enable-flagging` has been run. See
202
+ `reference-flagging.md` for full guidance.
203
+
204
+ ```
205
+ sia_flag({ reason: string }) // max 100 characters after sanitization
206
+ ```
207
+
208
+ The `reason` is sanitized before storage. Characters stripped: `<`, `>`, `{`, `}`,
209
+ `[`, `]`, `\`, quotes, and control characters. Permitted: colons, backticks,
210
+ underscores, forward slashes, `@`, and all standard punctuation. Natural root-cause
211
+ descriptions pass through correctly.
212
+
213
+ If the tool returns a disabled error, tell the developer: "This moment seems worth
214
+ capturing. Run `sia enable-flagging` if you want in-session capture — otherwise
215
+ Sia will attempt to capture it at session end via the Stop hook, with lower precision."
216
+
217
+ ---
218
+
219
+ ## Three Paranoid Modes — They Are Not Equivalent
220
+
221
+ These are three distinct mechanisms that are frequently confused:
222
+
223
+ **`paranoid: true` on `sia_search`** (or `sia search --paranoid` from CLI): filters
224
+ Tier 4 facts from query results only. It does not prevent external content from being
225
+ captured into the graph. A developer who uses this flag expecting "no external content
226
+ will enter my graph" is mistaken — they have only filtered what they see, not what
227
+ is stored.
228
+
229
+ **`paranoidCapture: true` in `~/.sia/config.json`**: quarantines all Tier 4 content at
230
+ the capture pipeline's chunker stage. This is the hard guarantee. External content never
231
+ reaches staging, never reaches the main graph, and appears only as a `QUARANTINE` entry
232
+ in the audit log.
233
+
234
+ **`--paranoid` CLI flag**: equivalent to `paranoid: true` on `sia_search` — retrieval
235
+ filtering only, not capture-side isolation.
236
+
237
+ If a developer asks for the strongest isolation from external content, direct them to
238
+ `paranoidCapture: true` in config, not the query-time flag. Both can be used together
239
+ for defence in depth.
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: sia-pm-decision-log
3
+ description: Generates a chronological decision log from SIA with dates, rationale, and alternatives considered. Use for stakeholder reviews, project documentation, or tracking architectural decision history.
4
+ ---
5
+
6
+ # SIA Decision Log
7
+
8
+ Generate a formal decision log from the knowledge graph — useful for stakeholder reviews, audits, and project governance.
9
+
10
+ ## Usage
11
+
12
+ ```bash
13
+ bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/index.ts pm-report --type decisions --since 2026-01-01
14
+ ```
15
+
16
+ ## Format
17
+
18
+ Each decision entry includes:
19
+ - **Date** — when the decision was captured
20
+ - **Decision** — what was decided
21
+ - **Rationale** — why this option was chosen
22
+ - **Alternatives Considered** — what was rejected and why
23
+ - **Impact** — what this affects
24
+ - **Status** — Active / Superseded / Under Review
25
+
26
+ ## Output
27
+
28
+ Written to `DECISION-LOG.md` (or `--output <path>`).
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: sia-pm-risk-dashboard
3
+ description: Generates a technical risk dashboard from SIA — recurring bugs, conflicting decisions, fragile modules, scored by impact. Use for risk assessments, sprint planning, or identifying areas needing attention.
4
+ ---
5
+
6
+ # SIA Risk Dashboard
7
+
8
+ Generate a technical risk assessment with business impact scoring.
9
+
10
+ ## Usage
11
+
12
+ ```bash
13
+ bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/index.ts pm-report --type risks
14
+ ```
15
+
16
+ ## Risk Categories
17
+
18
+ - 🔴 **Critical** — active bugs affecting users, unresolved conflicts
19
+ - 🟡 **Moderate** — recurring issues, high-churn areas, stale conventions
20
+ - 🟢 **Low** — documentation gaps, minor coverage issues
21
+
22
+ ## Output
23
+
24
+ Written to `RISK-DASHBOARD.md` (or `--output <path>`).
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: sia-pm-sprint-summary
3
+ description: Generates a sprint summary report from SIA in plain language — decisions made, bugs fixed, features delivered. Use for sprint reviews, status updates, or project manager briefings.
4
+ ---
5
+
6
+ # SIA Sprint Summary
7
+
8
+ Generate a PM-ready sprint summary from the knowledge graph.
9
+
10
+ ## Usage
11
+
12
+ ```bash
13
+ bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/index.ts pm-report --type sprint --since 2026-03-10 --until 2026-03-23
14
+ ```
15
+
16
+ ## Sections
17
+
18
+ 1. **Executive Summary** — 2-3 sentence overview
19
+ 2. **Key Decisions** — architectural choices with rationale (plain language)
20
+ 3. **Bugs Found & Fixed** — with business impact
21
+ 4. **Open Issues** — unresolved bugs with risk level
22
+ 5. **Risk Areas** — modules that need attention next sprint
23
+ 6. **Metrics** — entity counts, change velocity, bug rate
24
+
25
+ ## Output
26
+
27
+ Written to `SPRINT-SUMMARY.md` (or `--output <path>`).
@@ -0,0 +1,45 @@
1
+ ---
2
+ name: sia-prune
3
+ description: Removes archived entities from the SIA knowledge graph to reduce database size. Use when the graph grows large, after freshness reports show many stale entities, or for periodic maintenance.
4
+ ---
5
+
6
+ # SIA Prune
7
+
8
+ Hard-delete archived entities from the graph to free disk space and improve query performance.
9
+
10
+ ## Dry Run (Preview)
11
+
12
+ See what would be pruned without deleting anything:
13
+
14
+ ```bash
15
+ bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/commands/prune.ts --dry-run
16
+ ```
17
+
18
+ This shows each candidate with:
19
+ - Entity name and type
20
+ - Importance score
21
+ - Days since last access
22
+
23
+ ## Confirm Prune
24
+
25
+ Actually delete archived entities:
26
+
27
+ ```bash
28
+ bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/commands/prune.ts --confirm
29
+ ```
30
+
31
+ ## What Gets Pruned
32
+
33
+ Only entities that are **archived** (`archived_at IS NOT NULL`) but **not invalidated** (`t_valid_until IS NULL`) are candidates. This distinction matters:
34
+
35
+ - **Archived**: Entity decayed to irrelevance through the decay engine (low importance, not accessed recently)
36
+ - **Invalidated**: Entity was explicitly superseded by newer information (keeps historical record)
37
+
38
+ Pruning removes archived entities permanently. Invalidated entities are kept for bi-temporal history.
39
+
40
+ ## When To Use
41
+
42
+ - When database size is growing large
43
+ - After `sia-freshness` identifies many rotten entities
44
+ - As periodic maintenance (monthly recommended)
45
+ - Before exporting the graph to reduce export size
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: sia-qa-coverage
3
+ description: Analyzes test coverage gaps using SIA's knowledge graph — finds buggy areas without tests and high-churn modules with low coverage. Use when planning test improvements or before releases.
4
+ ---
5
+
6
+ # SIA QA Coverage Analysis
7
+
8
+ Identify areas that need more test coverage based on bug history and code changes.
9
+
10
+ ## How It Works
11
+
12
+ SIA cross-references:
13
+ - **Code entities** (functions, classes) from AST indexing
14
+ - **Bug entities** from captured failures
15
+ - **Test files** detected in the graph
16
+
17
+ Areas with bugs but no corresponding test entities = coverage gaps.
18
+
19
+ ## Usage
20
+
21
+ Ask the sia-qa-analyst agent or run:
22
+
23
+ ```
24
+ sia_search({ query: "code entities <module>", node_types: ["CodeEntity"], limit: 50 })
25
+ sia_search({ query: "bugs <module>", node_types: ["Bug"], limit: 20 })
26
+ ```
27
+
28
+ Cross-reference to find gaps.
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: sia-qa-flaky
3
+ description: Tracks flaky test patterns using SIA — finds tests that fail intermittently and recurring test failures. Use when investigating test instability or prioritizing test reliability work.
4
+ ---
5
+
6
+ # SIA Flaky Test Tracker
7
+
8
+ Identify flaky tests by mining SIA's bug history for patterns:
9
+ - Tests that appear as Bug entities multiple times (recurring failures)
10
+ - Tests where Bug → Solution → Bug again (fixed then broke again)
11
+ - Areas with high Bug creation + invalidation churn
12
+
13
+ ## How It Works
14
+
15
+ ```
16
+ sia_search({ query: "test failure flaky intermittent", node_types: ["Bug"], limit: 30 })
17
+ sia_at_time({ as_of: "<one_month_ago>", entity_types: ["Bug"] })
18
+ ```
19
+
20
+ Compare Bug entities over time — tests that repeatedly fail and get fixed are flaky candidates.
@@ -0,0 +1,26 @@
1
+ ---
2
+ name: sia-qa-report
3
+ description: Generates a QA-focused report from SIA — changes since last test cycle, risky areas, and recommended test priorities. Use before QA cycles, for test planning, or risk-based testing decisions.
4
+ ---
5
+
6
+ # SIA QA Report
7
+
8
+ Generate a testing-focused report from the knowledge graph.
9
+
10
+ ## Usage
11
+
12
+ ```bash
13
+ bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/index.ts qa-report --since 2026-03-15
14
+ ```
15
+
16
+ ## What It Shows
17
+
18
+ 1. **Changes since date** — decisions, code changes, new features grouped by module
19
+ 2. **Risk assessment** — bug density + change velocity per area
20
+ 3. **Bug activity** — bugs found, fixed, and still open
21
+ 4. **Test recommendations** — what to test first, specific test cases from bug history
22
+ 5. **Coverage gaps** — areas with code changes but no corresponding test changes
23
+
24
+ ## Output
25
+
26
+ Written to `QA-REPORT.md` in the project root (or `--output <path>`).
@@ -0,0 +1,30 @@
1
+ ---
2
+ name: sia-reindex
3
+ description: Re-indexes the repository with tree-sitter to update SIA's knowledge graph with current code structure. Use after significant refactoring, file renames, or when code entities seem out of date.
4
+ ---
5
+
6
+ # SIA Reindex
7
+
8
+ Trigger a full or incremental re-index of the repository's code structure.
9
+
10
+ ## Steps
11
+
12
+ Run the reindex command:
13
+
14
+ ```bash
15
+ bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/commands/reindex.ts
16
+ ```
17
+
18
+ This will:
19
+ 1. Walk the repository file tree (respecting .gitignore)
20
+ 2. Parse each supported file with tree-sitter (25+ languages)
21
+ 3. Extract symbols, imports, and call relationships
22
+ 4. Update the knowledge graph with CodeSymbol, FileNode, and PackageNode entities
23
+ 5. Recompute PageRank for structural importance
24
+
25
+ ## When To Use
26
+
27
+ - After major refactoring
28
+ - When the graph seems stale or incomplete
29
+ - After pulling significant changes from remote
30
+ - When `sia-doctor` reports stale AST data
@@ -0,0 +1,88 @@
1
+ ---
2
+ name: sia-review-respond
3
+ description: Responds to code review feedback using SIA's knowledge of past decisions, usage patterns for YAGNI checks, and conflict detection. Use when receiving PR feedback, review comments, or suggestions that may conflict with established conventions.
4
+ ---
5
+
6
+ # SIA-Enhanced Code Review Response
7
+
8
+ Respond to code review feedback grounded in SIA's decision history, usage edges (YAGNI checks), and convention records — argue from the graph, not from memory.
9
+
10
+ ## Checklist
11
+
12
+ ```
13
+ - [ ] Step 1: Read all feedback without reacting
14
+ - [ ] Step 2: Restate each item in your own words
15
+ - [ ] Step 3: Query SIA for decisions/conventions related to each feedback item
16
+ - [ ] Step 4: Evaluate — YAGNI via backlinks, conflict check via decision search
17
+ - [ ] Step 5: Respond with graph citations
18
+ - [ ] Step 6: Implement accepted items one at a time, test each
19
+ - [ ] Post: Capture new decisions or convention changes to graph
20
+ ```
21
+
22
+ ## Workflow
23
+
24
+ ### Step 1 — Read Feedback (same as standard)
25
+
26
+ Read all feedback without reacting.
27
+
28
+ ### Step 2 — Understand (same as standard)
29
+
30
+ Restate each item in your own words.
31
+
32
+ ### Step 3 — Verify Against Graph (ENHANCED)
33
+
34
+ For each feedback item:
35
+
36
+ ```
37
+ sia_search({ query: "<feedback topic>", node_types: ["Decision", "Convention"], limit: 10 })
38
+ sia_by_file({ file_path: "<file being reviewed>" })
39
+ ```
40
+
41
+ Check:
42
+ - Does a **past Decision** explain why the current approach was chosen?
43
+ - Does a **Convention** mandate the current pattern?
44
+ - Was the reviewer's suggestion **tried before and rejected?** (Check invalidated entities)
45
+
46
+ ### Step 4 — Evaluate (ENHANCED)
47
+
48
+ For YAGNI checks — when a reviewer suggests adding a feature:
49
+
50
+ ```
51
+ sia_backlinks({ node_id: "<entity_being_extended>" })
52
+ ```
53
+
54
+ Check if any consumer actually needs the suggested extension. If zero backlinks use it → YAGNI.
55
+
56
+ For conflict checks:
57
+
58
+ ```
59
+ sia_search({ query: "decisions <topic>", node_types: ["Decision"], limit: 5 })
60
+ ```
61
+
62
+ If the suggestion contradicts an established decision, present the conflict:
63
+
64
+ > "This suggestion conflicts with [Decision: Use middleware for auth] which was established on [date] because [rationale]. Should we reconsider that decision, or keep the current approach?"
65
+
66
+ ### Step 5 — Respond (enhanced)
67
+
68
+ **For response templates with graph citations:** See [pushback-patterns.md](pushback-patterns.md)
69
+
70
+ When pushing back on feedback, cite SIA entities:
71
+
72
+ > "The current implementation follows [Convention: Error handlers return structured JSON]. Changing this would break the established pattern documented in entity [id]."
73
+
74
+ ### Step 6 — Implement (same as standard)
75
+
76
+ One item at a time, test each.
77
+
78
+ ### Post-Implementation — Capture (NEW)
79
+
80
+ If the review led to new decisions or convention changes:
81
+
82
+ ```
83
+ sia_note({ kind: "Decision", name: "<what changed based on review>", content: "<rationale>" })
84
+ ```
85
+
86
+ ## Key Principle
87
+
88
+ **Don't argue from memory — argue from the graph.** SIA has the receipts: past decisions, conventions, and their rationale. Use them to validate or push back on feedback with evidence.
@@ -0,0 +1,90 @@
1
+ # Evidence-Based Pushback Patterns
2
+
3
+ Templates for responding to code review feedback using SIA graph citations. The principle: don't argue from memory — argue from the graph.
4
+
5
+ ## Pattern 1: Convention Conflict
6
+
7
+ **When:** Reviewer suggests a change that violates an established convention.
8
+
9
+ **Query:**
10
+ ```
11
+ sia_search({ query: "<convention area>", node_types: ["Convention"], limit: 5 })
12
+ ```
13
+
14
+ **Response template:**
15
+ > The current implementation follows **[Convention: {name}]** (entity {id}, captured {date}): "{convention content}". The suggested change would deviate from this established pattern. Should we update the convention, or keep the current approach?
16
+
17
+ **Key:** Always offer to update the convention. Conventions aren't immutable — but changes should be explicit.
18
+
19
+ ## Pattern 2: Decision Rationale
20
+
21
+ **When:** Reviewer questions why something was done a certain way.
22
+
23
+ **Query:**
24
+ ```
25
+ sia_search({ query: "<decision area>", node_types: ["Decision"], limit: 5 })
26
+ ```
27
+
28
+ **Response template:**
29
+ > This approach was chosen based on **[Decision: {name}]** (captured {date}): "{rationale}". Alternatives considered were: {alternatives}. The deciding factor was: {key_reason}.
30
+
31
+ **Key:** Include the alternatives that were considered — this shows the decision was deliberate, not accidental.
32
+
33
+ ## Pattern 3: YAGNI via Backlinks
34
+
35
+ **When:** Reviewer suggests adding a feature or generalization.
36
+
37
+ **Query:**
38
+ ```
39
+ sia_backlinks({ node_id: "<entity_being_extended>" })
40
+ ```
41
+
42
+ **Response template (zero consumers):**
43
+ > I checked the usage graph for `{entity}` — it currently has **{N} consumers**: {list or "none"}. Adding {suggested feature} would be unused by any current consumer. Should we defer this until there's a concrete use case?
44
+
45
+ **Response template (few consumers):**
46
+ > The usage graph shows {N} consumers of `{entity}`: {list}. None of them use {suggested pattern}. This might be YAGNI — want to revisit when a consumer needs it?
47
+
48
+ ## Pattern 4: Tried Before
49
+
50
+ **When:** Reviewer suggests an approach that was previously tried and rejected.
51
+
52
+ **Query:**
53
+ ```
54
+ sia_search({ query: "<suggested approach>", node_types: ["Decision"], limit: 10 })
55
+ ```
56
+
57
+ Look for entities with `t_valid_until` set (invalidated decisions).
58
+
59
+ **Response template:**
60
+ > This approach was previously tried — see **[Decision: {name}]** (captured {date}, invalidated {invalidation_date}): "{why it was rejected}". What's different now that would make this approach succeed?
61
+
62
+ **Key:** Always ask what changed. Sometimes circumstances genuinely are different — the question prevents dismissing valid suggestions.
63
+
64
+ ## Pattern 5: Accept with Citation
65
+
66
+ **When:** Reviewer's feedback is valid and should be implemented.
67
+
68
+ **Response template:**
69
+ > Good catch — this aligns with **[Convention: {name}]** which I should have followed. Implementing now.
70
+
71
+ Or if it reveals a gap:
72
+
73
+ > You're right. I'm capturing this as a new convention:
74
+ > ```
75
+ > sia_note({ kind: "Convention", name: "<new pattern>", content: "<description>" })
76
+ > ```
77
+
78
+ ## Anti-Pattern: Blind Agreement
79
+
80
+ **Never agree with feedback without verifying it first.** Even valid-sounding suggestions may conflict with established decisions. Always check the graph before accepting or rejecting.
81
+
82
+ ## Quick Reference
83
+
84
+ | Situation | Query | Response Strategy |
85
+ |---|---|---|
86
+ | "Change this pattern" | `sia_search` for Convention | Cite convention, offer to update |
87
+ | "Why did you do it this way?" | `sia_search` for Decision | Cite decision + alternatives |
88
+ | "Add this feature" | `sia_backlinks` | Show consumer count (YAGNI check) |
89
+ | "Use approach X instead" | `sia_search` for invalidated entities | Show if tried-and-rejected |
90
+ | "Good point, fix this" | Verify with `sia_by_file` | Accept with citation, capture if new |