spec-kit-project-cognition-gate
Use when changing, reviewing, planning against, or debugging an existing Spec Kit Plus codebase. Consult the agent-planned project cognition query bundle as advisory navigation, then prove technical claims from live evidence.
- License 许可
- MIT
- 最近更新
- 2026-08-07
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- spec-kit-project-cognition-gate
- metadata
- { "author": "github-spec-kit", "source": "templates/passive-skills/spec-kit-project-cognition-gate/SKILL.md" }
- description
- Use when changing, reviewing, planning against, or debugging an existing Spec Kit Plus codebase. Consult the agent-planned project cognition query bundle as advisory navigation, then prove technical claims from live evidence.
- compatibility
- Requires spec-kit project structure with .specify/ directory
03 SKILL.md 正文
Spec Kit Project Cognition Gate
This passive skill is the brownfield advisory navigation layer, not a hard workflow gate.
Complementary Passive Skills
spec-kit-workflow-routingowns route selection into the correctsp-*workflow before implementation, planning, or debugging proceeds.spec-kit-project-learningowns the shared memory capture layer after context is loaded. Once this gate is satisfied, follow that skill's learning-start and learning-capture expectations for the active workflow.
Advisory Navigation
Before code edits, investigation, planning against existing code, or architectural judgment in an established Spec Kit Plus repository:
- Default project cognition intake is
C:\Users\11034\.specify\bin\project-cognition.exe compass --intent <intent> --query="$ARGUMENTS" --format json. Consume the packet in this order:- Read top-level
epistemic_contractfirst. Requiregraph_role=route_candidate_only,fact_source_of_truth=live_repository,live_verification_required=true,graph_only_claims_allowed=false, andunverified_claim_action=withhold. - Read top-level
minimal_live_readsand use those files as the bounded first live evidence route. - Then use lane-level
first_pass_pathsfor reasons, evidence hints, verification hints, follow-up surfaces, andbefore_fix_claimchecks. - Read lane-level
claim_refsonly as compact route candidates.route_confidenceis scoped byconfidence_scope=route_candidate; inspectstate,freshness, andstale, and require live verification before using a claim as repository truth. - Treat
coverage_diagnosticsas confidence and closeout signals, never as route candidates. - Treat
expansion_refas a normal continuation path. RunC:\Users\11034\.specify\bin\project-cognition.exe expand --id <id> --section claim_evidence --format jsonwhen an active claim needs boundedsource_path/spanevidence; advancedC:\Users\11034\.specify\bin\project-cognition.exe querymay also return top-levelclaim_signalswith bounded evidence refs. - Do not infer final edit scope from
minimal_live_reads,first_pass_paths,claim_refs,claim_signals, orclaim_evidence. Compass applies graph claims only as a bounded rerank after repository-backed route eligibility is established.match_scoreremains the eligibility score; laneclaim_ranking.adjustmentmay only move an already-matched candidate by+1for freshsupported/verified_in_graph_generation,-1for stale, or-2for contradicted. Claims cannot create candidates and cannot replace live verification. Whencoverage_diagnosticscontainsstale_claim_signalorcontradicted_claim_signal, treat the packet asusable_with_review, followreconcile_claims_with_minimal_live_reads, and complete the lane-specific refresh or reconciliation action against the live repository. For decisive claim-specific evidence, provide only reconciliation intent: workflow, stableclaim_id, reason, repository-relativesource_path, bounded linespan,supportingorcontradictingrole, and optional claim-specific verification. RunC:\Users\11034\.specify\bin\project-cognition.exe claim-reconcile prepare --input <intent.json> --format json; the runtime owns every integrity field and the prepared packet path. Execute the returnedapply_argvexactly (C:\Users\11034\.specify\bin\project-cognition.exe claim-reconcile apply --input <prepared_packet_path> --format json). Generic workflow verification is insufficient. On ready, rerun Compass once; on partial or blocked, withhold the claim. Theepistemic_contractcannot authorize source changes and cannot prove current behavior. Carryepistemic_contractforward, withhold unverified claims, and let contradictory live evidence override the route candidate. Graph claims are indexed assertions. Evenverified_in_graph_generationis only an active graph-generation state, not current repository truth; graph claims cannot authorize source changes and cannot set workflowclaim_ready=true. Treatcandidateandsupportedas navigation hypotheses, andcontradictedorstaleas negative-route or historical context until bounded live evidence is checked. Readiness values arequery_ready,review,needs_rebuild,blocked, andunsupported_runtime. Compass-specific advice is incompass_stateandrecommended_next_action. Treatrecommended_next_actionas an object. Do not treatrecommended_next_actionas a string. Readrecommended_next_action.action_idfor every packet:needs_rebuildalone is not a rebuild route and can accompany a resumable action such ascomplete_scan_packets. Only foraction_id=project_cognition.rebuild, inspect every entry inrebuild_reasons[], preserve its stablecode, human-readablemessage, and relevantevidence, then follow the canonical Classic sequence inrecommended_next_action.workflow_routes.classic.steps. Project those canonical step names through this integration's invocation syntax instead of guessing from readiness or an internal action ID. Non-rebuild actions omit workflow routes and must be preserved byaction_idalone. If a non-workflow action includesrecommended_next_action.argv, execute that exact argv through the project-pinned cognition launcher.project_cognition.repair_statusowns the deterministicrepair-statusaction; never patch graph-store metadata by hand. Whencompass_state=needs_semantic_intake, the agent writessemantic_intakefrom project vocabulary and reruns compass with--semantic-intake-file, or uses the advancedlexicon -> semantic_intake -> querypath when explicit concept decisions are needed. Advanced routing remains available asC:\Users\11034\.specify\bin\project-cognition.exe lexicon --mode catalog, agent-authoredsemantic_intakeandconcept_decisions, thenC:\Users\11034\.specify\bin\project-cognition.exe query --query-plan. Use it when the first compass packet is too draft-like, a workflow needs explicit concept decisions, or coverage cannot be resolved from the default packet. The current query contract isclaim_retrieval_contract_version=2andcandidate_universe_version=2; carry the latter from lexicon into every explicit query plan. Never parse missing or non-current versions as legacy input; rerun lexicon or compass with the current binary and repair the install if needed. The advanced path still requiresnormalized_query,intent_facets,negative_constraints,alias_interpretations,selected_concepts,rejected_concepts,concept_decisions,covered_facets,missing_facets,match_sources,lexicon_generation_id,expanded_queries,repository_search_terms, and facet coverage; do not trust top similarity alone. If the query command reports query-plan diagnostics, preserve itswarnings,repair_hints, normalizedquery_plan, structurederrors, andexpected_shapeso the workflow can repair the plan instead of ending on a raw parser exception. Agent-owned semantic normalization is mandatory for the advanced path. The raw lexicon ranking andagent_normalizationare only bootstrap signals for retrieving the alias catalog and candidate universe; they are not route decisions. Raw lexicon ranking is only a bootstrap. Treatagent_normalization.required=trueas a non-intelligent CLI reminder to writesemantic_intakefrom the alias catalog (action: write_semantic_intake_from_alias_catalog). Ifagent_normalizationis omitted,omitted => required=false: treat it asrequired=false; omission does not make raw lexical ranking authoritative. If rawconcept_candidatesare allscore=0, or the prompt is localized, mixed-language, CJK, colloquial, symptom-first, or mixed-language or CJK text, do not stop at the raw score. 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. Extract embedded project terms such as command names, UI labels, file stems, state names, adapter names, and skill or package identifiers from the user's wording and the alias catalog. The agent still owns translation;agent_normalizationis advisory guidance, not a route decision. Put those translated terms intonormalized_query,alias_interpretations,intent_facets,expanded_queries, andrepository_search_terms, then select or reject concepts by facet coverage. Before source search, write project-language search terms derived from the alias catalog,semantic_intake, selected candidates, and route metadata. Write them asrepository_search_terms; include component names, state names, file names, command names, UI labels, and route names when present. Do not search only the raw user words. Use these project-language search terms before broad repository search.
- Read top-level
- Treat
concept_candidatesas structured project concept candidates, not a flat keyword list. Resolve broad, conflicting, or unknown candidates through the returned readiness state; do not widen live repository reads beyond the returnedroute_packandminimal_live_reads. - For
sp-ask, useC:\Users\11034\.specify\bin\project-cognition.exe compass --intent ask --query="$ARGUMENTS" --format jsonas the default advisory navigation command. UseC:\Users\11034\.specify\bin\project-cognition.exe query --intent askonly after the agent builds a semantic intake or query plan because the compass output or live evidence is ambiguous or has incomplete coverage. Stale or localization-sensitive cases are examples that still require that ambiguity or incomplete-coverage reason. Live evidence is authoritative. The ask route is read-only: do not run tests, run builds, execute project CLI commands, write files, create handoffs, or create ask state. - For same-topic
sp-askfollow-ups in the same chat, reuse the previous target project root, evidence set, compass or query packet, semantic intake, and proven facts when they still cover the new question; read only delta evidence and rerun compass when the topic, target, boundary, or evidence family changes. - For localized, mixed-language, CJK, colloquial, or project-slang ask queries, normalize terms through the alias catalog and write project-language search terms before source search. For cross-boundary questions, include the protocol view: client fields or callsites, interface URLs or payload/schema names, and whether backend/server/runtime code exists in the repository.
- Treat the task-local project cognition compass packet as the task-local
project navigation bundle. Treat raw graph JSON artifacts as obsolete runtime surfaces;
use
.specify/project-cognition/project-cognition.db, the compass packet, and bounded live evidence instead. - Candidate selection must satisfy facet coverage for the active workflow. Each
concept_decisionsitem should includecovered_facets,missing_facets,match_sources, confidence, and risk. Do not trust top similarity alone: lexical overlap, vector similarity, alias matches, path matches, and graph neighbor expansion are signals, not route truth. - For
sp-discussion, product framing may begin before the cognition gate. Before technical options, affected-surface claims, testing strategy claims tied to existing code, implementation-path recommendations, or source-grounded recommendations, complete the workflow's Truth Pass with the active launcher-backed project cognition query planning flow and bounded live evidence. UseC:\Users\11034\.specify\bin\project-cognition.exe compass --intent discussion --query="$ARGUMENTS" --format jsonand preserveC:\Users\11034\.specify\bin\project-cognition.exe query --intent discussionas the advanced precision path for discussion grounding. Recordverified_project_facts,open_assumptions,evidence_checked, andadvice_confidence. Do not use--intent planfromsp-discussion. - Project cognition is project-scoped. Current project cognition proves only current project facts.
- In
sp-discussion, if the implementation target is another repository or external project, locktarget_project_rootbefore source-grounded technical claims. - Reference project cognition is supplemental-only and cannot replace target evidence.
- If target root is unknown, block technical options and handoff readiness; continue only with product framing and explicit unknowns.
- If target root is known but target cognition is stale or missing, use target cognition, minimal live reads in the target, user confirmation, or explicit assumptions. Do not ask the user to rebuild current-project cognition for target files.
- Treat project cognition as advisory navigation and coverage metadata. Use it to choose minimal live reads, ownership hints, consumers, state surfaces, verification routes, and coverage gaps. Do not treat it as authoritative evidence for current behavior; prove project facts from live repository files.
- A project-cognition compass intake is not complete when it returns JSON. It is complete
only when readiness is interpreted as advisory navigation,
minimal_live_readsconstrains inspection, lane-levelfirst_pass_pathsreasons are considered, live evidence proves technical claims, and relevant facts are carried into the next workflow artifact or execution state. - Extract and carry forward
selected_concepts,rejected_concepts,selection_reason,semantic_intake,normalized_query,intent_facets,negative_constraints,concept_decisions,covered_facets,missing_facets,match_sources,lexicon_generation_id, the matched capability or symptom, affected nodes and subgraph,route_pack,minimal_live_reads,first_pass_paths,coverage_diagnostics, missing coverage, evidence traces, verification routes, ambiguity, conflicts, and weak coverage. - Treat project cognition under
.specify/project-cognition/as an advisory navigation surface. Legacy project-map exports are not evidence for current project behavior and.specify/templates/project-map/**is historical compatibility/export only. - Consume project rules and reusable Learning through
uvx --from git+https://github.com/chenziyang110/spec-kit-plus.git@6fbbf08a0b6833bb783ec6b418d567776b197ae4 specify learning start --command '<command>' --format json, then its returned list/show actions; do not parse Learning storage as part of cognition intake.
Cross-Project Reference Directories
- When inspecting or comparing another local directory, check whether that
directory or its children contain
.specify/first. A referenced directory may be a downstream Spec Kit project even when it is outside the current repo. - Prefer
C:\Users\11034\.specify\bin\project-cognition.exe discover --root <path> --format jsonto enumerate nested.specify/candidates before broad live reads. Treat itsprojectsentries as C:\Users\11034.specify\bin\project-cognition.exe candidates and itsspecify_candidatesentries as the broader set of Spec Kit-shaped directories. - Use another project's cognition only when
.specify/project-cognition/status.jsonexists,.specify/project-cognition/project-cognition.dbexists,reference_readinessisready, freshness isfresh, andgraph_readyis true. - For ready references, read only the fresh project cognition artifacts needed for the comparison, then use the returned minimal read order before inspecting more source files. Treat the reference map as supplemental navigation, not as evidence by itself.
- For blocked, stale, or incomplete references, do not treat legacy
.specify/project-map/**outputs as current truth. Fall back to minimal live reads and recommend$sp-map-updatefor localized stale coverage, weak reference coverage, external/manual changed-path map maintenance, or ordinary existing-baseline gaps after a usable reference baseline. - For brownfield missing or unusable reference baselines, recommend
$sp-map-scan -> $sp-map-build. Recommend scan/build for a reference project only for brownfield first/missing/unusable baseline, schema failure, zero active-generationpath_indexrows outsidegreenfield_empty,explicit_rebuild_requested, orbaseline_identity_invalid.
Command Surface Discipline
- Treat the live
uvx --from git+https://github.com/chenziyang110/spec-kit-plus.git@6fbbf08a0b6833bb783ec6b418d567776b197ae4 specify --helpoutput as the only authoritative CLI command surface. - Before suggesting or running a
specify <subcommand>invocation while satisfying this gate, verify that it exists inuvx --from git+https://github.com/chenziyang110/spec-kit-plus.git@6fbbf08a0b6833bb783ec6b418d567776b197ae4 specify --helporuvx --from git+https://github.com/chenziyang110/spec-kit-plus.git@6fbbf08a0b6833bb783ec6b418d567776b197ae4 specify '<subcommand>' --help. - Do not invent, paraphrase, or "normalize" unsupported CLI names such as
specify create-feature. - Feature creation remains
$sp-specifyplus the generated create-feature script at.specify/scripts/bash/create-new-feature.shor.specify/scripts/powershell/create-new-feature.ps1, not a separate branch-creation command. Default feature workspace names useYYYY-MM-DD-<slug>; numeric prefixes are legacy and require the script's explicit numeric option.
Missing Runtime Launcher Recovery
- If an installed cognition command begins with the all-caps
PROJECT_COGNITION_LAUNCHER_UNAVAILABLEmarker, treat the complete marked command as non-executable. The suffix only preserves the intended cognition subcommand so managed guidance can be rebound after repair. - Do not probe
specify cognitionorspecify project-cognition. Runuvx --from git+https://github.com/chenziyang110/spec-kit-plus.git@6fbbf08a0b6833bb783ec6b418d567776b197ae4 specify checkfor project-pinned diagnostics, then runuvx --from git+https://github.com/chenziyang110/spec-kit-plus.git@6fbbf08a0b6833bb783ec6b418d567776b197ae4 specify integration repairas the deterministic recovery entry. Re-open the active installed skill after repair; if the marker remains, report cognition unavailable and continue from live repository evidence only where the workflow's safety boundary permits degraded advisory navigation.
Freshness State Guidance
- If the project cognition runtime is missing for a brownfield project, continue with live repository
evidence and recommend the canonical
sp-map-scan -> sp-map-buildworkflow only as external baseline maintenance. When giving the user an explicit command to type, write$sp-map-scan -> $sp-map-build. - If
baseline_kind=greenfield_empty, continue with workflow artifacts and live requirements. Do not recommend map-scan -> map-build solely because the graph has no paths. - If the project cognition runtime is stale for a localized touched area, continue
with live repository evidence and recommend
sp-map-updatefirst when map maintenance is useful. When giving the user an explicit command to type, write$sp-map-update. - If changed paths are missing from project cognition
path_index, letsp-map-updateclassify the gap first. Adoptable paths get provisionalpath_indexplusalias_indexcoverage, uncertain paths returnminimal_live_reads, and ordinary existing-baseline gaps stay in$sp-map-update. - Treat repository boundary accounting as separate from graph evidence.
.cognitionignoreexclusions and automatic exclusions explain why a path is outside graph-facing coverage; they do not become project cognition evidence. - For
map-update, changed-path accounting must explain every candidate path before readiness can be considered useful. - If the freshness state is
support_drift, stop and tell the user to resolve support-surface drift; do not reflexively route tosp-map-update. - If the freshness state is
partial_refresh, tell the user the refresh was recorded but readiness did not pass; follow the reportedrecommended_next_actioninstead of implying success. - If
partial_refreshfollowssp-map-updateand validation shows bounded path-ledidentity_reconciliationdebt, the next action is a focused identity-repair pass insidesp-map-update, not an immediate user choice between repair and full rebuild. Escalate tosp-map-scan -> sp-map-buildonly when validation reports a reserved rebuild condition such as unusable baseline, schema failure, zero active-generation path index rows outsidegreenfield_empty, missing or invalidalias_index,explicit_rebuild_requested, orbaseline_identity_invalid. - If project cognition readiness is
blocked, report the runtime issue as degraded advisory map state. Ordinary discussion may continue with product framing or bounded live evidence; recommend a map maintenance workflow only when the user asks for map maintenance or handoff needs evidence that live reads cannot provide. - Preserve the distinction between the machine freshness field and public state
guidance:
freshnessrecords factual state, whilerecommended_next_actiontells the operator what to do next. - Use
map-updatefor ordinary existing-baseline gaps. Usemap-scan -> map-buildonly for brownfield first/missing/unusable baseline, schema failure, schema v1 or old broad-schema rebuild-required readiness, zero active-generation path_index rows outsidegreenfield_empty, missing or invalidalias_index,explicit_rebuild_requested, orbaseline_identity_invalid. Schema v5 is current-only. The runtime does not migrate schema v4 or older databases and does not archive or replace them. Remove the incompatible project-cognition.db explicitly beforesp-map-scan -> sp-map-buildwith the current binary. Uncertain closure can be recorded bysp-map-updateas partial/low-confidence facts, known unknowns, andminimal_live_reads. - Entry-time stale or weak cognition is still an advisory navigation concern unless the user explicitly requested map maintenance. A workflow may continue from live evidence when entry guidance allows it. That entry routing rule does not waive closeout ownership.
- Workflow-owned mutation closeout is not an external map-maintenance handoff. If the active workflow changed project-related source, runtime, templates, generated assets, config, tests, state contracts, or behavior-bearing docs, closeout must run
C:\Users\11034\.specify\bin\project-cognition.exe closeout-plan --workflow "$ACTIVE_WORKFLOW" --format jsonbefore recording inline project cognition update data. - When
DELTA_SESSION_IDexists, pass--delta-session "$DELTA_SESSION_ID"tocloseout-plan. Fill fields listed inrequired_agent_fieldsfrom live evidence; optional payload/delta fields such asknown_unknownsandboundaryare populated only when evidence supports them. Followupdate_mode=delta_sessionby completingdelta_append_draft.argv_prefixwith evidence placeholders, appending the workflow closeout delta event, then running structuredupdate_argv. Followupdate_mode=payload_fileby writing the completedpayload_draft, then running structuredupdate_argv. The display-onlyupdate_commandand display-onlydelta_append_commandplaceholders are not execution strings. - Use
known_unknownsonly for blockers that make the cognition update unsafe to trust. If the working tree contains unrelated dirty/untracked paths and the workflow uses explicit workflow-owned paths, record that asconfidence_notesorboundary.initial_dirty_paths, not as a blockingknown_unknownsitem. - Before update recording, resolve
unknown_path_dispositionsby settingagent_dispositiontoadoptable,review_only,ignored, orblocking_known_unknown. Verifiedadoptablepaths do not become blockingknown_unknowns. Onlyblocking_known_unknowndispositions become payload or delta known unknowns.agent_disposition=adoptableis an agent accounting decision, not proof that runtime indexing already succeeded; afterupdate_argvruns, inspectresult_state,adopted_paths,review_paths,minimal_live_reads, andpartial_refresh_reasons. - Clean closeout keys on
result_state, notstatus=ok,update_id,last_update_id, or freshness alone;recordedis legacy recorded-only partial/blocked output. Ifpartial_refresh_reasonsincludesmissing_passing_verification_result, repair the payload or delta evidence and rerunupdate_argvbefore final closeout instead of routing tosp-map-update. Never run thecomplete-refreshorclear-dirtyhelper afterresult_state=partial_refresh,needs_rebuild,blocked, or legacyrecorded. UseC:\Users\11034\.specify\bin\project-cognition.exe mark-dirty --reason "workflow-closeout-failed" --format jsononly when planner/update is unavailable, fails before recording useful update data, cannot safely identify workflow-owned scope, is blocked by runtime state, or verification/workflow completion is not trustworthy. sp-map-updateis for manual/external maintenance and follow-up repair after user edits, interrupted workflows, or explicit operator map-maintenance requests. It is external map maintenance, not routine cleanup for changes this workflow just made. In shared routing summaries, sp-map-update is for manual/external maintenance.- Do not rely on generic framework instinct, chat memory, or prior sessions when the project cognition runtime should be the source of truth.
Senior Consequence Analysis Relationship
Project cognition is necessary but not sufficient. Use it first to identify ownership, consumers, state surfaces, verification routes, and coverage gaps. Then run the Senior Consequence Analysis Gate when lifecycle, running-state, destructive-operation, shared-state, downstream consumer, compatibility, or multiple-behavior semantics matter.
The gate output must name affected objects, state behavior, dependency impact, recovery and validation, and coverage gaps. Preserve the Affected Object Map, State-Behavior Matrix, Dependency Impact Table, Recovery And Validation Contract, and Coverage Gaps. If project cognition cannot decide product semantics, record the gap and route to the appropriate workflow instead of treating the graph as authoritative.
Scope Guard
- This gate applies even if the user asks for a direct code change without mentioning Spec Kit workflows.
- Stand down only when the task is clearly greenfield and does not depend on any existing project structure, conventions, or runtime surface.
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