sp-map-scan
Use when a brownfield workflow needs a fresh graph-native cognition baseline and you must collect full project-internal evidence before graph reconstruction.
- License 许可
- MIT
- 最近更新
- 2026-08-07
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- sp-map-scan
- metadata
- { "author": "github-spec-kit", "source": "templates/commands/map-scan.md" }
- description
- Use when a brownfield workflow needs a fresh graph-native cognition baseline and you must collect full project-internal evidence before graph reconstruction.
- argument-hint
- Optional subsystem, directory, or workflow area to emphasize while scanning
- compatibility
- Requires spec-kit project structure with .specify/ directory
- user-invocable
- true
02 资源文件 2
- 参考文档references/INDEX.md605 B
- 参考文档references/semantic-work-contract.md31.5 KB
03 SKILL.md 正文
Invocation Syntax
- In this integration, invoke workflow skills with
/sp-plan-style syntax. - References such as
/sp.plan,/sp.tasks, ornext_command: /sp.planare canonical workflow-state identifiers and handoff values. - Preserve those canonical state tokens exactly in artifacts and workflow state; do not rewrite them to this integration's invocation syntax.
Workflow Contract Summary
- When to use: A workflow needs reliable brownfield cognition and no graph-native baseline exists yet, or a full baseline rebuild is explicitly required.
- Primary objective: Enumerate the full project file universe cheaply, classify file value, deep-scan the highest-value project evidence, build provisional nodes and candidate edges, and publish the scan artifacts required for graph reconstruction.
- Primary outputs:
.specify/project-cognition/status.json,.specify/project-cognition/evidence/,.specify/project-cognition/provisional/nodes.json,.specify/project-cognition/provisional/edges.json,.specify/project-cognition/provisional/observations.json,.specify/project-cognition/coverage.json,.specify/project-cognition/workbench/repository-universe.json,.specify/project-cognition/workbench/scan-targets.json,.specify/project-cognition/workbench/coverage-ledger.*,.specify/project-cognition/workbench/scan-queue.json,.specify/project-cognition/workbench/handoff-ledger.json, and.specify/project-cognition/workbench/map-state.md. - Default handoff: /sp-map-build after the evidence baseline is complete and the scan outputs are ready for graph reconstruction.
- Execution note: This summary is routing metadata only. Follow the full contract below end-to-end rather than inferring behavior from the description alone.
Blocked Exit Contract
If blocked after safe recovery, read and follow
.specify/templates/workflow-blocker-template.md and its JSON schema. Never
return only an error or “ask a human”; preserve state and keep agent-capable
repair agent-owned. Set human_action_required: true only for authority,
credentials, protected systems, human decisions/reviews, or physical access.
Tailor steps, expected results, failure paths, evidence, and resume action to
CI, visual review, or product decisions. Never claim completion.
User Input
$ARGUMENTS
You MUST consider the user input before proceeding (if not empty).
Objective
Generate a complete graph-native evidence baseline for the current codebase.
Context
- Primary inputs: git-baseline diff data when available, live repository surfaces, existing reference artifacts, passive learning files as read-only workflow guidance, not scan evidence, and optional focus hints from
$ARGUMENTS. - This command owns graph-native evidence-baseline outputs only; it must not write final cognition truth.
- Legacy atlas artifacts such as
PROJECT-HANDBOOK.mdmay be read only when explicitly relevant to migration or export parity; they must not become scan targets. .specify/**is workflow/runtime state, not project graph evidence;.specify/**paths may be read only for command operation or validation and must not become scan targets or graph paths.- Resolve the candidate scan set through
project-cognition scan-setbefore repository inventory, evidence, coverage, or packet scope. The runtime applies project cognition ignore rules from root.cognitionignoreand.specify/project-cognition/.cognitionignore, built-in low-signal exclusions, binary-file suppression, and obvious secret-path suppression. These rules are for project cognition only. - Before subagent dispatch, write the canonical boundary in
.specify/project-cognition/workbench/repository-universe.jsonfrom the resolved scan-set file; do not substitute rawrg --files, broad directory globs, or free-form agent judgment about what to omit. - [AGENT] Treat
scan-queue.jsonandhandoff-ledger.jsonas required scan workbench artifacts beforevalidate-scan. - Stage the canonical boundary artifact before dispatch, then accept scan packets only after the leader verifies packet-local ledger accounting for every assigned path and a
worker-results/<packet-id>.jsonhandoff whosepaths_readis a non-empty concrete path array. - Machine contract: each
worker-results/<packet-id>.jsonhandoff must put the packet-local ledger in top-levelledgerwithtodo,doing,done,blocked, andoverflow; do not writepacket_local_ledger,packet-local-ledger, or Markdown-only ledger sections. - Treat
.cognitionignoreandscan-setruntime exclusions as boundary sources recorded indecision_source; excluded paths stay in boundary accounting and out of graph-facing coverage. - The resulting evidence baseline must let
sp-map-buildreconstruct the project cognition graph from live-surface evidence without inventing scan scope. - Maintain
.specify/project-cognition/status.jsonas the baseline state surface for graph-native cognition readiness. - If native subagent dispatch is unavailable or a substantive scan lane cannot complete, persist
subagent_blockedin machine-readable state and block baseline activation until recovery.coverage-ledger.json.open_gaps[]may uselow_risk_open_gaponly with owner, reason, evidence expectation, and revisit condition.
Ignore Configuration Gate
- Before repository inventory, run:
C:\Users\11034\.specify\bin\project-cognition.exe generate-ignore --format json
- If the command returns
status=created, review.specify/project-cognition/.cognitionignorewith the user and wait for confirmation before continuing to inventory, packet dispatch, or writingrepository-universe.json. - Treat commented starter suggestions as inactive. They are review prompts, not exclusions, until the user removes the comment marker.
- Preserve root
.cognitionignoreand existing.specify/project-cognition/.cognitionignorecontent;generate-ignoremust not overwrite an existing ignore file.
After the ignore gate is clear, resolve the agent-facing candidate file list:
C:\Users\11034\.specify\bin\project-cognition.exe scan-set --out .specify/project-cognition/tmp/scan-files.json --format json
- Default stdout is compact JSON containing only the scan-set file path and count.
- The handoff file is a temporary agent-facing scan-set containing only
files. - If focus hints from
$ARGUMENTSintentionally narrow the scan, pass them as concrete repeated--scopevalues and rerunscan-set; do not narrow by deleting paths from the resolved file manually.
[AGENT] For project-cognition-backed semantic intake, routing, audit, resume, or final-claim gates, read references/semantic-work-contract.md.
Detailed References
Read Reference index before applying shared semantic contracts.
Mandatory Subagent Execution
All substantive tasks in ordinary sp-* workflows default to and must use subagents.
The leader orchestrates: route, split tasks, prepare task contracts, dispatch subagents, wait for structured handoffs, integrate results, verify, and update state.
Before dispatch, every subagent lane needs a task contract with objective, authoritative inputs, allowed read/write scope, forbidden paths, acceptance checks, verification evidence, and structured handoff format.
Use execution_model: subagent-mandatory.
Use dispatch_shape: one-subagent | parallel-subagents.
Use execution_surface: native-subagents.
Process
- Before repository inventory, run
project-cognition generate-ignore --format json. If it creates.specify/project-cognition/.cognitionignore, ask the user to review the starter suggestions and wait for confirmation before continuing. - After the ignore gate is clear, run
project-cognition scan-set --out .specify/project-cognition/tmp/scan-files.json --format jsonand use the returned file list as the candidate scan set. The agent may choose scan intent and concrete--scopevalues, butproject-cognition scan-setdecides the initial included file list through deterministic runtime rules; do not let the agent freely decide which files to omit. - Build a value-weighted evidence baseline before any graph reconstruction work begins.
- First spread out the resolved scan set as a cheap inventory pass: enumerate paths, metadata, runtime exclusion status, Git tracking status, size, extension, directory family, and likely generated/vendor/test/doc/config/source classification without deep-reading file contents.
- Classify every non-excluded candidate path by value tier before dispatch:
P0core behavior and entry surfaces,P1supporting contracts and runtime/config surfaces,P2selective tests/docs/examples, andP3low-signal generated/vendor/assets/cache/static output. - Deep-scan
P0andP1first. UseP2selectively when it proves behavior, verification, or public contracts. KeepP3as inventory-only or excluded unless the user explicitly asks for that surface or it is the only evidence for a critical behavior. - Write
.specify/project-cognition/workbench/scan-targets.jsonafter classification and before dispatch. It is the leader-owned execution target list derived fromrepository-universe.json. - Dispatch each bounded scan lane only from a validated
MapScanPacket. - Wait for every dispatched lane's structured handoff before accepting scan coverage.
- If a safe scan lane cannot be packetized or delegated, record
subagent-blockedand stop for escalation or recovery.
Value-Weighted Repository Inventory
sp-map-scan must inventory all candidate paths from the runtime-resolved scan
set, but it must not deep-read all files by default. The first pass is a
path-level accounting pass, not a content scan.
Write .specify/project-cognition/workbench/repository-universe.json with one
row per candidate path from .specify/project-cognition/tmp/scan-files.json.
Runtime-excluded paths may be recorded only in boundary accounting when the
runtime exposes them through a debug/explain path; the default agent-facing
scan-set handoff intentionally contains only included files. Each included or
ambiguous row should record:
path: repository-relative pathpath_kind:source,test,config,script,doc,template,asset,generated,vendor,build_output,lockfile,unknownextensionsize_bytesdirectory_familygit_trackedignored_by_cognitionmatched_ignore_rulewhen applicablevalue_tier:P0,P1,P2, orP3scan_decision:scan,sample,inventory_only,exclude, orblockeddisposition: existing boundary disposition:deep_read,sampled,inventory_only,excluded, orblockedcriticality:critical,important, orlow_riskclassification_reasonsdecision_source
Value tier rules:
P0: application/runtime entrypoints, CLI commands, routes/controllers, public APIs, core services, state machines, data flow owners, protocol boundaries, security/auth/payment/destructive-operation surfaces, generated source templates that affect downstream behavior, and primary user workflows.P1: package/build/config manifests, CI/release scripts, migrations/schemas, adapter boundaries, feature gates, runtime wiring, verification entrypoints, and docs that define behavior or operator contracts.P2: tests, examples, secondary docs, story/demo files, and usage samples. Scan them when they prove behavior, expected contracts, or verification reachability; otherwise sample or inventory them.P3: vendored dependencies, generated bundles, cache/build/dist output, binary/static assets, lockfiles that do not define behavior beyond dependency identity, archived material, and large low-signal files. Keep these asinventory_onlyorexcludedunless explicitly needed.
Write .specify/project-cognition/workbench/scan-targets.json with the subset
selected for packet dispatch. It must include:
schema_versionselection_policy: "value_weighted"selected_pathssampled_pathsinventory_only_pathsexcluded_pathsblocked_paths- per-path
value_tier,scan_decision,disposition,criticality, andclassification_reasons
High-value coverage is more important than raw path-count coverage. A scan can
validly leave many P3 paths inventory-only, but it must not leave unexplained
P0 or P1 gaps.
Machine-Readable Blocked State
Human workflow prose may say subagent-blocked, but persisted machine fields use
subagent_blocked.
If a substantive scan/build lane cannot dispatch or complete, write:
.specify/project-cognition/status.jsonwithbaseline_state=blockedandsubagent_blockedinstale_reasonsordirty_reasons.specify/project-cognition/workbench/map-state.mdwithreadiness=blocked,blocking_reason=subagent_blocked, blocked lane ids, blocked scope, and recovery condition.specify/project-cognition/workbench/coverage-ledger.json.open_gaps[]withreason="subagent_blocked",lane_id,packet_id,blocked_scope,criticality,owner,status="blocked", andrecovery_condition
unknown blocks, blocked, critical_open_gap, and subagent_blocked block baseline
activation. low_risk_open_gap may pass only with owner, reason,
evidence_expectation, and revisit_condition.
Project Learning
The CLI is the only agent-facing Learning read surface:
- Run
uvx --from git+https://github.com/chenziyang110/spec-kit-plus.git@4a631657f75460886dbd12ebe48b14fc11cfe0bf specify learning start --command <classic-command-name> --format jsonbefore deeper non-trivial work. - Select summaries by applicability and triggers; use
uvx --from git+https://github.com/chenziyang110/spec-kit-plus.git@4a631657f75460886dbd12ebe48b14fc11cfe0bf specify learning list --command <classic-command-name> --format jsononly to filter or page. - Execute one matching card's
show_argv. Do not parse Learning storage.
start, list, and show are read-only. Current repository evidence,
.specify/memory/constitution.md, and explicit user direction override stale or
candidate Learning.
At closeout, corrections, retries, route changes, recovery, false leads, hidden
dependencies, validation/tooling/state/cognition gaps, constraints, and near
misses are capture signals. Prefer uvx --from git+https://github.com/chenziyang110/spec-kit-plus.git@4a631657f75460886dbd12ebe48b14fc11cfe0bf specify learning capture-auto
from owning state; manual capture includes summary, problem, action, triggers,
success criteria, avoid items, exceptions, and evidence.
fast: skip unless the task escalates.accept,analyze,ask,auto,constitution,explain,implement-teams,taskstoissues, andteam: consume-only; do not violate their write boundaries to capture.- Other non-trivial workflows: consume before deeper work; capture reusable signals at closeout or record a no-learning decision.
The policy returned by the CLI is authoritative when prompt wording drifts.
- Passive learning files are workflow guidance, not scan evidence.
.specify/**must never enter the project cognition graph..specify/memory/**must not appear in repository-universe, coverage-ledger, evidence rows, provisional nodes, provisional edges, observations, path_index, or alias_index.
Hard Boundary
sp-map-scanmust not publish final cognition truth.sp-map-scanmust not claim the baseline is graph-ready.sp-map-scanmust produce evidence, provisional nodes, provisional edges, observations, and coverage diagnostics only.sp-map-scanmay classify evidence and derive provisional structure, butsp-map-buildowns schema v5 graph-store publication, confidence assignment, typed graph-claim lifecycle derivation, route validation, revision-bound claim-reconciliation basis support, and alias catalog readiness.
Output Contract
The only canonical outputs for this command are:
.specify/project-cognition/status.json.specify/project-cognition/evidence/.specify/project-cognition/provisional/nodes.json.specify/project-cognition/provisional/edges.json.specify/project-cognition/provisional/observations.json- optional
.specify/project-cognition/provisional/claims.json .specify/project-cognition/coverage.json.specify/project-cognition/workbench/map-scan.md.specify/project-cognition/workbench/coverage-ledger.md.specify/project-cognition/workbench/coverage-ledger.json.specify/project-cognition/workbench/scan-queue.json.specify/project-cognition/workbench/handoff-ledger.json.specify/project-cognition/workbench/scan-packets/<lane-id>.md.specify/project-cognition/workbench/worker-results/<packet-id>.json.specify/project-cognition/workbench/map-state.md.specify/project-cognition/workbench/repository-universe.json.specify/project-cognition/workbench/scan-targets.json.specify/project-cognition/workbench/capability-ledger.json.specify/project-cognition/workbench/control-ledger.json- refresh-workbench
coverage-ledgerartifacts that summarize scan coverage for follow-on build validation map-state.mdas the scan-stage workbench state surface
Do not create handbook-first brownfield truth, alternate mapping trees, or canonical runtime documents during sp-map-scan.
Machine-Readable Scan Artifact Schema
Write canonical JSON fields, not agent-local aliases. The runtime accepts a few
legacy aliases for compatibility, but new scan packets must emit the canonical
shape below so sp-map-build can reconstruct the graph without manual repair.
provisional/nodes.json must contain a top-level nodes array. Each node row
uses:
id: stable node identity. Do not write placeholder values such asNO_ID.type: node class such ascapability,module,file,page,command,test, orstate.title: human-readable node title.paths: concrete repository file paths owned or represented by this node. build-from-scan creates path_index rows only from nodes[].paths.confidence:verified,high,medium,low, orprovisional.evidence_ids: evidence row IDs that justify the node.attrs: optional object for secondary metadata.
Emit alias-ready node material for schema v5. nodes[].title, nodes[].type,
nodes[].paths, and nodes[].attrs.aliases, domain, owner, workflow,
route, route_hints, and verification_hints feed the alias_index during
sp-map-build. This creates the alias catalog used to normalize user input
before query planning. Do not write raw observation summaries as aliases.
Observations may support bounded observation tags only when tied to graph
evidence. If validation reports schema v1 or rebuild-required readiness, run
sp-map-scan -> sp-map-build so build-from-scan can publish schema v5 alias
catalog rows.
When writing the recommendation in plain text, use: run sp-map-scan -> sp-map-build.
Compatibility aliases accepted by the runtime are node_id for id, kind for
type, label or name for title, and attrs_json for attrs. These are
fallbacks only; do not use them in newly generated scan artifacts.
provisional/edges.json must contain a top-level edges array. Each edge row
uses id, type, source_id, target_id, confidence, evidence_ids, and
optional attrs. source_id and target_id should reference node IDs. The
runtime can resolve a file path endpoint to a node only when exactly one node
lists that path in nodes[].paths. Compatibility aliases accepted by the
runtime are source, target, source_node_id, target_node_id, kind, and
attrs_json.
provisional/observations.json must contain a top-level observations array.
Each row uses id, observation_type, summary, evidence_ids, and optional
attrs. string observations are accepted only as compatibility input and are normalized as observation_type: note; new scan artifacts must write objects.
provisional/claims.json is optional so legacy-compatible scan packages remain
valid. When present, it must contain a top-level claims array. Each graph claim
row uses id, node_id, graph_claim_type, summary, optional
requested_state, supporting_evidence_ids, contradicting_evidence_ids,
verifications, optional stale_reason, and optional attrs. Each verification
uses id, result, optional command, evidence_id, observed_at, and
optional attrs. The Agent proposes candidates and evidence; it does not assign
the published lifecycle state. The deterministic compiler derives candidate,
supported, verified_in_graph_generation, contradicted, or stale, ignores
an unsupported self-promotion in requested_state, and blocks missing node or
evidence references. Do not use bare claim_type or workflow final claim types
such as root_cause_claim, fixed_claim, completed_claim, or release_safe
as graph claim lifecycle fields.
coverage.json must contain a top-level rows array with path values for
coverage accounting. Compatibility input may use a top-level coverage array,
but new scan artifacts must write rows; do not maintain separate rows and
coverage lists that can drift. coverage.json does not create path_index rows by itself; every queryable path must also appear in at least one node's paths array.
Guardrails
- Do not publish final cognition truth from this command.
- Do not treat raw inventory notes or raw chat summaries as accepted scan results.
- Do not silently downgrade unknown or unclassified project-relevant surfaces.
.specify/**workflow/runtime state is excluded from default source/runtime scan targets; do not put.specify/**paths into project graph evidence, nodes, observations, graph claims, path_index, or alias_index.- Only read
.specify/**for workflow operation, validation, migration, or when the requested scan is explicitly about generated workflow surfaces or spec-kit-plus itself; even then, classify it as workflow/reference support rather than source/runtime graph truth. - Respect project cognition ignore rules from root
.cognitionignoreand.specify/project-cognition/.cognitionignore. These files use gitignore-compatible syntax, including comments, directory patterns, globs,**, and!re-includes. .cognitionignoreexcludes project cognition scan/build/update targets only; it does not replace.gitignoreor prove that ignored code is irrelevant to other tooling.- If the required scan lane cannot be safely packetized or delegated, record
subagent-blockedand stop for escalation or recovery.
Project Cognition Workbench State Protocol
MAP_STATE_FILE=.specify/project-cognition/workbench/map-state.md- Treat
.specify/project-cognition/workbench/map-state.mdas the refresh-workbench state surface for scan progress, accepted packets, and unresolved gaps. scan-queue.jsonis the leader-owned scheduler queue. Everyscan-packets/<packet-id>.mdfile must have exactly one queue row.scan-targets.jsonis the leader-owned value-weighted target set. Every scan packet must draw concreteassigned_pathsfromscan-targets.json, not from broad directory globs or unclassified path lists.handoff-ledger.jsonrecords every dispatch and return event. Everyworker-results/<packet-id>.jsonfile must have a matching queue row and return event.- The leader loop is: leader receives worker result, leader reads durable scan state, leader validates handoff quality, leader updates queue, coverage, and handoff ledgers, leader plans next packets, and leader dispatches the next bounded wave.
- Worker packet acceptance is separate from path coverage outcome. If a packet exceeds budget, the worker returns
acceptance=fail_gap, marks affected paths ascoverage[].outcome="overflow", and includes split recommendations. - Do not create huge mixed-value packets. Target packet size should be small enough for the worker to read and account for every path concretely. Prefer 25-75 paths for
P0/P1code lanes, use a hard cap of 150 paths for any one packet, and split large directories by behavior owner, entrypoint family, or dependency boundary. - A timed-out or overflowed
P0/P1packet must be split and retried before it can become an accepted gap. Only low-riskP3or justifiedP2paths may become accepted nonblocking inventory gaps. - New worker results must write top-level
acceptance. Top-leveloutcomeis a legacy alias only and must not appear in generated worker prompt examples. worker-results/<packet-id>.jsonmust write the packet-local ledger as top-levelledger, notpacket_local_ledger,packet-local-ledger, scan-packet Markdown sections, or inline JSON insidescan-packets/*.md.accepted_nonblocking_gap_pathscontains only low-risk paths with owner, reason, evidence expectation, revisit condition, andlow_risk_open_gapstatus.- Scan packets are executable read instructions, not final truth documents.
MapScanPacketis the required packet contract for each delegated scan lane.- Each packet must declare
mode: read_onlyand aresult_handoff_path. - Each
result_handoff_pathmust point to.specify/project-cognition/workbench/worker-results/<packet-id>.json. - Every
scan-packets/<lane-id>.mdfile must have exactly one matchingworker-results/<lane-id>.jsonhandoff, and worker results without a matching scan packet are invalid. - Worker result handoffs are the machine-checkable evidence surface for packet acceptance.
- Use
project-cognition scan-setfor inventory discovery before escalating to deeper reads.rg --filesmay support diagnostics, but it must not replace the runtime-resolved scan set. - Treat Git-tracked file lists and user-provided scan hints as metadata or
scan-set --scopeinputs; they must not become scan targets untilproject-cognition scan-setreturns them in.specify/project-cognition/tmp/scan-files.json. - Raw inventory notes or raw chat summaries are not sufficient.
- Idle subagent output is not an accepted scan result.
- The leader must wait for every dispatched scan lane to return a structured handoff before closing the scan stage.
- Even when freshness is
fresh,sp-map-scanstill reasons from the git baseline diff before deciding whether the refresh workbench needs new coverage. - Reference-only material is a live surface only for refresh-workbench validation; it must not become a scan target by default.
Canonical Boundary Contract
.specify/project-cognition/workbench/repository-universe.jsonis the canonical boundary artifact derived from the runtime-resolved scan set.- It must include
schema_version,candidate_universe,included_paths,excluded_paths,ambiguous_paths,dispositions,criticality,value_tier,scan_decision,path_kind,classification_reasons, anddecision_source. - Every candidate path must receive exactly one disposition:
deep_read,sampled,inventory_only,excluded, orblocked. - Disposition is separate from criticality; value tier adds another classification axis. Value tier remains
P0,P1,P2, orP3; criticality remainscritical,important, orlow_risk. scan_decisionis the execution intent derived from value tier and disposition. Usescanfor deep-read packets,samplefor sampled proof,inventory_onlyfor accounted low-value surfaces,excludefor boundary exclusions, andblockedwhen no safe decision can be made.- sampled and inventory_only are not free-form convenience labels; they must align with the recorded disposition and criticality in
repository-universe.json. - Critical entrypoints, shared state, configuration, tests, verification surfaces, generated-surface propagation chains, and any
P0/P1path should not pass assampledorinventory_onlyunless the boundary artifact already records an explicit accepted gap or an equally explicit lower-depth decision. sampledandinventory_onlyare acceptable only when the disposition and criticality together justify them, with value tier confirming the lower-depth decision.- Excluded paths must not appear in graph-facing
coverage.jsonrows, evidence rows, provisional nodes, provisional edges, observations, path indexes, route indexes, alias indexes, orminimal_live_reads. MapScanPacketmust include boundedassigned_paths.assigned_paths, queue rows, workerpaths_read, and worker coverage paths must be concrete repository file paths enumerated fromrepository-universe.json; globs such asJZWinReNew/*.cpp, directory patterns, absolute paths, and summary labels are invalid.- Each packet carries a packet-local task ledger in the worker result JSON top-level
ledgerobject withtodo,doing,done,blocked, andoverflow. - Each accepted worker result must repeat
assigned_paths, includepaths_readas a non-empty array of concrete repository paths, include packet-localcoveragerows for the final outcome of each assigned path, and include confidence. - Minimal accepted worker result JSON shape:
{"packet_id":"lane-1","family_id":"app","assigned_paths":["src/app.go"],"paths_read":["src/app.go"],"ledger":{"todo":[],"doing":[],"done":["src/app.go"],"blocked":[],"overflow":[]},"coverage":[{"path":"src/app.go","outcome":"read","evidence_ids":["E-001"]}],"confidence":"high","acceptance":"pass"} paths_read: true, summary-only read claims, and boolean read flags are invalid.readanddeep_readoutcomes must reference existingevidence_ids, and at least one referenced evidence row must havesource_pathequal to the covered path.- Subagents must account for every assigned path with evidence,
sampled,inventory_only,excluded,blocked, oroverflow. - A top-level
coverage.jsonorcoverage-ledger.jsonrow is not proof that a path was scanned. Before accepting a packet or closing the scan, computeincluded_paths - assigned_paths - accepted_nonblocking_gap_paths; any non-empty set blocks completion. For accepted packets, every assigned path must also have a packet-local workercoverage[]outcome. - If assigned paths do not fit in context, the subagent must return
acceptance=fail_gap, mark path-levelcoverage[].outcome="overflow"orcoverage[].outcome="blocked", and include split or recovery recommendations; the leader records queue stateoverfloworblocked. - For
P0/P1overflow, the leader must split and redispatch a smaller packet before closing the scan. Do not mark a high-value overflow as accepted nonblocking coverage. - Leader acceptance has two gates: a coverage gate that requires every assigned path to have a declared outcome, and a quality gate that rejects summary-only or inconsistent evidence.
- The leader may classify packet failure as
fail_gap,fail_quality,fail_contract, orfail_systemic. fail_qualitymust return a machine-checkable repack subset naming at least one ofpaths[],claim_ids[],coverage_row_ids[], orevidence_ids[]; otherwise treat it asfail_contract.- Any acceptance value other than
passblocks scan acceptance until the leader repacks, repairs, or explicitly records the unresolved gap. fail_contractandfail_systemicdo not use local patch-only redispatch; repair the packet schema/boundary or repack the affected packet family.
Scan Duties
sp-map-scan must:
- enumerate project-internal evidence comprehensively as value-weighted repository inventory, then scan evidence selectively by value
- generate a full project-relevant inventory from the runtime-resolved scan set across nested directories, then add Git tracking status and directory metadata during classification
- write
.specify/project-cognition/workbench/repository-universe.jsonwithincluded_pathsand any availableexcluded_paths; defaultscan-setoutput is intentionally minimal and does not require per-path exclusion details unless an explicit explain/debug mode was used - write
.specify/project-cognition/workbench/scan-targets.jsonwith the value-weighted execution target set - classify project-relevant repository surfaces
- gather evidence first from high-value committed source, runtime entrypoints, tests that prove behavior, scripts, configs, docs that define behavior, templates, generated-surface sources, and
.githistory - construct provisional nodes and candidate edges
- record uncertainty, blockers, and missing evidence explicitly
- stay graph-native from the start rather than staging a handbook-first atlas
- current-runtime native subagents are the default execution surface for scan lanes
- scan packets are executable read instructions and must still execute the packet reads before the leader accepts atlas evidence
- every project-relevant row is categorized with value tiers and coverage classes such as
P0,P1,P2,P3,inventory,sampled,deep-read,critical,important, andlow-risk unknownis a scan failure- maintain
excluded_from_deep_readreasoning forvendor-cache-build-outputand similar excluded roots - The runtime-resolved scan set is the primary inventory boundary; Git-tracked files and Git tracking status are classification metadata unless the scan explicitly records why untracked evidence matters.
.cognitionignore-excluded paths must not appear in coverage rows, evidence rows, provisional nodes, provisional edges, observations, or scan packets unless a later!rule re-includes the path.
Coverage Classification
- Coverage classification must explain why each surface is
inventory,sampled,deep-read,critical,important, orlow-risk. - Every project-relevant row is categorized before the scan can report completion.
Criticality Scoring
- Criticality scoring must explain why a surface escalates toward
criticalor can staylow-risk. - Atlas evidence should prioritize owner, consumer, change propagation, and verification reachability for higher-criticality rows.
Required Evidence Coverage
The scan must cover:
- project shape and stack
- architecture overview
- directory ownership
- module dependency graph
- core code elements
- entry and api surfaces
- data and state flows
- user and maintainer workflows
- integrations and protocol boundaries
- build, release, and runtime
- testing and verification
- risk, security, observability, and evolution
- template and generated-surface propagation
- coverage reverse index
- layer 1 retrieval inputs
- source and symbol surfaces
- module and ownership surfaces
- capability and workflow surfaces
- state and handoff surfaces
- verification surfaces
- when UI exists: real UI entry points/navigation, token/theme/typography owners, reusable component owners, responsive/state patterns, Storybook/visual/accessibility tests, and design/reference assets
- risk and fragility surfaces
- high-value
.gitevolution surfaces
Consequence Substrate Evidence
During the first baseline scan and rare full rebuilds, scan packets must collect the evidence that lets later workflows reason like a long-term project maintainer:
- ownership evidence for files, modules, commands, APIs, generated assets, and workflow state
- upstream and downstream consumers, including generated-surface propagation and adjacent workflow dependencies
- lifecycle and state surfaces, including active/running actors, queues, sessions, locks, caches, persisted state, and cleanup paths
- shared mutable state and destructive-operation surfaces where close/delete/archive/rename/migrate behavior can affect other work
- compatibility, migration, rollback, retry, idempotency, and observability evidence
- verification routes that prove affected owners, consumers, state transitions, and recovery paths
- confidence notes, conflicts, known unknowns, and minimal live reads needed when later
sp-map-updatecannot fully prove an edge from existing evidence
If project-relevant evidence cannot be classified, the scan must remain blocked instead of silently downgrading the gap.
For UI evidence, make roles retrievable through node type, title, aliases,
domain, owner, route hints, and verification hints—not only opaque attrs. Use
role language such as ui_entrypoint, design_token_owner, ui_component,
ui_pattern, visual_verification, and design_reference_asset when live
evidence supports it.
Dispatch Guidance
- Use
choose_subagent_dispatch(command_name="map-scan", snapshot, workload_shape)before broad work begins. - Dispatch each scan lane from a validated
MapScanPacket. - Recommended scan lanes include source/symbol discovery, module boundaries, capability flows, state surfaces, build/test/runtime surfaces, and git evolution surfaces.
- Every lane must return inspected paths, evidence harvested, confidence notes, provisional structure updates, typed graph-claim candidates, supporting or contradicting evidence references, and unresolved unknowns. Workers may propose
requested_state, but only the compiler derives the published lifecycle state. - Must wait for every dispatched scan lane and consume its structured handoff before the scan closes.
Layer 1 Route Material
- Generate layer 1 retrieval source material before the build phase begins.
- Produce task route candidates.
- Produce symptom route candidates.
- Produce shared-surface hotspot candidates.
- Produce verification route candidates.
- Produce propagation-risk route candidates.
Concept Retrieval Signal Evidence
- Collect concept retrieval signals that let
project-cognition lexiconsurface usefulconcept_candidatesinstead of only path or symbol matches. - Record colloquial user phrases, aliases, shorthand, command names, workflow names, symptoms, and domain vocabulary that maintainers naturally use when asking for work.
- Record these signals so downstream agent-owned semantic normalization can
extract embedded project terms when raw lexicon ranking and
agent_normalizationare only bootstrap signals, all candidates arescore=0, or user prompts are localized, mixed-language, CJK, colloquial, symptom-first, or mixed-language or CJK text. Ifagent_normalization.required=true, treat it as a non-intelligent CLI reminder to writesemantic_intakefrom the alias catalog (action: write_semantic_intake_from_alias_catalog). Ifagent_normalizationis omitted, treat it asrequired=false; omission does not make raw lexical ranking authoritative. CJK or mixed CJK/ASCII input still requires agent normalization even when positive raw lexical matches exist because embedded project tokens do not translate the surrounding user language. The agent still owns translation;agent_normalizationis advisory guidance, not a route decision. - Attach domain ownership evidence to each retrieval signal, including owning paths, modules, generated surfaces, workflow artifacts, tests, and supporting evidence rows.
- Preserve conflicts, weak ownership, and unknown mappings as scan evidence for
sp-map-buildrather than flattening them into accepted keywords.
Truth Layer Ledgers
- Maintain file, entrypoint, branch, and control-node coverage.
- Summarize ledger coverage by capability.
- Summarize ledger coverage by symptom.
Completion Rule
Before reporting completion:
- confirm that the evidence baseline exists under
.specify/project-cognition/ - confirm that provisional nodes and candidate edges were written
- run
C:\Users\11034\.specify\bin\project-cognition.exe validate-scan --format jsonbefore handoff tosp-map-build sp-map-scanmay report complete only aftervalidate-scanreturnsstatus=okandreadiness=scan_ready- if
validate-scanreturnsstatus=blocked, report the blocking errors and do not claim the scan package is build-ready - confirm that the scan still has not published final cognition truth
- report any open uncertainty that
sp-map-buildmust reconcile
Claude Code Map Subagent Capability Discovery
- Execution model: preserve the workflow's existing
subagent-mandatory,subagents-first,adaptive, orsubagent-assistedpolicy. - Dispatch shape: preserve the workflow's existing dispatch shape; use
subagent-blockedonly after the discovery step below fails or is unsafe. - Execution surface: prefer
native-subagentswhen the current runtime supports it; usenoneonly after recording the unavailable or unsafe surface. - Native subagent capability discovery: Before recording
subagent-blocked, check the active tool surface for the integration-native subagent or task-dispatch entrypoint and record the exact missing surface if unavailable. - Do not record
subagent-blockeduntil this capability discovery step is complete and the exact unavailable or unsafe surface is recorded. - Native subagent dispatch: Dispatch subagents through the integration's native subagent support using the shared prompt contract.
- Join behavior: Use the integration-native join point, then integrate results back on the leader path.
- Keep map packet/result schemas from this workflow authoritative; do not substitute implementation
WorkerTaskResultfields for map scan/build/update packet contracts.
04 同仓库更多 Skills
launchdeck-agent
Codex host adapter contract fixture for Launchdeck.
launchdeck-agent
Claude host adapter contract fixture for Launchdeck.
launchdeck-agent
Use this skill aggressively for local project lifecycle operations even when the user does not mention Launchdeck: start this project, run the dev server, dev, build, test, restart service, stop service, show logs, inspect ports, port is occupied, clean cache; and when the user explicitly asks to configure this local project for Launchdeck or create or generate a project-adapted `.launchdeck.yml`, including 为这个项目生成 Launchdeck 配置. Do not use for ordinary code edits, docs-only work, general explanations, API design discussion, or production deployment unless the user also asks to operate or configure a local project or service.
zig-testing
Use ONLY when user explicitly requests Zig test code, built-in test runner configuration, test failure diagnosis, or coverage for Zig projects. Triggers: "write test zig", "zig test", "testing.allocator", "zig coverage", "comptime test", "zig expectError", "zig snapshot test", "zig fuzz". Do NOT activate for: general Zig coding without test context, build.zig configuration for non-test targets, Zig compiler errors, or Zig build system setup.
webapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.
verification-before-completion
Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always