datit309/supergraph / plugins/supergraph/skills/scan
scan
UnverifiedScan project once per session. Run first β all other skills depend on this.
/supergraph:scan
Load verified, project-scoped graph context once. Follow the shared
references/codebase-memory-contract.md.
Announce: "π‘ /supergraph:scan β loading project context..."
1. Detect project and branch
Use git branch --show-current, resolve the repository to an absolute path,
and run bin/detect-project.sh when present. Otherwise detect commands from:
| File | Type | Test | Lint | Format | Build |
|---|---|---|---|---|---|
package.json | node | npm test -- | npx eslint . | npx prettier --write . | npm run build |
Cargo.toml | rust | cargo test | cargo clippy | cargo fmt | cargo build |
pyproject.toml | python | pytest | ruff check . | ruff format . | python -m build |
go.mod | go | go test ./... | golangci-lint run | gofmt -w . | go build ./... |
pubspec.yaml | flutter | flutter test | flutter analyze | dart format . | flutter build |
Ask when none match; never guess commands. Derive one stable CBM_PROJECT from
the repository root name and retain it across branches. Default
CBM_INDEX_MODE=moderate.
2. Verify provider and freshness
- Call
list_projectsand findCBM_PROJECT. - If found, call
index_status(project=CBM_PROJECT). - Treat missing project, changed branch, stale state, tool error, failed state,
or
status: "degraded"as requiring a new index. - TTL reuse (10m): If
index_statusreturnsstatus: "ready"andBRANCHmatches.supergraph-env:BRANCHandnow - CBM_INDEXED_AT < 600sandhead_shaunchanged, reuse index β skipindex_repository. Otherwise proceed to step 5. TTL check requires healthyindex_status; never cache degraded/stale/error. On cache hit, still re-runindex_statusonce to confirm liveness beforeget_graph_schema. - Call
index_repository(repo_path=<absolute repo path>, name=CBM_PROJECT, mode=CBM_INDEX_MODE)when required (cache miss or stale/degraded). Requirestatus: "indexed". - Re-run
index_status; never claim reuse without a healthy response. - Call
get_graph_schema(project=CBM_PROJECT)andget_architecture(project=CBM_PROJECT, aspects=["overview","layers","boundaries","clusters","hotspots"])in parallel after verifiedindex_status. - On cache hit,
get_graph_schemaandget_architecturemay run in parallel immediately after TTL-passedindex_status.
On any mandatory provider/index/schema error: STOP, show the exact error and the
recovery command (codebase-memory-mcp cli index_repository --repo-path <absolute> --name <project> --mode moderate). Do not write freshness state.
3. Reverify Serena
Always call Serena initial instructions and activate project with the absolute repository path:
mcp__serena__activate_project(project=<absolute repo path>).
Then load a top-level symbols overview (mcp__serena__get_symbols_overview).
Set SERENA_ACTIVE=true only after success; otherwise set it false and report Serena unavailable.
4. Write .supergraph-env
Only after healthy index_status, schema, and architecture responses:
PROJECT_TYPE=...
TEST_CMD=status=0; for test_file in plugins/supergraph/tests/test-*.sh; do bash "$test_file" || status=1; done; exit "$status"
LINT_CMD=bash -n install.sh plugins/supergraph/install.sh plugins/supergraph/tests/test-*.sh
FORMAT_CMD=...
BUILD_CMD=...
BRANCH=...
GRAPH_PROVIDER=codebase-memory-mcp
CBM_PROJECT=...
CBM_INDEX_MODE=moderate
CBM_INDEXED_AT=YYYY-MM-DDTHH:MM:SS
SERENA_ACTIVE=true|false
SCAN_TIMESTAMP=YYYY-MM-DDTHH:MM:SS
Branch-matched TTL reuse still requires index_status and Serena revalidation; TTL only skips index_repository, never skips index_status or schema checks. Serena revalidation is guarded by SERENA_ACTIVE β skip initial_instructions if .supergraph-env:SERENA_ACTIVE=true and scan ran <10m ago.
5. Report
Report project/type/commands, provider/project/index status, architecture counts available from the response, Serena status, and whether scan was fresh or reused.
Rules
- Never record false freshness after errors or degraded state.
- All graph calls include
project=CBM_PROJECTwhere supported. - Respect pagination and failure semantics in the shared contract.
- For trivial β€2 files / <20 lines, graph discovery may stop after verified status (no hubs/bridges needed).
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 464k | Updated | Claude CodeCodex | Verified | Install |
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 464k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why β repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" β or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 318k | Updated | Claude CodeCodex | Unverified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 318k | Updated | Claude CodeCodex | Unverified | Install |