vc-context-discovery
vc-context-discovery automatically loads all project context files at the start of each agent session, scanning the process/context/, development-protocols/, and general-plans/ directories, plus feature folders when specified. It extracts only frontmatter metadata from markdown files using a Node script and outputs results in either human-readable or JSON format, enabling agents to identify and route to relevant context before proceeding with their assigned task.
git clone --depth 1 https://github.com/withkynam/vibecode-pro-max-kit /tmp/vc-context-discovery && cp -r /tmp/vc-context-discovery/.claude/skills/vc-context-discovery ~/.claude/skills/vc-context-discoverySKILL.md
# vc-context-discovery
> **Output style:** Follow `process/development-protocols/communication-standards.md` — answer-first, plain language, no unexplained jargon, TL;DR on long responses.
Discover and load all relevant context for the current task. This skill lists feature group nested files with full paths and loads `process/context/` files by domain routing table. It is the canonical context-loading entrypoint for every agent session.
## When To Invoke
At the start of every agent session (research, innovate, plan, validate, execute, update-process, fast-mode). Also at the start of any skill that needs repo context before operating.
## Frontmatter Schemas
Document the canonical schemas for three file types used across the repo. These schemas enable frontmatter-aware routing and filtering.
**Context file frontmatter schema:**
```yaml
name: context:{slug}
description: "one-line scope — used by vc-context-discovery for routing"
keywords: comma, separated, task, vocabulary, terms # drives grep-first keyword routing
related: [context:{other-slug}, context:{another-slug}] # sibling/cross-group links (optional)
date: dd-mm-yy
```
- `keywords` — strongly recommended, non-empty. Comma-separated task-vocabulary terms an
agent would use to describe a task this doc serves (e.g. `session, token, refresh, jwt,
login`). This is the match surface for `discover-context.mjs --match`; weak/absent
keywords are why a relevant doc never gets routed to. Lint WARNS when empty (so existing
projects don't break on sync) — backfill at UPDATE-PROCESS.
- `related` — OPTIONAL list of `context:{slug}` values for sibling docs that are usually
needed together (the markdown-native equivalent of cross-links). Every slug listed MUST
resolve to a real `context:` doc; dangling links fail lint. Discovery follows these after
the primary match so a task touching two domains loads both.
**Plan file frontmatter schema:**
```yaml
name: plan:{slug}
description: "one-line scope and feature"
date: dd-mm-yy
feature: {feature-folder-name}
phase: "{phase-id}" # optional, for phase program plans only
```
**Report file frontmatter schema:**
```yaml
name: report:{slug}
description: "one-line scope"
date: dd-mm-yy
metadata:
node_type: memory
type: report
feature: {feature-folder-name}
phase: {phase-id}
```
## Invocation
**Primary method** — run the auto-discovery script. It lists all nested files under
`process/context/`, `process/development-protocols/`, `process/general-plans/active/`,
and (with `--feature`) the feature folder, extracting ONLY the leading YAML frontmatter
block of each `.md` file (no whole-file reads):
```bash
node .claude/skills/vc-context-discovery/scripts/discover-context.mjs [--feature <name>] [--json]
```
The script groups output into: context files with frontmatter, protocol files, feature
files by subfolder, active general plans, and files-without-frontmatter (path only). It
never throws on a missing root and exits 0 unless given a bad flag. Use `--json` for a
machine-readable object. Prefer this over manually reading each file — it is deterministic
and avoids loading huge files into context.
**Keyword-first routing (deterministic, not judgment).** When the task vocabulary does not
obviously map to a routing-table row, do not guess — let the index do the matching:
```bash
node .claude/skills/vc-context-discovery/scripts/discover-context.mjs --match "update the user ORM model"
```
This tokenizes the task and ranks context docs by overlap with their frontmatter `keywords`,
then appends any `related:` siblings of the top hits. Read the ranked docs in order. This is
the fallback that fixes "the right doc existed but the agent walked past it."
**Routing-table generation (drift-proof index).** The "Current Root Entry Points" and
"Current Context Groups" tables in `all-context.md` are GENERATED from frontmatter, not
hand-authored — they live between `<!-- GENERATED:routing -->` / `<!-- /GENERATED:routing -->`
markers. Rebuild them after any context-org change:
```bash
node .claude/skills/vc-context-discovery/scripts/discover-context.mjs --emit-routing # rewrites the block
node .claude/skills/vc-context-discovery/scripts/discover-context.mjs --check-routing # lint: block in sync?
```
The hand-authored Task Routing Table (task-type → file) stays editorial and is NOT generated.
Per **task-folder artefact colocation**, the script surfaces each task's plan, spec,
reports, and references INSIDE its own `{slug}_{date}/` task folder; the sibling
`reports/`/`references/` dirs are deprecated and only hold legacy artefacts.
## Workflow (manual FALLBACK)
Use these steps only if the script above fails or is unavailable.
**Step 1.** Run `find process/context/ -type f | sort` and record all available context files.
**Step 2.** Run `find process/development-protocols/ -type f | sort` and record all protocol files.
**Step 3.** Read `process/context/all-context.md` to get the routing table and current feature list.
**Step 4.** If a feature name was provided as the argument, run `find process/features/{feature}/ -type f | sort` to list ALL artifacts across all subfolders (`active/`, `completed/`, `backlog/`, plus any legacy `reports/`, `references/`). Surface full file paths — not just folder names. Per **task-folder artefact colocation**, expect each task's plan, spec, reports, and references INSIDE its own `{slug}_{date}/` task folder; the sibling `reports/`/`references/` dirs are deprecated and only hold legacy artefacts.
**Step 5.** If no feature name was provided, run `find process/general-plans/active/ -type f | sort` to surface any active plans relevant to the current task. Note: plan files are inside `{slug}_{date}/` task subfolders — look one level deep for `*_PLAN_*.md` files.
**Step 6.** From the routing table in `all-context.md`, identify the context group files relevant to the current task domain (e.g. `tests`, `container`, `infra`, `skills`, `uxui`, `workflows`). DoComprehensive code review with scout-based edge case detection. Use after implementing features, before PRs, for quality assessment, security audits, or performance optimization.
Simplifies and refines code for clarity, consistency, and maintainability while preserving all functionality. Focuses on recently modified code unless instructed otherwise.
Use this agent when you need to investigate issues, analyze system behavior, diagnose performance problems, examine database structures, collect and analyze logs from servers or CI/CD pipelines, run tests for debugging purposes, or optimize system performance. This includes troubleshooting errors, identifying bottlenecks, analyzing failed deployments, investigating test failures, and creating diagnostic reports. Examples:\n\n<example>\nContext: The user needs to investigate why an API endpoint is returning 500 errors.\nuser: "The /api/users endpoint is throwing 500 errors"\nassistant: "I''ll use the debugger agent to investigate this issue"\n<commentary>\nSince this involves investigating an issue, use the Task tool to launch the debugger agent.\n</commentary>\n</example>\n\n<example>\nContext: The user wants to analyze why the CI/CD pipeline is failing.\nuser: "The GitHub Actions workflow keeps failing on the test step"\nassistant: "Let me use the debugger agent to analyze the CI/CD pipeline logs and identify the issue"\n<commentary>\nThis requires analyzing CI/CD logs and test failures, so use the debugger agent.\n</commentary>\n</example>\n\n<example>\nContext: The user notices performance degradation in the application.\nuser: "The application response times have increased by 300% since yesterday"\nassistant: "I''ll launch the debugger agent to analyze system behavior and identify performance bottlenecks"\n<commentary>\nPerformance analysis and bottleneck identification requires the debugger agent.\n</commentary>\n</example>
EXECUTE MODE - Implementing EXACTLY what was planned. Full tool access. Can only be invoked after explicit user confirmation. Use after plan is approved.
FAST MODE - Execute compressed RIPER-5 workflow (RESEARCH + INNOVATE + PLAN) in one session, then pause for EXECUTE confirmation. Use when you want quick end-to-end solution.
Stage, commit, and push code changes with conventional commits. Use when user says "commit", "push", or finishes a feature/fix.
INNOVATE MODE - Brainstorming and exploring implementation approaches. Discusses possibilities without making decisions. Use after research is complete.
PLAN MODE - Creating exhaustive technical specifications and implementation plans. Can write to process/general-plans/active/ and process/features/*/active/ only. Use after approach is decided.