Project Change Router
Overview
Use this skill to turn a large repository into a governed change-routing system. It helps the agent locate likely capability entries, avoid duplicate implementations, enforce boundary checks, and create or validate a repository-local router bundle.
PCR is a direction index and guardrail system, not an automatic architecture decision engine. Its boundary, risk, and read/write constraints are mandatory for the agent to respect. Its action, recommended_next_steps, analysis_directions, and why_not_actions are structured guidance for the agent's own source-code analysis and user-confirmed engineering decision.
The authoritative write decision is execution_gate, reduced from schema-valid typed findings as pass, conditional, or blocked. action remains independent advisory direction and is never rewritten merely to imitate a gate state.
Two-Layer Contract
Mandatory guardrail layer:
- Read
execution_gate before interpreting action. It is the authoritative write decision.
- For
execution_gate.state=blocked, do not write product code. Resolve the decisive typed findings or obtain a valid, task-bound authorization grant where policy allows one.
- For
execution_gate.state=conditional, run every required_command and stay inside the returned write envelope. Conditional means only proven unrelated or non-expanding historical debt remains; it is not a general bypass.
- For
execution_gate.state=pass, continue only inside the returned write envelope after reading the precise targets.
- Respect
allowed_write_paths, forbidden_write_paths, and must_read_before_edit.
- Do not bypass confirmed owners, public entries, canonical roots, or dependency direction.
- Do not create a second implementation center when a reusable capability may already exist.
- Never ignore
veto_reasons, unknown evidence, lifecycle findings, low routing confidence, provisional boundaries, or high-risk overlaps. Trace them to the decisive typed findings and gate policy rules.
Advisory direction layer:
- Treat
action as the router's current processing tendency, not a final engineering command.
- Use
recommended_next_steps, safe_next_steps, analysis_directions, profile_repair_hints, and why_not_actions as unblock directions and investigation prompts.
action=review is an investigation direction, not a write decision. It may coexist with pass, conditional, or blocked; follow execution_gate and use review guidance to gather evidence.
- Final implementation choices still require real code reading, dependency tracing, tests, and user-confirmed scope.
Workflow
- Detect whether the request is a feature addition, feature modification, refactor, migration, or bug fix.
- Find the repository root and look for an existing
project-change-router/ bundle.
- If the bundle is missing and the user explicitly wants durable routing metadata, bootstrap one from the current repository structure.
- Prefer
scripts/run_change_flow.py to resolve the route and run freshness, dependency, public API, structure, governance, and reuse checks as one compact flow. Use the legacy commands separately only for focused diagnostics or compatibility.
- Read
execution_gate, the fixed safety envelope, decisive typed findings, and ordered required_commands before interpreting advisory action guidance.
- Read each resolved
must_read_target and its symbol/content digest. Inventory directories without reading them wholesale; run each structured query for unresolved targets.
- If the gate is
blocked, stop product writes and resolve the reported unknown or blocking evidence. If it is conditional, execute all pre-change commands and preserve the bounded envelope. If it is pass, continue inside the envelope.
- Apply the change only in the routed layer.
action helps choose reuse, extension, extraction, or a new boundary but never grants write authority.
- Preserve the global report and its route-relevant delta:
task_local_new, task_local_expanded, and unknown remain blocking under their policy rules; only trusted baseline_unchanged debt proven outside the forward/reverse closure may yield conditional.
- Run
check_structure.py for central-file growth, file-size bands, forbidden implementation roots, exclusive canonical owners, and exact pinned generated-output verification when the profile declares those baselines. For a new pin, require the user-approved exact fingerprint through --initialize-generated-output-baseline on structure verification and the first write-enabled rebuild; never treat profile text as authorization. While a current or committed pin remains active, malformed, or only worktree-removed, use the verified rebuild path and never bootstrap over its seven protected refs.
- For reuse, inspect the independent
intra_capability, cross_capability, and extended channels. A bounded, incomplete, timed-out, cancelled, or errored channel cannot prove that duplicates are absent.
- Promote a baseline only from a clean, complete candidate bound to the current commit/profile/bundle/structure/index/tool/policy identity, using an exact accepted fingerprint or trusted CI authority. Never promote a dirty or incomplete first scan.
- If policy permits an override, create an authorization request and require an externally confirmed grant. Grants are task/path/owner/route/mutation-bound, expire, are single-use by default, and never revive after consumption.
- If the change reveals stale indexes, ownership gaps, or missing capability coverage, run the governance audit before deciding whether to rebuild.
- Rebuild the bundle only when routing references are stale or the user explicitly asks to refresh repository-local routing data.
- After a routed change, follow
post_change_closeout and record feedback or evaluation regressions when review, override, delete, merge, or capability correction happened.
- For concrete route interpretation examples, read
examples/agent-workflows/README.md before inventing behavior that is not described by the route report.
Execution Modes
- Unified read-only flow: use
scripts/run_change_flow.py; it runs route plus governed checks, persists the full content-addressed artifact, and returns compact safety output by default
- Focused read-only mode: use
scripts/resolve_entry.py, scripts/check_reuse.py, scripts/check_deps.py, scripts/check_public_api.py, scripts/check_structure.py, scripts/check_index_freshness.py, scripts/check_bundle_governance.py, and scripts/run_evaluation.py
- Authorization mode: use
scripts/manage_authorization.py to persist a request, record external confirmation as a bounded grant, consume it, or inspect its audit chain
- Write mode: use
scripts/bootstrap_router.py or scripts/rebuild_index.py only when the user explicitly asks to create or refresh repository-local routing data
Do not silently create or rebuild project-change-router/ during an unrelated code-edit request.
Route Actions
reuse: use an existing capability without changing its core
extend: add behavior through a shared capability entry or compatible internal change
extract: move repeated logic into a shared capability first
new: introduce a new capability because no acceptable shared fit exists
review: prioritize evidence gathering, profile repair, coordination, or user confirmation because the request is ambiguous, high-risk, or multi-capability
Route actions are advisory direction labels. They help the agent decide what to inspect next and what risks to manage, but they do not replace engineering judgment from the actual repository.
review is not an implementation decision, write denial, or permanent block. It is a request to investigate before choosing the engineering approach. Only execution_gate decides whether writes are currently pass, conditional, or blocked.
The governance outputs are not a separate add-on. They are first-class fields of the same route report and must be interpreted together with action, primary_capability, and confidence. Mandatory guardrails take precedence over advisory actions.
Repository Bundle
The skill can create or validate a repository-local bundle named project-change-router/ with:
router-config.yaml
references/
references/path-to-capability-map.yaml
profiles/ overrides from the repository root when present
schemas/
reports/
Use the bundle when you need a durable, repo-specific routing index. Use the global skill when you need the routing process itself.
Repository-level overrides are loaded from:
.project-change-router.yaml
.project-change-router.yml
project-change-router.profile.yaml
project-change-router.profile.yml
Canonical, legacy, and skill-profile locations are compatibility priority levels, not merge layers. Exactly one file may exist at the selected level; .yaml and .yml siblings at the same level are a fail-closed source conflict.
These overrides can define capability mappings, path-level ownership rules, explicit capability_ownership primary/reviewer records, repository-specific risk review phrases, and module overrides without patching the global skill code. Missing, duplicate, malformed, unknown, provisional, or same-person capability ownership remains review-only.
References
references/router-workflow.md
references/bootstrap.md
references/repo-discovery.md
references/schema-overview.md
references/evaluation.md
references/governance-outputs.md
references/architecture-governance.md
references/reuse-scan-runtime.md
references/typed-findings-gate-todo.md
examples/agent-workflows/README.md
Resources
scripts/bootstrap_router.py
scripts/resolve_entry.py
scripts/rebuild_index.py
scripts/check_reuse.py
scripts/check_deps.py
scripts/check_public_api.py
scripts/check_structure.py
scripts/check_index_freshness.py
scripts/check_bundle_governance.py
scripts/run_evaluation.py
scripts/run_change_flow.py
scripts/manage_authorization.py
scripts/sync_feedback.py
scripts/validate_router_bundle.py
Examples
examples/agent-workflows/README.md: scenario-based agent workflow examples for route, review, seed, composite, lifecycle, profile repair, and closeout behavior
examples/agent-workflows/unattended-plan-prompt.md: reusable prompt for long-running or unattended agent plans
examples/agent-workflows/update-existing-router-bundle-prompt.md: reusable prompt for refreshing an existing repository-local bundle after a skill upgrade
examples/outputs/: complete route and guardrail output samples
examples/profiles/: copyable profile templates for early repos, monorepos, mixed stacks, and this skill repository shape
assets
Notes
- This skill is standalone and installable under
~/.codex/skills, ~/.claude/skills, or ~/.dsh/skills.
- For Claude Code, install the same folder under
~/.claude/skills/project-change-router/ or .claude/skills/project-change-router/.
- For DeepSeek Harness, install the same folder under
~/.dsh/skills/project-change-router/, .dsh/skills/project-change-router/, or use the repository's dsh.bundle plugin.
- Codex requests can invoke it as
$project-change-router; Claude Code and DeepSeek Harness requests can invoke it as /project-change-router.
- DeepSeek Harness is currently a developer preview. Revalidate the filesystem and provider contracts when upgrading Harness across preview releases.
- It does not depend on a specific repository.
- The repository-local router bundle is generated on demand and is not the skill itself.
- Version 0.4 exposes architecture governance API v2, typed-finding/gate/change-flow/authorization API v1, and preserves reuse engine API v2.
- Every current report carries runtime identity: skill version, Git commit when available, installed payload digest/source, compatible bundle schemas, report/API/policy versions, parser versions, and an identity digest.
- Updating the installed skill does not bootstrap, rebuild, or overwrite an existing repository-local bundle. Bundle schema v1 remains readable; missing 0.4 precision becomes
unknown and blocks when required instead of being fabricated or written back. Runtime fingerprints, baselines, authorization manifests, and managed artifacts live outside the repository by default.
1---2name: project-change-router3description: Project-level direction, boundary, and reuse governance for large repositories. Use when Codex, Claude Code, or DeepSeek Harness needs mandatory routing guardrails before code edits: identify capability candidates, canonical roots, owners, allowed/forbidden write paths, reuse risks, and advisory actions such as reuse, extend, extract, new, or review. Also use when the agent should bootstrap, rebuild, validate, or evaluate a repository-local router bundle for Java, Python, TypeScript, or mixed monorepos.4---56# Project Change Router78## Overview910Use this skill to turn a large repository into a governed change-routing system. It helps the agent locate likely capability entries, avoid duplicate implementations, enforce boundary checks, and create or validate a repository-local router bundle.1112PCR is a direction index and guardrail system, not an automatic architecture decision engine. Its boundary, risk, and read/write constraints are mandatory for the agent to respect. Its `action`, `recommended_next_steps`, `analysis_directions`, and `why_not_actions` are structured guidance for the agent's own source-code analysis and user-confirmed engineering decision.1314The authoritative write decision is `execution_gate`, reduced from schema-valid typed findings as `pass`, `conditional`, or `blocked`. `action` remains independent advisory direction and is never rewritten merely to imitate a gate state.1516## Two-Layer Contract1718Mandatory guardrail layer:1920- Read `execution_gate` before interpreting `action`. It is the authoritative write decision.21- For `execution_gate.state=blocked`, do not write product code. Resolve the decisive typed findings or obtain a valid, task-bound authorization grant where policy allows one.22- For `execution_gate.state=conditional`, run every `required_command` and stay inside the returned write envelope. Conditional means only proven unrelated or non-expanding historical debt remains; it is not a general bypass.23- For `execution_gate.state=pass`, continue only inside the returned write envelope after reading the precise targets.24- Respect `allowed_write_paths`, `forbidden_write_paths`, and `must_read_before_edit`.25- Do not bypass confirmed owners, public entries, canonical roots, or dependency direction.26- Do not create a second implementation center when a reusable capability may already exist.27- Never ignore `veto_reasons`, unknown evidence, lifecycle findings, low routing confidence, provisional boundaries, or high-risk overlaps. Trace them to the decisive typed findings and gate policy rules.2829Advisory direction layer:3031- Treat `action` as the router's current processing tendency, not a final engineering command.32- Use `recommended_next_steps`, `safe_next_steps`, `analysis_directions`, `profile_repair_hints`, and `why_not_actions` as unblock directions and investigation prompts.33- `action=review` is an investigation direction, not a write decision. It may coexist with `pass`, `conditional`, or `blocked`; follow `execution_gate` and use review guidance to gather evidence.34- Final implementation choices still require real code reading, dependency tracing, tests, and user-confirmed scope.3536## Workflow37381. Detect whether the request is a feature addition, feature modification, refactor, migration, or bug fix.392. Find the repository root and look for an existing `project-change-router/` bundle.403. If the bundle is missing and the user explicitly wants durable routing metadata, bootstrap one from the current repository structure.414. Prefer `scripts/run_change_flow.py` to resolve the route and run freshness, dependency, public API, structure, governance, and reuse checks as one compact flow. Use the legacy commands separately only for focused diagnostics or compatibility.425. Read `execution_gate`, the fixed safety envelope, decisive typed findings, and ordered `required_commands` before interpreting advisory `action` guidance.436. Read each resolved `must_read_target` and its symbol/content digest. Inventory directories without reading them wholesale; run each structured query for unresolved targets.447. If the gate is `blocked`, stop product writes and resolve the reported unknown or blocking evidence. If it is `conditional`, execute all pre-change commands and preserve the bounded envelope. If it is `pass`, continue inside the envelope.458. Apply the change only in the routed layer. `action` helps choose reuse, extension, extraction, or a new boundary but never grants write authority.469. Preserve the global report and its route-relevant delta: `task_local_new`, `task_local_expanded`, and `unknown` remain blocking under their policy rules; only trusted `baseline_unchanged` debt proven outside the forward/reverse closure may yield `conditional`.4710. Run `check_structure.py` for central-file growth, file-size bands, forbidden implementation roots, exclusive canonical owners, and exact pinned generated-output verification when the profile declares those baselines. For a new pin, require the user-approved exact fingerprint through `--initialize-generated-output-baseline` on structure verification and the first write-enabled rebuild; never treat profile text as authorization. While a current or committed pin remains active, malformed, or only worktree-removed, use the verified rebuild path and never bootstrap over its seven protected refs.4811. For reuse, inspect the independent `intra_capability`, `cross_capability`, and `extended` channels. A bounded, incomplete, timed-out, cancelled, or errored channel cannot prove that duplicates are absent.4912. Promote a baseline only from a clean, complete candidate bound to the current commit/profile/bundle/structure/index/tool/policy identity, using an exact accepted fingerprint or trusted CI authority. Never promote a dirty or incomplete first scan.5013. If policy permits an override, create an authorization request and require an externally confirmed grant. Grants are task/path/owner/route/mutation-bound, expire, are single-use by default, and never revive after consumption.5114. If the change reveals stale indexes, ownership gaps, or missing capability coverage, run the governance audit before deciding whether to rebuild.5215. Rebuild the bundle only when routing references are stale or the user explicitly asks to refresh repository-local routing data.5316. After a routed change, follow `post_change_closeout` and record feedback or evaluation regressions when review, override, delete, merge, or capability correction happened.5417. For concrete route interpretation examples, read `examples/agent-workflows/README.md` before inventing behavior that is not described by the route report.5556## Execution Modes5758- Unified read-only flow: use `scripts/run_change_flow.py`; it runs route plus governed checks, persists the full content-addressed artifact, and returns compact safety output by default59- Focused read-only mode: use `scripts/resolve_entry.py`, `scripts/check_reuse.py`, `scripts/check_deps.py`, `scripts/check_public_api.py`, `scripts/check_structure.py`, `scripts/check_index_freshness.py`, `scripts/check_bundle_governance.py`, and `scripts/run_evaluation.py`60- Authorization mode: use `scripts/manage_authorization.py` to persist a request, record external confirmation as a bounded grant, consume it, or inspect its audit chain61- Write mode: use `scripts/bootstrap_router.py` or `scripts/rebuild_index.py` only when the user explicitly asks to create or refresh repository-local routing data6263Do not silently create or rebuild `project-change-router/` during an unrelated code-edit request.6465## Route Actions6667- `reuse`: use an existing capability without changing its core68- `extend`: add behavior through a shared capability entry or compatible internal change69- `extract`: move repeated logic into a shared capability first70- `new`: introduce a new capability because no acceptable shared fit exists71- `review`: prioritize evidence gathering, profile repair, coordination, or user confirmation because the request is ambiguous, high-risk, or multi-capability7273Route actions are advisory direction labels. They help the agent decide what to inspect next and what risks to manage, but they do not replace engineering judgment from the actual repository.7475`review` is not an implementation decision, write denial, or permanent block. It is a request to investigate before choosing the engineering approach. Only `execution_gate` decides whether writes are currently `pass`, `conditional`, or `blocked`.7677The governance outputs are not a separate add-on. They are first-class fields of the same route report and must be interpreted together with `action`, `primary_capability`, and confidence. Mandatory guardrails take precedence over advisory actions.7879## Repository Bundle8081The skill can create or validate a repository-local bundle named `project-change-router/` with:8283- `router-config.yaml`84- `references/`85- `references/path-to-capability-map.yaml`86- `profiles/` overrides from the repository root when present87- `schemas/`88- `reports/`8990Use the bundle when you need a durable, repo-specific routing index. Use the global skill when you need the routing process itself.9192Repository-level overrides are loaded from:9394- `.project-change-router.yaml`95- `.project-change-router.yml`96- `project-change-router.profile.yaml`97- `project-change-router.profile.yml`9899Canonical, legacy, and skill-profile locations are compatibility priority levels, not merge layers. Exactly one file may exist at the selected level; `.yaml` and `.yml` siblings at the same level are a fail-closed source conflict.100101These overrides can define capability mappings, path-level ownership rules, explicit `capability_ownership` primary/reviewer records, repository-specific risk review phrases, and module overrides without patching the global skill code. Missing, duplicate, malformed, unknown, provisional, or same-person capability ownership remains review-only.102103## References104105- `references/router-workflow.md`106- `references/bootstrap.md`107- `references/repo-discovery.md`108- `references/schema-overview.md`109- `references/evaluation.md`110- `references/governance-outputs.md`111- `references/architecture-governance.md`112- `references/reuse-scan-runtime.md`113- `references/typed-findings-gate-todo.md`114- `examples/agent-workflows/README.md`115116## Resources117118- `scripts/bootstrap_router.py`119- `scripts/resolve_entry.py`120- `scripts/rebuild_index.py`121- `scripts/check_reuse.py`122- `scripts/check_deps.py`123- `scripts/check_public_api.py`124- `scripts/check_structure.py`125- `scripts/check_index_freshness.py`126- `scripts/check_bundle_governance.py`127- `scripts/run_evaluation.py`128- `scripts/run_change_flow.py`129- `scripts/manage_authorization.py`130- `scripts/sync_feedback.py`131- `scripts/validate_router_bundle.py`132133## Examples134135- `examples/agent-workflows/README.md`: scenario-based agent workflow examples for route, review, seed, composite, lifecycle, profile repair, and closeout behavior136- `examples/agent-workflows/unattended-plan-prompt.md`: reusable prompt for long-running or unattended agent plans137- `examples/agent-workflows/update-existing-router-bundle-prompt.md`: reusable prompt for refreshing an existing repository-local bundle after a skill upgrade138- `examples/outputs/`: complete route and guardrail output samples139- `examples/profiles/`: copyable profile templates for early repos, monorepos, mixed stacks, and this skill repository shape140141### assets142143- `assets/router-icon.svg`144145## Notes146147- This skill is standalone and installable under `~/.codex/skills`, `~/.claude/skills`, or `~/.dsh/skills`.148- For Claude Code, install the same folder under `~/.claude/skills/project-change-router/` or `.claude/skills/project-change-router/`.149- For DeepSeek Harness, install the same folder under `~/.dsh/skills/project-change-router/`, `.dsh/skills/project-change-router/`, or use the repository's `dsh.bundle` plugin.150- Codex requests can invoke it as `$project-change-router`; Claude Code and DeepSeek Harness requests can invoke it as `/project-change-router`.151- DeepSeek Harness is currently a developer preview. Revalidate the filesystem and provider contracts when upgrading Harness across preview releases.152- It does not depend on a specific repository.153- The repository-local router bundle is generated on demand and is not the skill itself.154- Version 0.4 exposes architecture governance API v2, typed-finding/gate/change-flow/authorization API v1, and preserves reuse engine API v2.155- Every current report carries runtime identity: skill version, Git commit when available, installed payload digest/source, compatible bundle schemas, report/API/policy versions, parser versions, and an identity digest.156- Updating the installed skill does not bootstrap, rebuild, or overwrite an existing repository-local bundle. Bundle schema v1 remains readable; missing 0.4 precision becomes `unknown` and blocks when required instead of being fabricated or written back. Runtime fingerprints, baselines, authorization manifests, and managed artifacts live outside the repository by default.