Files
msd-core/commands/gsd/intel.md
Rezolv d3a79917fa feat: Phase 2 caller migration — gsd-sdk query in workflows, agents, commands (#2179)
* feat: Phase 2 caller migration — gsd-sdk query in workflows (#2122)

Cherry-picked orchestration rewrites from feat/sdk-foundation (#2008, 4018fee) onto current main, resolving conflicts to keep upstream worktree guards and post-merge test gate. SDK stub registry omitted (out of Phase 2 scope per #2122).

Refs: #2122 #2008
Made-with: Cursor

* docs: add gsd-sdk query migration blurb

Made-with: Cursor

* docs(workflows): extend Phase 2 gsd-sdk query caller migration

- Swap node gsd-tools.cjs for gsd-sdk query in review, plan-phase, execute-plan,
  ship, extract_learnings, ai-integration-phase, eval-review, next, thread
- Document graphify CJS-only in gsd-planner; dual-path in CLI-TOOLS and ARCHITECTURE
- Update tests: workstreams gsd-sdk path, thread frontmatter.get, workspace init.*,
  CRLF-safe autonomous frontmatter parse
- CHANGELOG: Phase 2 caller migration scope

Made-with: Cursor

* docs(phase2): USER-GUIDE + remaining gsd-sdk query call sites

- USER-GUIDE: dual-path CLI section; state validate/sync use full CJS path
- Commands: debug (config-get+tdd), quick (security note), intel Task prompt
- Agent: gsd-debug-session-manager resolve-model via jq
- Workflows: milestone-summary, forensics, next, complete-milestone/verify-work
  (audit-open CJS notes), discuss-phase, progress, verify-phase, add/insert/remove
  phase, transition, manager, quick workflow; remove-phase commit without --files
- Test: quick-session-management accepts frontmatter.get
- CHANGELOG: Phase 2 follow-up bullet

Made-with: Cursor

* docs(phase2): align gsd-sdk query examples in commands and agents

- init.* query names; frontmatter.get uses positional field name
- state.* handlers use positional args; commit uses positional paths
- CJS-only notes for from-gsd2 and graphify; learnings.query wording
- CHANGELOG: Phase 2 orchestration doc pass

Made-with: Cursor

* docs(phase2): normalize gsd-sdk query commit to positional file paths

- Strip --files from commit examples in workflows, references, commands
- Keep commit-to-subrepo ... --files (separate handler)
- git-planning-commit.md: document positional args
- Tests: new-project commit line, state.record-session, gates CRLF, roadmap.analyze
- CHANGELOG [Unreleased]

Made-with: Cursor

* feat(sdk): gsd-sdk query parity with gsd-tools and PR 2179 registry fixes

- Route query via longest-prefix match and dotted single-token expansion; fall back
  to runGsdToolsQuery (same argv as node gsd-tools.cjs) for full CLI coverage.
- Parse gsd-sdk query permissively so gsd-tools flags (--json, --verify, etc.) are
  not rejected by strict parseArgs.
- resolveGsdToolsPath: honor GSD_TOOLS_PATH; prefer bundled get-shit-done copy
  over project .claude installs; export runGsdToolsQuery from the SDK.
- Fix gsd-tools audit-open (core.output; pass object for --json JSON).
- Register summary-extract as alias of summary.extract; fix audit-fix workflow to
  call audit-uat instead of invalid init.audit-uat (PR review).

Updates QUERY-HANDLERS.md and CHANGELOG [Unreleased].

Made-with: Cursor

* fix(sdk): Phase 2 scope — Trek-e review (#2179, #2122)

- Remove gsd-sdk query passthrough to gsd-tools.cjs; drop GSD_TOOLS_PATH
- Consolidate argv routing in resolveQueryArgv(); update USAGE and QUERY-HANDLERS
- Surface @file: read failures in GSDTools.parseOutput
- execute-plan: defer Task Commit Protocol to gsd-executor
- stale-colon-refs: skip .planning/ and root CLAUDE.md (gitignored overlays)
- CHANGELOG [Unreleased]: maintainer review and routing notes

Made-with: Cursor
2026-04-15 22:46:31 -04:00

4.7 KiB

name, description, argument-hint, allowed-tools
name description argument-hint allowed-tools
gsd:intel Query, inspect, or refresh codebase intelligence files in .planning/intel/ [query <term>|status|diff|refresh]
Read
Bash
Task

STOP -- DO NOT READ THIS FILE. You are already reading it. This prompt was injected into your context by Claude Code's command system. Using the Read tool on this file wastes tokens. Begin executing Step 0 immediately.

Step 0 -- Banner

Before ANY tool calls, display this banner:

GSD > INTEL

Then proceed to Step 1.

Step 1 -- Config Gate

Check if intel is enabled by reading .planning/config.json directly using the Read tool.

DO NOT use the gsd-tools config get-value command -- it hard-exits on missing keys.

  1. Read .planning/config.json using the Read tool
  2. If the file does not exist: display the disabled message below and STOP
  3. Parse the JSON content. Check if config.intel && config.intel.enabled === true
  4. If intel.enabled is NOT explicitly true: display the disabled message below and STOP
  5. If intel.enabled is true: proceed to Step 2

Disabled message:

GSD > INTEL

Intel system is disabled. To activate:

  gsd-sdk query config-set intel.enabled true

Then run /gsd-intel refresh to build the initial index.

Step 2 -- Parse Argument

Parse $ARGUMENTS to determine the operation mode:

Argument Action
query <term> Run inline query (Step 2a)
status Run inline status check (Step 2b)
diff Run inline diff check (Step 2c)
refresh Spawn intel-updater agent (Step 3)
No argument or unknown Show usage message

Usage message (shown when no argument or unrecognized argument):

GSD > INTEL

Usage: /gsd-intel <mode>

Modes:
  query <term>  Search intel files for a term
  status        Show intel file freshness and staleness
  diff          Show changes since last snapshot
  refresh       Rebuild all intel files from codebase analysis

Step 2a -- Query

Run:

gsd-sdk query intel.query <term>

Parse the JSON output and display results:

  • If the output contains "disabled": true, display the disabled message from Step 1 and STOP
  • If no matches found, display: No intel matches for '<term>'. Try /gsd-intel refresh to build the index.
  • Otherwise, display matching entries grouped by intel file

STOP after displaying results. Do not spawn an agent.

Step 2b -- Status

Run:

gsd-sdk query intel.status

Parse the JSON output and display each intel file with:

  • File name
  • Last updated_at timestamp
  • STALE or FRESH status (stale if older than 24 hours or missing)

STOP after displaying status. Do not spawn an agent.

Step 2c -- Diff

Run:

gsd-sdk query intel.diff

Parse the JSON output and display:

  • Added entries since last snapshot
  • Removed entries since last snapshot
  • Changed entries since last snapshot

If no snapshot exists, suggest running refresh first.

STOP after displaying diff. Do not spawn an agent.


Step 3 -- Refresh (Agent Spawn)

Display before spawning:

GSD > Spawning intel-updater agent to analyze codebase...

Spawn a Task:

Task(
  description="Refresh codebase intelligence files",
  prompt="You are the gsd-intel-updater agent. Your job is to analyze this codebase and write/update intelligence files in .planning/intel/.

Project root: ${CWD}
Prefer: gsd-sdk query <subcommand> (installed gsd-sdk on PATH). Legacy: node $HOME/.claude/get-shit-done/bin/gsd-tools.cjs

Instructions:
1. Analyze the codebase structure, dependencies, APIs, and architecture
2. Write JSON intel files to .planning/intel/ (stack.json, api-map.json, dependency-graph.json, file-roles.json, arch-decisions.json)
3. Each file must have a _meta object with updated_at timestamp
4. Use `gsd-sdk query intel.extract-exports <file>` to analyze source files
5. Use `gsd-sdk query intel.patch-meta <file>` to update timestamps after writing
6. Use `gsd-sdk query intel.validate` to check your output

When complete, output: ## INTEL UPDATE COMPLETE
If something fails, output: ## INTEL UPDATE FAILED with details."
)

Wait for the agent to complete.


Step 4 -- Post-Refresh Summary

After the agent completes, run:

gsd-sdk query intel.status

Display a summary showing:

  • Which intel files were written or updated
  • Last update timestamps
  • Overall health of the intel index

Anti-Patterns

  1. DO NOT spawn an agent for query/status/diff operations -- these are inline CLI calls
  2. DO NOT modify intel files directly -- the agent handles writes during refresh
  3. DO NOT skip the config gate check
  4. DO NOT use the gsd-tools config get-value CLI for the config gate -- it exits on missing keys