@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.
- package/.claude-plugin/marketplace.json +35 -0
- package/.claude-plugin/plugin.json +27 -0
- package/.mcp.json +13 -0
- package/CLAUDE.md +226 -0
- package/LICENSE +202 -0
- package/PLUGIN_README.md +253 -0
- package/README.md +1013 -0
- package/agents/sia-changelog-writer.md +89 -0
- package/agents/sia-code-reviewer.md +86 -0
- package/agents/sia-conflict-resolver.md +100 -0
- package/agents/sia-convention-enforcer.md +69 -0
- package/agents/sia-debug.md +106 -0
- package/agents/sia-decision-reviewer.md +101 -0
- package/agents/sia-dependency-tracker.md +80 -0
- package/agents/sia-explain.md +126 -0
- package/agents/sia-feature.md +116 -0
- package/agents/sia-knowledge-capture.md +117 -0
- package/agents/sia-lead-architecture-advisor.md +93 -0
- package/agents/sia-lead-team-health.md +107 -0
- package/agents/sia-migration.md +100 -0
- package/agents/sia-onboarding.md +115 -0
- package/agents/sia-orientation.md +99 -0
- package/agents/sia-pm-briefing.md +106 -0
- package/agents/sia-pm-risk-advisor.md +82 -0
- package/agents/sia-qa-analyst.md +116 -0
- package/agents/sia-qa-regression-map.md +94 -0
- package/agents/sia-refactor.md +115 -0
- package/agents/sia-regression.md +112 -0
- package/agents/sia-security-audit.md +125 -0
- package/agents/sia-test-advisor.md +91 -0
- package/hooks/hooks.json +98 -0
- package/migrations/bridge/001_initial.sql +34 -0
- package/migrations/episodic/001_initial.sql +35 -0
- package/migrations/meta/001_initial.sql +68 -0
- package/migrations/semantic/001_initial.sql +292 -0
- package/migrations/semantic/002_ontology.sql +89 -0
- package/migrations/semantic/003_freshness.sql +63 -0
- package/migrations/semantic/004_v5_unified_schema.sql +194 -0
- package/migrations/semantic/005_backfill_event_kinds.sql +8 -0
- package/migrations/semantic/006_tree_sitter.sql +6 -0
- package/migrations/semantic/007_branch_snapshots.sql +22 -0
- package/package.json +110 -0
- package/scripts/branch-switch.sh +13 -0
- package/scripts/build-wasm-grammars.sh +81 -0
- package/scripts/post-compact.sh +8 -0
- package/scripts/post-tool-use.sh +10 -0
- package/scripts/pre-compact.sh +8 -0
- package/scripts/session-end.sh +8 -0
- package/scripts/session-start.sh +8 -0
- package/scripts/start-mcp.ts +45 -0
- package/scripts/stop-hook.sh +8 -0
- package/scripts/user-prompt-submit.sh +8 -0
- package/scripts/viz-server.ts +152 -0
- package/skills/sia-brainstorm/SKILL.md +156 -0
- package/skills/sia-brainstorm/scripts/frame-template.html +214 -0
- package/skills/sia-brainstorm/scripts/helper.js +95 -0
- package/skills/sia-brainstorm/scripts/server.cjs +338 -0
- package/skills/sia-brainstorm/scripts/start-server.sh +153 -0
- package/skills/sia-brainstorm/scripts/stop-server.sh +55 -0
- package/skills/sia-brainstorm/spec-document-reviewer-prompt.md +49 -0
- package/skills/sia-brainstorm/visual-companion.md +286 -0
- package/skills/sia-capture/SKILL.md +64 -0
- package/skills/sia-compare/SKILL.md +33 -0
- package/skills/sia-conflicts/SKILL.md +38 -0
- package/skills/sia-debug-workflow/SKILL.md +120 -0
- package/skills/sia-debug-workflow/root-cause-tracing.md +70 -0
- package/skills/sia-debug-workflow/scripts/find-polluter.sh +64 -0
- package/skills/sia-debug-workflow/temporal-investigation.md +72 -0
- package/skills/sia-digest/SKILL.md +23 -0
- package/skills/sia-dispatch/SKILL.md +69 -0
- package/skills/sia-dispatch/agent-task-template.md +99 -0
- package/skills/sia-doctor/SKILL.md +39 -0
- package/skills/sia-execute/SKILL.md +70 -0
- package/skills/sia-execute-plan/SKILL.md +85 -0
- package/skills/sia-export-import/SKILL.md +49 -0
- package/skills/sia-export-knowledge/SKILL.md +46 -0
- package/skills/sia-finish/SKILL.md +100 -0
- package/skills/sia-finish/pr-summary-template.md +54 -0
- package/skills/sia-freshness/SKILL.md +38 -0
- package/skills/sia-history/SKILL.md +42 -0
- package/skills/sia-impact/SKILL.md +70 -0
- package/skills/sia-index/SKILL.md +54 -0
- package/skills/sia-install/SKILL.md +39 -0
- package/skills/sia-lead-compliance/SKILL.md +16 -0
- package/skills/sia-lead-drift-report/SKILL.md +16 -0
- package/skills/sia-lead-knowledge-map/SKILL.md +16 -0
- package/skills/sia-learn/SKILL.md +58 -0
- package/skills/sia-plan/SKILL.md +68 -0
- package/skills/sia-plan/plan-reviewer-prompt.md +63 -0
- package/skills/sia-playbooks/SKILL.md +29 -0
- package/skills/sia-playbooks/reference-feature.md +100 -0
- package/skills/sia-playbooks/reference-flagging.md +50 -0
- package/skills/sia-playbooks/reference-orientation.md +92 -0
- package/skills/sia-playbooks/reference-regression.md +115 -0
- package/skills/sia-playbooks/reference-review.md +64 -0
- package/skills/sia-playbooks/reference-tools.md +239 -0
- package/skills/sia-pm-decision-log/SKILL.md +28 -0
- package/skills/sia-pm-risk-dashboard/SKILL.md +24 -0
- package/skills/sia-pm-sprint-summary/SKILL.md +27 -0
- package/skills/sia-prune/SKILL.md +45 -0
- package/skills/sia-qa-coverage/SKILL.md +28 -0
- package/skills/sia-qa-flaky/SKILL.md +20 -0
- package/skills/sia-qa-report/SKILL.md +26 -0
- package/skills/sia-reindex/SKILL.md +30 -0
- package/skills/sia-review-respond/SKILL.md +88 -0
- package/skills/sia-review-respond/pushback-patterns.md +90 -0
- package/skills/sia-search/SKILL.md +47 -0
- package/skills/sia-setup/SKILL.md +82 -0
- package/skills/sia-setup/setup-checklist.md +97 -0
- package/skills/sia-stats/SKILL.md +36 -0
- package/skills/sia-status/SKILL.md +44 -0
- package/skills/sia-sync/SKILL.md +46 -0
- package/skills/sia-team/SKILL.md +64 -0
- package/skills/sia-test/SKILL.md +92 -0
- package/skills/sia-test/testing-anti-patterns.md +104 -0
- package/skills/sia-tour/SKILL.md +29 -0
- package/skills/sia-upgrade/SKILL.md +43 -0
- package/skills/sia-verify/SKILL.md +81 -0
- package/skills/sia-visualize/SKILL.md +28 -0
- package/skills/sia-visualize-live/SKILL.md +55 -0
- package/skills/sia-visualize-live/scripts/graph-template.html +389 -0
- package/skills/sia-visualize-live/scripts/start-visualizer.sh +161 -0
- package/skills/sia-visualize-live/scripts/stop-visualizer.sh +55 -0
- package/skills/sia-visualize-live/scripts/visualizer-server.cjs +264 -0
- package/skills/sia-workspace/SKILL.md +57 -0
- package/src/agent/claude-md-template-flagging.md +219 -0
- package/src/agent/claude-md-template.md +213 -0
- package/src/agent/modules/sia-feature.md +100 -0
- package/src/agent/modules/sia-flagging.md +50 -0
- package/src/agent/modules/sia-orientation.md +92 -0
- package/src/agent/modules/sia-regression.md +115 -0
- package/src/agent/modules/sia-review.md +64 -0
- package/src/agent/modules/sia-tools.md +239 -0
- package/src/ast/extractors/c-include.ts +189 -0
- package/src/ast/extractors/csharp-project.ts +260 -0
- package/src/ast/extractors/prisma-schema.ts +44 -0
- package/src/ast/extractors/project-manifest.ts +111 -0
- package/src/ast/extractors/sql-schema.ts +67 -0
- package/src/ast/extractors/tier-a.ts +423 -0
- package/src/ast/extractors/tier-b.ts +289 -0
- package/src/ast/extractors/tier-dispatch.ts +247 -0
- package/src/ast/index-worker.ts +108 -0
- package/src/ast/indexer.ts +484 -0
- package/src/ast/languages.ts +408 -0
- package/src/ast/pagerank-builder.ts +125 -0
- package/src/ast/path-utils.ts +137 -0
- package/src/ast/tree-sitter/backends/native.ts +57 -0
- package/src/ast/tree-sitter/backends/wasm.ts +39 -0
- package/src/ast/tree-sitter/call-walker.ts +44 -0
- package/src/ast/tree-sitter/edit-computer.ts +55 -0
- package/src/ast/tree-sitter/query-runner.ts +46 -0
- package/src/ast/tree-sitter/service.ts +174 -0
- package/src/ast/tree-sitter/tree-cache.ts +39 -0
- package/src/ast/tree-sitter/types.ts +79 -0
- package/src/ast/watcher.ts +322 -0
- package/src/capture/chunker.ts +169 -0
- package/src/capture/consolidate.ts +127 -0
- package/src/capture/edge-inferrer.ts +161 -0
- package/src/capture/embedder.ts +166 -0
- package/src/capture/embedding-cache.ts +73 -0
- package/src/capture/flag-processor.ts +64 -0
- package/src/capture/hook.ts +67 -0
- package/src/capture/pipeline.ts +450 -0
- package/src/capture/prompts/consolidate.ts +25 -0
- package/src/capture/prompts/edge-infer.ts +29 -0
- package/src/capture/prompts/extract-flagged.ts +36 -0
- package/src/capture/prompts/extract.ts +42 -0
- package/src/capture/tokenizer.ts +147 -0
- package/src/capture/track-a-ast.ts +93 -0
- package/src/capture/track-b-llm.ts +149 -0
- package/src/capture/types.ts +64 -0
- package/src/cli/commands/community.ts +137 -0
- package/src/cli/commands/compare.ts +123 -0
- package/src/cli/commands/conflicts.ts +41 -0
- package/src/cli/commands/digest.ts +197 -0
- package/src/cli/commands/disable-flagging.ts +34 -0
- package/src/cli/commands/doctor.ts +240 -0
- package/src/cli/commands/download-model.ts +161 -0
- package/src/cli/commands/enable-flagging.ts +34 -0
- package/src/cli/commands/export-knowledge.ts +208 -0
- package/src/cli/commands/export.ts +85 -0
- package/src/cli/commands/freshness.ts +164 -0
- package/src/cli/commands/graph.ts +51 -0
- package/src/cli/commands/history.ts +139 -0
- package/src/cli/commands/import.ts +335 -0
- package/src/cli/commands/install.ts +156 -0
- package/src/cli/commands/lead-report.ts +241 -0
- package/src/cli/commands/learn.ts +321 -0
- package/src/cli/commands/pm-report.ts +413 -0
- package/src/cli/commands/prune.ts +75 -0
- package/src/cli/commands/qa-report.ts +278 -0
- package/src/cli/commands/reindex.ts +104 -0
- package/src/cli/commands/rollback.ts +70 -0
- package/src/cli/commands/search.ts +103 -0
- package/src/cli/commands/server.ts +91 -0
- package/src/cli/commands/share.ts +33 -0
- package/src/cli/commands/stats.ts +79 -0
- package/src/cli/commands/status.ts +176 -0
- package/src/cli/commands/sync.ts +96 -0
- package/src/cli/commands/team.ts +118 -0
- package/src/cli/commands/tour.ts +157 -0
- package/src/cli/commands/visualize-live.ts +162 -0
- package/src/cli/commands/workspace.ts +117 -0
- package/src/cli/index.ts +424 -0
- package/src/cli/learn-progress.ts +87 -0
- package/src/community/detection-bridge.ts +344 -0
- package/src/community/leiden.ts +462 -0
- package/src/community/raptor.ts +210 -0
- package/src/community/scheduler.ts +74 -0
- package/src/community/summarize.ts +115 -0
- package/src/decay/archiver.ts +73 -0
- package/src/decay/bridge-orphan-cleanup.ts +212 -0
- package/src/decay/consolidation-sweep.ts +112 -0
- package/src/decay/decay.ts +116 -0
- package/src/decay/deep-validator.ts +62 -0
- package/src/decay/episodic-promoter.ts +132 -0
- package/src/decay/maintenance-scheduler.ts +326 -0
- package/src/decay/scheduler.ts +6 -0
- package/src/decay/session-sweeper.ts +79 -0
- package/src/decay/types.ts +17 -0
- package/src/freshness/confidence-decay.ts +122 -0
- package/src/freshness/cuckoo-filter.ts +176 -0
- package/src/freshness/deep-validation.ts +345 -0
- package/src/freshness/dirty-tracker.ts +237 -0
- package/src/freshness/file-watcher-layer.ts +119 -0
- package/src/freshness/firewall.ts +64 -0
- package/src/freshness/git-reconcile-layer.ts +161 -0
- package/src/freshness/inverted-index.ts +158 -0
- package/src/freshness/stale-read-layer.ts +222 -0
- package/src/graph/audit.ts +69 -0
- package/src/graph/bridge-db.ts +141 -0
- package/src/graph/communities.ts +195 -0
- package/src/graph/db-interface.ts +259 -0
- package/src/graph/edges.ts +163 -0
- package/src/graph/entities.ts +327 -0
- package/src/graph/episodic-db.ts +113 -0
- package/src/graph/flags.ts +31 -0
- package/src/graph/meta-db.ts +200 -0
- package/src/graph/semantic-db.ts +101 -0
- package/src/graph/session-resume.ts +56 -0
- package/src/graph/snapshots.ts +342 -0
- package/src/graph/staging.ts +151 -0
- package/src/graph/types.ts +128 -0
- package/src/hooks/adapters/claude-code.ts +21 -0
- package/src/hooks/adapters/cline.ts +43 -0
- package/src/hooks/adapters/cursor.ts +65 -0
- package/src/hooks/adapters/generic.ts +12 -0
- package/src/hooks/agent-detect.ts +34 -0
- package/src/hooks/claude-md-directives.ts +32 -0
- package/src/hooks/event-router.ts +182 -0
- package/src/hooks/extractors/pattern-detector.ts +111 -0
- package/src/hooks/handlers/post-compact.ts +30 -0
- package/src/hooks/handlers/post-tool-use.ts +403 -0
- package/src/hooks/handlers/pre-compact.ts +100 -0
- package/src/hooks/handlers/session-end.ts +47 -0
- package/src/hooks/handlers/session-start.ts +154 -0
- package/src/hooks/handlers/stop.ts +128 -0
- package/src/hooks/handlers/user-prompt-submit.ts +68 -0
- package/src/hooks/plugin-branch-switch.ts +68 -0
- package/src/hooks/plugin-common.ts +47 -0
- package/src/hooks/plugin-post-compact.ts +28 -0
- package/src/hooks/plugin-post-tool-use.ts +38 -0
- package/src/hooks/plugin-pre-compact.ts +37 -0
- package/src/hooks/plugin-session-end.ts +37 -0
- package/src/hooks/plugin-session-start.ts +75 -0
- package/src/hooks/plugin-stop.ts +61 -0
- package/src/hooks/plugin-user-prompt-submit.ts +47 -0
- package/src/hooks/types.ts +43 -0
- package/src/knowledge/discovery.ts +238 -0
- package/src/knowledge/external-refs.ts +98 -0
- package/src/knowledge/freshness.ts +221 -0
- package/src/knowledge/ingest.ts +330 -0
- package/src/knowledge/markdown-export.ts +229 -0
- package/src/knowledge/markdown-import.ts +359 -0
- package/src/knowledge/patterns.ts +74 -0
- package/src/knowledge/templates.ts +307 -0
- package/src/llm/ai-sdk-adapter.ts +46 -0
- package/src/llm/config.ts +88 -0
- package/src/llm/cost-tracker.ts +110 -0
- package/src/llm/prompts/extraction.ts +55 -0
- package/src/llm/prompts/summarization.ts +36 -0
- package/src/llm/prompts/validation.ts +37 -0
- package/src/llm/provider-registry.ts +68 -0
- package/src/llm/reliability.ts +179 -0
- package/src/llm/schemas.ts +52 -0
- package/src/mcp/freshness-annotator.ts +69 -0
- package/src/mcp/server.ts +949 -0
- package/src/mcp/tools/sia-ast-query.ts +225 -0
- package/src/mcp/tools/sia-at-time.ts +151 -0
- package/src/mcp/tools/sia-backlinks.ts +87 -0
- package/src/mcp/tools/sia-batch-execute.ts +169 -0
- package/src/mcp/tools/sia-by-file.ts +89 -0
- package/src/mcp/tools/sia-community.ts +113 -0
- package/src/mcp/tools/sia-doctor.ts +73 -0
- package/src/mcp/tools/sia-execute-file.ts +122 -0
- package/src/mcp/tools/sia-execute.ts +104 -0
- package/src/mcp/tools/sia-expand.ts +158 -0
- package/src/mcp/tools/sia-fetch-and-index.ts +241 -0
- package/src/mcp/tools/sia-flag.ts +65 -0
- package/src/mcp/tools/sia-index.ts +111 -0
- package/src/mcp/tools/sia-note.ts +134 -0
- package/src/mcp/tools/sia-search.ts +105 -0
- package/src/mcp/tools/sia-stats.ts +63 -0
- package/src/mcp/tools/sia-sync-status.ts +44 -0
- package/src/mcp/tools/sia-upgrade.ts +247 -0
- package/src/mcp/truncate.ts +231 -0
- package/src/native/bridge.ts +167 -0
- package/src/native/fallback-ast-diff.ts +144 -0
- package/src/native/fallback-graph.ts +325 -0
- package/src/ontology/constraints.ts +56 -0
- package/src/ontology/errors.ts +8 -0
- package/src/ontology/middleware.ts +266 -0
- package/src/retrieval/bm25-search.ts +151 -0
- package/src/retrieval/context-assembly.ts +76 -0
- package/src/retrieval/graph-traversal.ts +168 -0
- package/src/retrieval/pagerank.ts +40 -0
- package/src/retrieval/query-classifier.ts +106 -0
- package/src/retrieval/reranker.ts +156 -0
- package/src/retrieval/search.ts +236 -0
- package/src/retrieval/throttle.ts +102 -0
- package/src/retrieval/vector-search.ts +203 -0
- package/src/retrieval/workspace-search.ts +130 -0
- package/src/sandbox/context-mode.ts +285 -0
- package/src/sandbox/credential-pass.ts +55 -0
- package/src/sandbox/executor.ts +235 -0
- package/src/security/pattern-detector.ts +127 -0
- package/src/security/rule-of-two.ts +50 -0
- package/src/security/sanitize.ts +46 -0
- package/src/security/semantic-consistency.ts +93 -0
- package/src/security/staging-promoter.ts +154 -0
- package/src/shared/config.ts +302 -0
- package/src/shared/diagnostics.ts +210 -0
- package/src/shared/errors.ts +48 -0
- package/src/shared/git-utils.ts +143 -0
- package/src/shared/llm-client.ts +120 -0
- package/src/shared/logger.ts +99 -0
- package/src/shared/types.ts +79 -0
- package/src/sync/client.ts +43 -0
- package/src/sync/conflict.ts +106 -0
- package/src/sync/dedup.ts +183 -0
- package/src/sync/hlc.ts +117 -0
- package/src/sync/keychain.ts +144 -0
- package/src/sync/pull.ts +232 -0
- package/src/sync/push.ts +131 -0
- package/src/types/chokidar.d.ts +23 -0
- package/src/visualization/graph-renderer.ts +312 -0
- package/src/visualization/subgraph-extract.ts +208 -0
- package/src/visualization/views/community-clusters.ts +246 -0
- package/src/visualization/views/dependency-map.ts +189 -0
- package/src/visualization/views/graph-explorer.ts +364 -0
- package/src/visualization/views/timeline.ts +247 -0
- package/src/workspace/api-contracts.ts +226 -0
- package/src/workspace/cross-repo.ts +61 -0
- package/src/workspace/detector.ts +190 -0
- package/src/workspace/manifest.ts +141 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sia-learn
|
|
3
|
+
description: Builds or refreshes SIA's complete knowledge graph — indexes code with tree-sitter, ingests docs, and detects communities. Use after major codebase changes, initial setup, or when the graph needs a full refresh.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# SIA Learn
|
|
7
|
+
|
|
8
|
+
Build the complete knowledge graph for the current repository in one step.
|
|
9
|
+
|
|
10
|
+
## What This Does
|
|
11
|
+
|
|
12
|
+
1. **Install** (if needed) — creates SIA databases, registers the repo
|
|
13
|
+
2. **Index code** — tree-sitter parse of all source files (25+ languages), extracts symbols, imports, calls
|
|
14
|
+
3. **Ingest docs** — discovers and parses README.md, CLAUDE.md, ARCHITECTURE.md, ADRs, API docs, changelogs
|
|
15
|
+
4. **Detect communities** — clusters related code into communities, generates summaries
|
|
16
|
+
5. **Report** — prints what was learned
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
**Full build** (first time or rebuild):
|
|
21
|
+
```bash
|
|
22
|
+
bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/index.ts learn
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**Incremental update** (fast — only changed files):
|
|
26
|
+
```bash
|
|
27
|
+
bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/index.ts learn --incremental
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**Force rebuild** (ignore caches and snapshots):
|
|
31
|
+
```bash
|
|
32
|
+
bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/index.ts learn --force
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**Quiet mode** (summary only):
|
|
36
|
+
```bash
|
|
37
|
+
bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/index.ts learn --quiet
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Crash Recovery
|
|
41
|
+
|
|
42
|
+
If the process crashes mid-run (OOM, Ctrl+C, power loss), re-running `/sia-learn` automatically resumes from the last checkpoint. A `.sia-learn-progress.json` file tracks progress and is deleted on successful completion.
|
|
43
|
+
|
|
44
|
+
## When To Use
|
|
45
|
+
|
|
46
|
+
- First time setting up SIA on a project
|
|
47
|
+
- After pulling major changes from remote
|
|
48
|
+
- When the knowledge graph feels stale or incomplete
|
|
49
|
+
- After a large refactoring
|
|
50
|
+
- When onboarding to a new codebase
|
|
51
|
+
|
|
52
|
+
## After Learning
|
|
53
|
+
|
|
54
|
+
Use SIA's MCP tools to query the knowledge graph:
|
|
55
|
+
- `sia_search` — semantic search across all knowledge
|
|
56
|
+
- `sia_community` — browse community-level summaries
|
|
57
|
+
- `sia_by_file` — look up knowledge for specific files
|
|
58
|
+
- `sia_expand` — explore entity neighborhoods
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sia-plan
|
|
3
|
+
description: Writes implementation plans using SIA's knowledge of module topology, architectural constraints, and project conventions. Use when creating multi-step implementation plans or breaking down specs into tasks.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# SIA-Enhanced Plan Writing
|
|
7
|
+
|
|
8
|
+
Write implementation plans pre-loaded with architectural constraints, module boundaries, and conventions from SIA's knowledge graph.
|
|
9
|
+
|
|
10
|
+
## Checklist
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
- [ ] Step 0: Load graph context — community structure, decisions, conventions
|
|
14
|
+
- [ ] Step 1: Scope check — use community boundaries to find natural split points
|
|
15
|
+
- [ ] Step 2: File structure — sia_by_file for each file to understand dependencies
|
|
16
|
+
- [ ] Step 3: Task definition — embed graph context (conventions, dependencies, known bugs) per task
|
|
17
|
+
- [ ] Step 4-6: Standard plan writing, review, handoff
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Workflow
|
|
21
|
+
|
|
22
|
+
### Step 0 — Load Graph Context (NEW)
|
|
23
|
+
|
|
24
|
+
Before file structure mapping, query the graph:
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
sia_community({ level: 1 })
|
|
28
|
+
sia_search({ query: "<feature area> architecture patterns", node_types: ["Decision", "Convention"], limit: 15 })
|
|
29
|
+
sia_search({ query: "file structure module organization <area>", node_types: ["Convention"], limit: 10 })
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Use community structure to understand module boundaries. Use conventions to know how this codebase organizes code.
|
|
33
|
+
|
|
34
|
+
### Step 1 — Scope Check (enhanced)
|
|
35
|
+
|
|
36
|
+
When checking if the spec should be decomposed, use community boundaries from the graph to determine natural split points — not just intuition.
|
|
37
|
+
|
|
38
|
+
### Step 2 — File Structure (ENHANCED)
|
|
39
|
+
|
|
40
|
+
When mapping which files to create/modify:
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
sia_by_file({ file_path: "<each_file_to_modify>" })
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
For each file, understand:
|
|
47
|
+
- What entities already exist in this file
|
|
48
|
+
- What depends on this file (via edges)
|
|
49
|
+
- What conventions apply to this area
|
|
50
|
+
|
|
51
|
+
This prevents plans that unknowingly violate module boundaries or break downstream consumers.
|
|
52
|
+
|
|
53
|
+
### Step 3 — Task Definition (ENHANCED)
|
|
54
|
+
|
|
55
|
+
For each task, include relevant graph context in the task description:
|
|
56
|
+
- "This file follows the [Convention Name] pattern — see entity [id]"
|
|
57
|
+
- "Function X is called by Y and Z — changes must be backward-compatible"
|
|
58
|
+
- "This area had a bug [Bug Name] — test for regression"
|
|
59
|
+
|
|
60
|
+
### Step 4-6 — Standard plan writing, review, handoff
|
|
61
|
+
|
|
62
|
+
**After writing the plan:** Dispatch plan reviewer subagent — see [plan-reviewer-prompt.md](plan-reviewer-prompt.md)
|
|
63
|
+
|
|
64
|
+
Follow the standard plan document format, review loop, and execution handoff.
|
|
65
|
+
|
|
66
|
+
## Key Principle
|
|
67
|
+
|
|
68
|
+
**Plans that respect existing architecture succeed faster.** SIA's graph knows the module topology, conventions, and dependencies. Use this to write plans that work WITH the codebase, not against it.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Plan Document Reviewer Prompt
|
|
2
|
+
|
|
3
|
+
Use this template when dispatching a plan reviewer subagent after writing an implementation plan.
|
|
4
|
+
|
|
5
|
+
**Purpose:** Verify the plan respects module boundaries, references correct conventions, doesn't contradict established decisions, and accounts for known dependencies.
|
|
6
|
+
|
|
7
|
+
**Dispatch after:** Plan document is written.
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
Agent tool (general-purpose):
|
|
11
|
+
description: "Review plan against graph"
|
|
12
|
+
prompt: |
|
|
13
|
+
You are a plan reviewer with access to SIA's knowledge graph. Verify this plan
|
|
14
|
+
is sound and respects the project's architecture.
|
|
15
|
+
|
|
16
|
+
**Plan to review:** [PLAN_FILE_PATH]
|
|
17
|
+
|
|
18
|
+
## What to Check
|
|
19
|
+
|
|
20
|
+
| Category | What to Look For |
|
|
21
|
+
|----------|------------------|
|
|
22
|
+
| Module boundaries | Does the plan modify files across community boundaries without acknowledging it? |
|
|
23
|
+
| Convention compliance | Does each task follow known conventions for its area? |
|
|
24
|
+
| Decision conflicts | Does any task contradict an established Decision entity? |
|
|
25
|
+
| Dependency awareness | Are downstream consumers of modified files accounted for? |
|
|
26
|
+
| Known bugs | Does the plan touch areas with known Bug entities without testing for regression? |
|
|
27
|
+
| Staleness | Were any referenced files modified after the plan was written? |
|
|
28
|
+
|
|
29
|
+
## Verification Process
|
|
30
|
+
|
|
31
|
+
For each task in the plan:
|
|
32
|
+
1. Run `sia_by_file` on the target file
|
|
33
|
+
2. Check for Convention entities that apply
|
|
34
|
+
3. Check for Bug entities in the area
|
|
35
|
+
4. Verify no Decision entities conflict with the proposed changes
|
|
36
|
+
|
|
37
|
+
## Calibration
|
|
38
|
+
|
|
39
|
+
**Only flag issues that would cause real problems during implementation.**
|
|
40
|
+
A plan that doesn't mention every convention is fine — only flag conventions
|
|
41
|
+
that would be VIOLATED by the planned changes. Missing test coverage for a
|
|
42
|
+
known bug area IS worth flagging.
|
|
43
|
+
|
|
44
|
+
Approve unless there are structural problems that would lead to broken code
|
|
45
|
+
or architectural violations.
|
|
46
|
+
|
|
47
|
+
## Output Format
|
|
48
|
+
|
|
49
|
+
## Plan Review
|
|
50
|
+
|
|
51
|
+
**Status:** Approved | Issues Found
|
|
52
|
+
|
|
53
|
+
**Graph Conflicts (if any):**
|
|
54
|
+
- [Task N]: Conflicts with [Decision/Convention: name] — [why it matters]
|
|
55
|
+
|
|
56
|
+
**Dependency Risks:**
|
|
57
|
+
- [File X] is consumed by [Y, Z] — changes need backward compatibility
|
|
58
|
+
|
|
59
|
+
**Recommendations (advisory):**
|
|
60
|
+
- [suggestions for improvement]
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Reviewer returns:** Status, Graph Conflicts, Dependency Risks, Recommendations
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sia-playbooks
|
|
3
|
+
description: Loads SIA task-specific playbooks for regression analysis, feature development, code review, or orientation. Called automatically by CLAUDE.md behavioral directives after task classification.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# SIA Task Playbooks
|
|
7
|
+
|
|
8
|
+
This skill provides detailed step-by-step guidance for using SIA's knowledge graph during specific task types. The CLAUDE.md behavioral spec directs you here after task classification.
|
|
9
|
+
|
|
10
|
+
## Available Playbooks
|
|
11
|
+
|
|
12
|
+
Load the playbook matching your task type by reading the corresponding reference file in this skill's directory:
|
|
13
|
+
|
|
14
|
+
| Task Type | Reference File |
|
|
15
|
+
|---|---|
|
|
16
|
+
| Bug fix / Regression | `reference-regression.md` |
|
|
17
|
+
| Feature development | `reference-feature.md` |
|
|
18
|
+
| Code review | `reference-review.md` |
|
|
19
|
+
| Orientation / Architecture | `reference-orientation.md` |
|
|
20
|
+
| Full tool reference | `reference-tools.md` |
|
|
21
|
+
| Flagging guidance | `reference-flagging.md` |
|
|
22
|
+
|
|
23
|
+
## Workflow
|
|
24
|
+
|
|
25
|
+
1. CLAUDE.md classifies the task (bug-fix, feature, review, orientation)
|
|
26
|
+
2. CLAUDE.md directs you to invoke `/sia-playbooks`
|
|
27
|
+
3. Read the matching reference file from this skill's directory
|
|
28
|
+
4. Follow the step-by-step guidance in the playbook
|
|
29
|
+
5. The playbook tells you exactly which SIA tools to call and in what order
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Sia — Feature Implementation Playbook
|
|
2
|
+
|
|
3
|
+
*Loaded by the base CLAUDE.md when `task_type = 'feature'`.*
|
|
4
|
+
*Follow these steps in order. They replace the condensed Step 1 in the base module.*
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Feature Implementation
|
|
9
|
+
|
|
10
|
+
Feature work benefits from Sia in two ways: understanding the architectural context
|
|
11
|
+
before writing code (avoiding decisions that conflict with past choices), and discovering
|
|
12
|
+
conventions that constrain implementation (patterns the team has established that must
|
|
13
|
+
be followed). Both types of retrieval happen before a single line of code is written.
|
|
14
|
+
|
|
15
|
+
**Step 1 — Structural orientation**
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
sia_community(feature_domain, level=1)
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Get module-level structural orientation before touching any files. This tells you which
|
|
22
|
+
existing modules are involved, how they relate, and what architectural patterns govern
|
|
23
|
+
this area. For cross-cutting features that span multiple modules, call `sia_community`
|
|
24
|
+
at level=2 first for a system-wide view, then level=1 for the relevant subsystem.
|
|
25
|
+
|
|
26
|
+
**Step 2 — Decision and convention retrieval**
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
sia_search(feature_topic,
|
|
30
|
+
task_type='feature',
|
|
31
|
+
node_types=['Decision', 'Convention'],
|
|
32
|
+
limit=10)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
This surfaces: architectural decisions that constrain how the feature must be built,
|
|
36
|
+
conventions the implementation must follow, and prior work in this area that you should
|
|
37
|
+
be consistent with. Pay particular attention to Convention entities — see Step 5.
|
|
38
|
+
|
|
39
|
+
**Step 3 — File-scoped retrieval**
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
sia_by_file(file_path) // for each file to be created or modified
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
For files in a linked repository within the workspace, use
|
|
46
|
+
`sia_by_file(file_path, workspace=true)` — this surfaces cross-repo edges for that
|
|
47
|
+
specific file. Call `sia_by_file` before `sia_search` when the file is the primary
|
|
48
|
+
anchor; call after when the topic is the primary anchor.
|
|
49
|
+
|
|
50
|
+
**Step 4 — Optional relationship traversal**
|
|
51
|
+
|
|
52
|
+
If a returned Decision entity references related entities you need to understand before
|
|
53
|
+
implementing, call:
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
sia_expand(entity_id, depth=1)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Use only when the relationship is directly decision-relevant, not out of curiosity. This
|
|
60
|
+
consumes one of the two allowed `sia_expand` calls for the session.
|
|
61
|
+
|
|
62
|
+
**Step 5 — Convention scanning (critical)**
|
|
63
|
+
|
|
64
|
+
Before writing any code, scan all returned Convention entities carefully. Conventions
|
|
65
|
+
are hard constraints, not style suggestions. If a Convention says "all errors must extend
|
|
66
|
+
`AppBaseError`," that is a requirement, not a preference. Violations are bugs.
|
|
67
|
+
|
|
68
|
+
State the applicable conventions before you start implementing:
|
|
69
|
+
"Convention #conv-44 requires all DB access to go through the Repository layer — I'll
|
|
70
|
+
route this through `UserRepository` rather than querying directly."
|
|
71
|
+
|
|
72
|
+
**Step 6 — Cross-repo workspace search (if applicable)**
|
|
73
|
+
|
|
74
|
+
If the feature spans linked repositories, also call:
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
sia_search(api_topic, workspace=true)
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
This surfaces API contracts, shared types, and cross-service calls that the feature
|
|
81
|
+
must conform to. Only use `workspace: true` when the task genuinely crosses repo
|
|
82
|
+
boundaries — it adds 400ms latency and cross-repo noise for single-repo tasks.
|
|
83
|
+
|
|
84
|
+
**Step 7 — Implement**
|
|
85
|
+
|
|
86
|
+
Implement following all retrieved conventions and prior decisions. Cite the relevant
|
|
87
|
+
entities in comments where the constraint is non-obvious.
|
|
88
|
+
|
|
89
|
+
**Step 8 — Flag if applicable**
|
|
90
|
+
|
|
91
|
+
If flagging is enabled (`enableFlagging: true`) and you made an architectural decision
|
|
92
|
+
during implementation: `sia_flag(decision_summary)`. If flagging is disabled, skip
|
|
93
|
+
this step — the session-end capture will record the decision automatically, though
|
|
94
|
+
with lower precision.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Tool Budget for This Playbook
|
|
99
|
+
|
|
100
|
+
This playbook uses 3 tool calls in the standard case: `sia_community` (1) + `sia_search` (2) + `sia_by_file` (3). The optional Step 4 `sia_expand` call pushes the count to 4, which exceeds the base module's 3-tool limit. This is permitted only when genuinely necessary — it consumes one of the two allowed `sia_expand` calls for the session. It does NOT consume a regression-exception slot. The 4-call regression exception applies exclusively to `task_type='bug-fix'` sessions. For straightforward features where `sia_expand` is not needed, stay within 3 calls.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Sia — Flagging Guidance
|
|
2
|
+
|
|
3
|
+
*Loaded when flagging is enabled (`enableFlagging: true`) and you reach Step 4.*
|
|
4
|
+
*`sia_flag` is only available when `sia enable-flagging` has been run.*
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## When to Call `sia_flag`
|
|
9
|
+
|
|
10
|
+
Call `sia_flag` at most 2–3 times per session, and only for:
|
|
11
|
+
|
|
12
|
+
1. **An architectural decision made this session** that will constrain future work —
|
|
13
|
+
for example, choosing a pattern, library, or structural approach that other modules
|
|
14
|
+
should follow.
|
|
15
|
+
2. **A non-obvious root cause** discovered during debugging — something that was not
|
|
16
|
+
evident from the code and that a future developer would need to know.
|
|
17
|
+
3. **An explicit developer preference** stated during the session ("we always do X this
|
|
18
|
+
way," "never use Y for this").
|
|
19
|
+
4. **A new cross-cutting pattern introduced** that other modules should replicate.
|
|
20
|
+
|
|
21
|
+
The test: would the next developer who picks up this task need to know this? If yes,
|
|
22
|
+
flag it. If they could infer it from the code in 30 seconds, do not flag it.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## When NOT to Call `sia_flag`
|
|
27
|
+
|
|
28
|
+
- Routine code changes or normal implementation steps.
|
|
29
|
+
- Things that are obvious from the code itself.
|
|
30
|
+
- Single-line edits or minor refactors.
|
|
31
|
+
- General best practices (Sia already knows these from the codebase).
|
|
32
|
+
- Anything you would not bother to explain in a code review comment.
|
|
33
|
+
|
|
34
|
+
The 2–3 per session maximum is a hard ceiling. Flagging everything degrades the
|
|
35
|
+
signal-to-noise ratio in the graph. Be selective.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## How to Write a Good `reason`
|
|
40
|
+
|
|
41
|
+
The reason should be a complete, self-contained description of what happened and why
|
|
42
|
+
it matters. It will be stored and retrieved without context, so it must stand alone.
|
|
43
|
+
|
|
44
|
+
Good: `"chose express-rate-limit at route level, not middleware — rate limits are per-endpoint not global"`
|
|
45
|
+
Good: `"root cause: EventEmitter.on() not awaited in init.ts, fires before DB ready"`
|
|
46
|
+
Bad: `"fixed the bug"` (not self-contained)
|
|
47
|
+
Bad: `"important decision"` (no content)
|
|
48
|
+
|
|
49
|
+
Keep it under 100 characters after sanitization. Colons, backticks, underscores, and
|
|
50
|
+
forward slashes are all permitted in the reason string.
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Sia — New Developer Orientation Playbook
|
|
2
|
+
|
|
3
|
+
*Loaded by the base CLAUDE.md for architecture questions and new-developer orientation.*
|
|
4
|
+
*Follow these steps in order. They replace the condensed Step 1 in the base module.*
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## New Developer Codebase Orientation
|
|
9
|
+
|
|
10
|
+
When a developer asks "how does this system work," "explain the architecture," or is
|
|
11
|
+
orienting to an unfamiliar codebase, the goal is a coherent narrative — not a list of
|
|
12
|
+
entity names. Sia's community detection has clustered the codebase into meaningful
|
|
13
|
+
modules with generated summaries; use those summaries to build understanding rather than
|
|
14
|
+
surfacing raw entity lists from `sia_search`.
|
|
15
|
+
|
|
16
|
+
**Step 0 — Graph readiness check**
|
|
17
|
+
|
|
18
|
+
Before calling `sia_community`, check whether the graph is large enough to have
|
|
19
|
+
community structure. If `sia_community` returns `global_unavailable: true` (graph
|
|
20
|
+
below 100 entities), skip Steps 1 and 2 entirely and go directly to Step 3. Tell
|
|
21
|
+
the developer: "The memory graph is still building — Sia improves with each session.
|
|
22
|
+
Here is what I can tell you from existing captured context:" then present the
|
|
23
|
+
Step 3 `sia_search` results as a narrative (Step 4 still applies — no raw entity
|
|
24
|
+
lists even in fallback mode).
|
|
25
|
+
|
|
26
|
+
If `sia_community` returns zero communities (graph is large enough but the topic
|
|
27
|
+
query matched nothing), do not stop. Continue to Step 3 (`sia_search`) and present
|
|
28
|
+
whatever decisions and concepts are available.
|
|
29
|
+
|
|
30
|
+
**Step 1 — System-wide structural view**
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
sia_community(query="architecture overview", level=2)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Level 2 gives a coarse architectural view: major subsystems, how they relate, and what
|
|
37
|
+
the overall design intent is. This is the starting point for any orientation.
|
|
38
|
+
|
|
39
|
+
**Step 2 — Subsystem drill-down**
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
sia_community(query=<developer's primary area>, level=1)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Level 1 gives module-level summaries. If the developer is focused on a specific area
|
|
46
|
+
(authentication, data pipeline, API layer), drill into the relevant subsystem here.
|
|
47
|
+
|
|
48
|
+
**Step 3 — Key decisions**
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
sia_search("architectural decisions constraints rationale",
|
|
52
|
+
node_types=['Decision'],
|
|
53
|
+
limit=10)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
This surfaces the decisions that constrain future work — why certain patterns exist,
|
|
57
|
+
what was tried and rejected, and what the team has committed to. This is the context
|
|
58
|
+
that is hardest to recover from code alone.
|
|
59
|
+
|
|
60
|
+
**Step 4 — Present as a narrative**
|
|
61
|
+
|
|
62
|
+
Do not return a list of entity names. Synthesise the retrieved summaries and decisions
|
|
63
|
+
into a coherent explanation of the system: how the major modules relate, what the key
|
|
64
|
+
architectural decisions are, and what a developer needs to know before making changes.
|
|
65
|
+
|
|
66
|
+
A good orientation response answers: what does this system do, how is it structured,
|
|
67
|
+
what are the non-obvious constraints, and where should I start?
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Level Guide for `sia_community`
|
|
72
|
+
|
|
73
|
+
`level=2` — Coarse architectural overview. Appropriate for system-wide questions,
|
|
74
|
+
"explain the whole system," and first-day orientation.
|
|
75
|
+
|
|
76
|
+
`level=1` — Subsystem / module level. Appropriate for "explain the auth module" or
|
|
77
|
+
"how does the data pipeline work."
|
|
78
|
+
|
|
79
|
+
`level=0` — Fine-grained cluster view. Rarely needed by the agent; more useful from
|
|
80
|
+
the CLI when investigating a specific component. Do not use for orientation.
|
|
81
|
+
|
|
82
|
+
Never call `sia_community` as a fallback for a failed `sia_search` — they serve
|
|
83
|
+
different purposes. `sia_search` finds specific entities; `sia_community` explains
|
|
84
|
+
structure.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Tool Budget for This Playbook
|
|
89
|
+
|
|
90
|
+
This playbook uses 3 tool calls: `sia_community(level=2)` (1) + `sia_community(level=1)`
|
|
91
|
+
(2) + `sia_search` (3). This is exactly the 3-tool limit. No `sia_expand` is needed for
|
|
92
|
+
orientation — community summaries already contain synthesised relationship context.
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Sia — Regression Investigation Playbook
|
|
2
|
+
|
|
3
|
+
*Loaded by the base CLAUDE.md when `task_type = 'bug-fix'` (regression signal detected).*
|
|
4
|
+
*Follow these steps in order. They replace the condensed Step 1 in the base module.*
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Regression Investigation
|
|
9
|
+
|
|
10
|
+
A regression is any situation where something worked before and is now broken. The key
|
|
11
|
+
capability that distinguishes Sia's regression support from generic memory retrieval is
|
|
12
|
+
`sia_at_time`: it lets you query the graph as it existed at a point in the past, surfacing
|
|
13
|
+
exactly what facts changed between then and now.
|
|
14
|
+
|
|
15
|
+
**Step 1 — Initial search (current state)**
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
sia_search(symptom_description,
|
|
19
|
+
task_type='bug-fix',
|
|
20
|
+
node_types=['Bug', 'Solution', 'Decision'],
|
|
21
|
+
limit=10)
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Scan results for entities matching the symptom, affected files, or known related
|
|
25
|
+
components. Look for a prior instance of this bug, a Decision that was recently changed,
|
|
26
|
+
or a Solution that should have prevented this.
|
|
27
|
+
|
|
28
|
+
**Step 2 — Causal chain traversal (conditional)**
|
|
29
|
+
|
|
30
|
+
If a relevant entity is found in Step 1, call:
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
sia_expand(entity_id, depth=1, edge_types=['supersedes', 'caused_by', 'solves'])
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
This surfaces what superseded the old fact, what caused the bug, and what solutions were
|
|
37
|
+
previously applied. This call is optional — use it only when the Step 1 result points to
|
|
38
|
+
a likely causal chain. It counts against the 2-call sia_expand session budget.
|
|
39
|
+
|
|
40
|
+
**Step 3 — Temporal investigation (MANDATORY — never skip)**
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
// Initial call — use the default limit
|
|
44
|
+
sia_at_time(
|
|
45
|
+
as_of='<estimated date regression began>',
|
|
46
|
+
tags=[<relevant tags>],
|
|
47
|
+
limit=20
|
|
48
|
+
)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Important: `limit` applies to **both** `entities[]` and `invalidated_entities[]` simultaneously. Bumping `limit` to 50 on a re-call returns 50 current entities alongside 50 invalidated entities — the extra current entities are usually irrelevant to regression work and add response payload that may hit the `maxResponseTokens` cap. Prefer narrowed re-calls over blindly increasing `limit`.
|
|
52
|
+
|
|
53
|
+
If the initial call returns `invalidated_count > invalidated_entities.length` (result is truncated), make a **narrowed follow-up** targeting causally relevant entity types rather than raising `limit` alone:
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
// Truncation follow-up — narrow by type to reduce current-entity noise
|
|
57
|
+
sia_at_time(
|
|
58
|
+
as_of='<same date>',
|
|
59
|
+
entity_types=['Decision', 'Solution', 'Bug'], // causally relevant types
|
|
60
|
+
tags=[<relevant tags>],
|
|
61
|
+
limit=50
|
|
62
|
+
)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Without this call, the temporal investigation capability is completely unused. `sia_at_time`
|
|
66
|
+
returns two arrays — read them in this order:
|
|
67
|
+
|
|
68
|
+
`invalidated_entities[]` is the primary diagnostic signal. These are facts that ENDED on
|
|
69
|
+
or before `as_of`. Each entry's `t_valid_until` is exactly when that fact stopped being
|
|
70
|
+
true. **Entries with `t_valid_until` closest to `as_of` are the most temporally
|
|
71
|
+
relevant** — they represent what changed most recently before the regression and are
|
|
72
|
+
therefore the highest-priority root cause candidates. The array is sorted by
|
|
73
|
+
`t_valid_until DESC` so the most relevant entries appear first.
|
|
74
|
+
|
|
75
|
+
`entities[]` contains facts still valid at `as_of`. Compare these against the current
|
|
76
|
+
`sia_search` output to see what has changed since that date.
|
|
77
|
+
|
|
78
|
+
If `invalidated_count > invalidated_entities.length`, the result is truncated. Make
|
|
79
|
+
additional narrowed calls using `entity_types` or `tags` to retrieve the remaining
|
|
80
|
+
entries. Do not treat a truncated result as the complete picture.
|
|
81
|
+
|
|
82
|
+
**Step 4 — Explain the delta**
|
|
83
|
+
|
|
84
|
+
Present the findings to the developer with specific entity citations. The answer to
|
|
85
|
+
"what caused the regression" should be grounded in one or more specific invalidated
|
|
86
|
+
entities, not general speculation.
|
|
87
|
+
|
|
88
|
+
**Step 5 — Flag if applicable**
|
|
89
|
+
|
|
90
|
+
If flagging is enabled (`enableFlagging: true`) and the root cause is non-obvious:
|
|
91
|
+
`sia_flag("Root cause: [description]")`. If flagging is disabled, skip this step.
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Edge Types for Regression Investigation
|
|
96
|
+
|
|
97
|
+
When calling `sia_expand` during regression work, these edge types are most diagnostic:
|
|
98
|
+
|
|
99
|
+
`supersedes` — what replaced the old Decision or Solution
|
|
100
|
+
`caused_by` — what entity directly caused this Bug
|
|
101
|
+
`solves` — what Solution was supposed to address this Bug
|
|
102
|
+
`invalidates` — what action marked the old fact as no longer true
|
|
103
|
+
|
|
104
|
+
Use `edge_types=['supersedes','caused_by','solves']` as the default filter for regression
|
|
105
|
+
traversal. This keeps the neighborhood focused on causal relationships rather than
|
|
106
|
+
structural dependencies, which tend to be less diagnostic for regression work.
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Tool Budget for This Playbook
|
|
111
|
+
|
|
112
|
+
This playbook uses up to 4 tool calls, which is the permitted exception to the 3-tool
|
|
113
|
+
invariant. The sequence is: `sia_search` (1) + conditional `sia_expand` (2) +
|
|
114
|
+
`sia_at_time` (3) + one additional narrowed `sia_at_time` if truncated (4). If no
|
|
115
|
+
causal entity is found in Step 1, skip `sia_expand` and stay within 3 calls.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Sia — PR / Code Review Playbook
|
|
2
|
+
|
|
3
|
+
*Loaded by the base CLAUDE.md when `task_type = 'review'`.*
|
|
4
|
+
*Follow these steps in order. They replace the condensed Step 1 in the base module.*
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## PR / Code Review
|
|
9
|
+
|
|
10
|
+
Code review with Sia is convention-first: retrieve the full set of project-specific
|
|
11
|
+
conventions before looking at a single line of code. Generic best-practice rules are
|
|
12
|
+
secondary. What matters is whether the change conforms to the patterns this team has
|
|
13
|
+
established in this project.
|
|
14
|
+
|
|
15
|
+
**Step 1 — Convention retrieval**
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
sia_search("conventions standards style patterns",
|
|
19
|
+
task_type='review',
|
|
20
|
+
node_types=['Convention'],
|
|
21
|
+
limit=15)
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Use `limit=15` here — this is one of the few contexts where maximum coverage matters
|
|
25
|
+
more than latency. You need the full convention set before evaluating the code.
|
|
26
|
+
|
|
27
|
+
**Step 2 — File-scoped retrieval**
|
|
28
|
+
|
|
29
|
+
For each file in the PR:
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
sia_by_file(file_path)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
This surfaces decisions, patterns, and prior bug history for each changed file. A file
|
|
36
|
+
that has had recurring bugs around a specific pattern is worth scrutinising more closely.
|
|
37
|
+
|
|
38
|
+
**Step 3 — Evaluate each change**
|
|
39
|
+
|
|
40
|
+
Compare each change against the retrieved conventions and file-specific context. The
|
|
41
|
+
evaluation question is: does this change conform to the conventions the team has
|
|
42
|
+
established, and does it respect the decisions that constrain this file?
|
|
43
|
+
|
|
44
|
+
**Step 4 — Report violations by entity ID**
|
|
45
|
+
|
|
46
|
+
For each violation, cite the specific Convention entity that is breached. Do not
|
|
47
|
+
paraphrase the convention — reference it by ID so the developer can look it up:
|
|
48
|
+
|
|
49
|
+
> "Violation of Convention #conv-44: direct database query in service layer —
|
|
50
|
+
> all DB access must go through the Repository layer per this convention."
|
|
51
|
+
|
|
52
|
+
Never apply only general best-practice conventions. Project-specific conventions
|
|
53
|
+
stored in Sia take precedence and are the primary review criteria.
|
|
54
|
+
|
|
55
|
+
**Step 5 — Summarise**
|
|
56
|
+
|
|
57
|
+
Provide a summary that distinguishes: convention violations (must fix), Sia-unaware
|
|
58
|
+
patterns (worth noting), and items where no convention applies (developer discretion).
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Tool Budget for This Playbook
|
|
63
|
+
|
|
64
|
+
This playbook uses 1 + N tool calls: `sia_search` (1) + `sia_by_file` once per changed file (N calls, one each). The per-file `sia_by_file` calls are permitted by the review exception in Invariant 1 of the base module — they do not count against the 3-tool limit. This exception applies exclusively to `task_type='review'` sessions. Review is inherently multi-file and this budget is appropriate.
|