Context Upgrade
Upgrade and layout-repair work is a controlled operator workflow. It must be invoked
explicitly by the user when context-harness itself has an update, a local fleet
refresh is requested, installed copies need validation, or a current-v3 layout
needs repair. Do not invoke implicitly just because a repo contains
context-harness files.
Prefer model-led edits, explicit verification, and conservative deployment over
broad rewrites.
Start
- Read the target repo's
NOW.md, then relevant CONTEXT.md sections,
especially ## Operating Constraints, ## Workflow,
## Relationships, and ## Learned Patterns.
- Read
PLAN.md when it contains migration findings, decisions, skipped
repos, or previous verification output.
- Identify the upgrade scope:
- canonical source repo only
- one target project
- local project fleet refresh
- installed skill deployment targets
- current-v3 layout repair
- Inspect the current worktree before edits. Treat unrelated changes as user
work and do not revert them.
Upgrade Principles
- Keep
AGENTS.md small: activation contract plus generated CONTEXT.md
index. Do not duplicate durable context there.
- Preserve project-specific context. Replace only stale harness boilerplate,
schema markers, generated index blocks, and runtime scripts that are meant to
be managed.
- Prefer model-led edits over blanket migration scripts when local conventions
may matter. Use scripts for detection, dry runs, refreshes, and repeatable
mechanical changes.
- Include dirty target repos in fleet refreshes, but classify candidate paths,
preserve unrelated work byte-for-byte, and record conflicts instead of forcing
overwrites. Never reset, restore, clean, stash, commit, or push user work.
- Keep the preferred skill set small. Add or split a skill only when the
invocation intent is genuinely different from existing skills.
- Modify canonical skill source in this repository. Treat installed copies and
symlinked deployments as outputs unless the user explicitly asks for a local
override.
- Route task-local findings and decisions to
PLAN.md; durable upgrade lessons
to CONTEXT.md; closeout state to NOW.md.
Source Upgrade
When changing context-harness itself:
- Define the user-visible behavior and compatibility target before editing.
- Update the canonical skill files, templates, scripts, README text, and tests
that directly support the behavior.
- Keep the supported layout current-v3 only unless the user explicitly chooses
a new schema.
- If
CONTEXT.md changed, run:
node scripts/context-index.js update
- Verify source changes with:
tests/run-all.sh
node scripts/context-index.js check
Project Layout Repair
Use this only when the user explicitly asks to repair or refresh an existing
context-harness project. context-init is only for repositories with no
context-harness layout.
For a single repo or fleet refresh:
- Inspect the current files and
git status first. Treat unrelated changes as
user work.
- Preserve project-specific context. Replace only stale harness boilerplate,
schema markers, generated index blocks, and runtime scripts that are meant to
be managed.
- For partial or custom contexts, make model-led edits instead of forcing a
generated layout.
- Refresh generated indexes and local runtime scripts when the repair requires
it.
- Re-run
node scripts/context-index.js check in representative targets.
Fleet Refresh Guardrails
For local fleet refreshes, inspect every target's status and include dirty repos
under managed-file boundaries. Capture pre/post state, preserve unrelated dirty
paths, and record managed local conflicts rather than overwriting them. Refresh
only managed harness boilerplate/runtime, generated indexes, and unambiguous
schema markers. Run node scripts/context-index.js update and
node scripts/context-index.js check in each updated target, keep a
machine-readable release ledger of changed/unchanged/failed targets, and do not
let fleet work replace a target project's product task.
Deployment
After canonical source changes that should affect local harnesses:
- Deploy through the user's normal deployment layer. In this repo, local
deployment is usually via agent-nexus:
nexus sync --yes
nexus doctor
- Verify representative installed copies or symlinks when frontmatter,
invocability, hook behavior, or skill routing changed.
- Tell the user when IDEs or agent hosts need restarting to pick up new
frontmatter or skill metadata.
Closeout
Before finishing:
- Summarize source files changed, target projects repaired/refreshed, skipped repos, and
any deployment targets updated.
- Record remaining fleet cleanup or unsupported targets in
PLAN.md.
- Promote only durable lessons to
CONTEXT.md.
- Update
NOW.md with current focus, blockers, next step, timestamp, and
touched files.
- If the update made future catch-up materially easier through consolidation,
use
context-maintain Dream/Compact rules and log only actual edits.
Never store raw transcripts, secrets, raw API/web output, or bulky migration
logs in context files.
1---2name: context-upgrade3description: Plan, implement, validate, and deploy context-harness source upgrades, local fleet refreshes, installed skill deployments, or explicit current-v3 layout repairs. Use when the user asks to upgrade context-harness itself, repair stale or partial context files, package lessons from an upgrade, or verify deployment targets.4---56# Context Upgrade78Upgrade and layout-repair work is a controlled operator workflow. It must be invoked9explicitly by the user when context-harness itself has an update, a local fleet10refresh is requested, installed copies need validation, or a current-v3 layout11needs repair. Do not invoke implicitly just because a repo contains12context-harness files.1314Prefer model-led edits, explicit verification, and conservative deployment over15broad rewrites.1617## Start18191. Read the target repo's `NOW.md`, then relevant `CONTEXT.md` sections,20 especially `## Operating Constraints`, `## Workflow`,21 `## Relationships`, and `## Learned Patterns`.222. Read `PLAN.md` when it contains migration findings, decisions, skipped23 repos, or previous verification output.243. Identify the upgrade scope:25 - canonical source repo only26 - one target project27 - local project fleet refresh28 - installed skill deployment targets29 - current-v3 layout repair304. Inspect the current worktree before edits. Treat unrelated changes as user31 work and do not revert them.3233## Upgrade Principles3435- Keep `AGENTS.md` small: activation contract plus generated `CONTEXT.md`36 index. Do not duplicate durable context there.37- Preserve project-specific context. Replace only stale harness boilerplate,38 schema markers, generated index blocks, and runtime scripts that are meant to39 be managed.40- Prefer model-led edits over blanket migration scripts when local conventions41 may matter. Use scripts for detection, dry runs, refreshes, and repeatable42 mechanical changes.43- Include dirty target repos in fleet refreshes, but classify candidate paths,44 preserve unrelated work byte-for-byte, and record conflicts instead of forcing45 overwrites. Never reset, restore, clean, stash, commit, or push user work.46- Keep the preferred skill set small. Add or split a skill only when the47 invocation intent is genuinely different from existing skills.48- Modify canonical skill source in this repository. Treat installed copies and49 symlinked deployments as outputs unless the user explicitly asks for a local50 override.51- Route task-local findings and decisions to `PLAN.md`; durable upgrade lessons52 to `CONTEXT.md`; closeout state to `NOW.md`.5354## Source Upgrade5556When changing context-harness itself:57581. Define the user-visible behavior and compatibility target before editing.592. Update the canonical skill files, templates, scripts, README text, and tests60 that directly support the behavior.613. Keep the supported layout current-v3 only unless the user explicitly chooses62 a new schema.634. If `CONTEXT.md` changed, run:6465```bash66node scripts/context-index.js update67```68695. Verify source changes with:7071```bash72tests/run-all.sh73node scripts/context-index.js check74```7576## Project Layout Repair7778Use this only when the user explicitly asks to repair or refresh an existing79context-harness project. `context-init` is only for repositories with no80context-harness layout.8182For a single repo or fleet refresh:83841. Inspect the current files and `git status` first. Treat unrelated changes as85 user work.862. Preserve project-specific context. Replace only stale harness boilerplate,87 schema markers, generated index blocks, and runtime scripts that are meant to88 be managed.893. For partial or custom contexts, make model-led edits instead of forcing a90 generated layout.914. Refresh generated indexes and local runtime scripts when the repair requires92 it.935. Re-run `node scripts/context-index.js check` in representative targets.9495## Fleet Refresh Guardrails9697For local fleet refreshes, inspect every target's status and include dirty repos98under managed-file boundaries. Capture pre/post state, preserve unrelated dirty99paths, and record managed local conflicts rather than overwriting them. Refresh100only managed harness boilerplate/runtime, generated indexes, and unambiguous101schema markers. Run `node scripts/context-index.js update` and102`node scripts/context-index.js check` in each updated target, keep a103machine-readable release ledger of changed/unchanged/failed targets, and do not104let fleet work replace a target project's product task.105106## Deployment107108After canonical source changes that should affect local harnesses:1091101. Deploy through the user's normal deployment layer. In this repo, local111 deployment is usually via agent-nexus:112113```bash114nexus sync --yes115nexus doctor116```1171182. Verify representative installed copies or symlinks when frontmatter,119 invocability, hook behavior, or skill routing changed.1203. Tell the user when IDEs or agent hosts need restarting to pick up new121 frontmatter or skill metadata.122123## Closeout124125Before finishing:1261271. Summarize source files changed, target projects repaired/refreshed, skipped repos, and128 any deployment targets updated.1292. Record remaining fleet cleanup or unsupported targets in `PLAN.md`.1303. Promote only durable lessons to `CONTEXT.md`.1314. Update `NOW.md` with current focus, blockers, next step, timestamp, and132 touched files.1335. If the update made future catch-up materially easier through consolidation,134 use `context-maintain` Dream/Compact rules and log only actual edits.135136Never store raw transcripts, secrets, raw API/web output, or bulky migration137logs in context files.