Files
github-spec-kit/extensions/agent-context/commands/speckit.agent-context.update.md
Marsel Safin 292eaa6c98 fix: find plans in nested spec directories (#3405)
* fix: find plans in nested spec directories

The agent-context mtime fallback used a one-level specs/*/plan.md
glob, so scoped layouts (specs/<scope>/<feature>/plan.md via
SPECIFY_FEATURE_DIRECTORY) never matched and the SPECKIT block was
written without a plan path. Recurse in both script variants and
update the command doc wording.

Fixes #3024

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* refactor: pick newest plan with max(), align doc wording

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-09 08:53:54 -05:00

1.7 KiB

description
description
Refresh the managed Spec Kit section in coding agent context file(s)

Update Coding Agent Context

Refresh the managed Spec Kit section inside the active coding agent's context/instruction file (e.g. CLAUDE.md, .github/copilot-instructions.md, AGENTS.md).

Behavior

The script reads the agent-context extension config at .specify/extensions/agent-context/agent-context-config.yml to discover:

  • context_file — the path of the coding agent context file to manage.
  • context_files — optional project-relative paths for multiple coding agent context files. When non-empty, the script updates each listed file and the list takes precedence over context_file.
  • context_markers.start / .end — the delimiters surrounding the managed section. Defaults to <!-- SPECKIT START --> and <!-- SPECKIT END --> when the field is missing.

It then creates, replaces, or appends the managed block so that the section points at the most recent plan path when one can be discovered (specs/**/plan.md, any depth).

If context_files and context_file are empty, the command reports nothing to do and exits successfully. Context file paths must stay project-relative; absolute paths, Windows drive paths, backslash separators, and .. path segments are rejected.

Execution

  • Bash: .specify/extensions/agent-context/scripts/bash/update-agent-context.sh [plan_path]
  • PowerShell: .specify/extensions/agent-context/scripts/powershell/update-agent-context.ps1 [plan_path]

When plan_path is omitted, the script auto-detects the most recently modified specs/**/plan.md (any depth, so scoped layouts like specs/<scope>/<feature>/plan.md are found).