with one click
edc-update-impl
// Incrementally updates .context/ files based on branch changes (v2 layout)
// Incrementally updates .context/ files based on branch changes (v2 layout)
[HINT] Download the complete skill directory including SKILL.md and all related files
| name | edc-update-impl |
| description | Incrementally updates .context/ files based on branch changes (v2 layout) |
Arguments: optional --base <ref> for comparison reference and repeatable --ignore <glob> to exclude files from this run. Default base: auto-detect merge base with main/master.
Before computing changed files, resolve ignore patterns in this order:
--ignore <glob> arguments were provided, use only those patterns..edcignore exists in the repo root, read non-empty, non-comment lines from it.Apply ignore rules to repo-relative file paths before mapping changed files to modules.
Run this exact precondition check first:
bash plugins/edc/scripts/edc-clean-slate.sh --check
rc=$?
rc == 11 → preconditions met, proceed.rc == 10 → v1 leftovers or partial v2 detected. ABORT this skill and route back to edc-build-impl for a full build (the build skill's Routing section will handle the wipe). Do not attempt an incremental update on top of a broken layout — it will silently no-op and leave the user with an unusable context.rc == 0 with no .context/ → no context exists. ABORT and tell the caller to invoke edc-build-impl first..context/manifest.json and .context/index.md must both exist. manifest.json is the only routing/policy contract in the v2 layout. If either is missing after a rc == 11 check, that is an invariant violation — fail loudly.
If git diff --name-only "$BASE"..HEAD returns no source-file changes (only .context/ or unrelated tracked paths), the update is a no-op. Skip to Step 10 (Validate) and exit 0 — but only after confirming the layout is still healthy. Never declare success when manifest.json is missing or invalid.
# Auto-detect base if not provided
BASE=$(git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null)
# Get changed files since base
git diff --name-only "$BASE"..HEAD
Read .context/manifest.json to get sourceCommit (last analyzed commit) and modules[] with their name, doc, and match rules.
Map each changed file to its module by invoking the shared router:
bash plugins/edc/scripts/edc-route.sh .context/manifest.json <file-path>
edc-route.sh exits 0 with the module name on stdout when one module wins, exit 1 when no module matches (file is unmapped — check unmapped.allowedGlobs in the manifest before treating as an error), or exit 2 when multiple modules tie. Do not reimplement routing here.
Collect the set of affected modules. Also include any modules that .context/modules/<name>.md documents as coupled to an affected module (read the cross-module coupling sections).
edc-build-plan.sh expects the FULL module list on stdin and a comma-separated --changed filter as a single argument. Build the input from the existing manifest, then pipe it in:
# Comma-join the affected module names (no spaces)
CHANGED="$(IFS=,; echo "${affected[*]}")"
# Project the manifest's modules[] into the script's expected {name, paths} shape,
# then pipe and filter
jq '{
modules: [
.modules[] | {
name,
paths: ((.match.exactFiles // []) + (.match.prefixes // []) + (.match.globs // []))
}
]
}' .context/manifest.json \
| bash plugins/edc/scripts/edc-build-plan.sh --changed "$CHANGED"
Execute the resulting module-context task list the same way as the build flow (see edc-build-impl step 2): spawn one clean subagent per task using the embedded prompt verbatim, run in parallel batches, collect summaries. Do not interpret, edit, or skip tasks.
.context/modules/<name>.md filesRewrite each affected module's .context/modules/<name>.md with the new analysis. Preserve the file format (<!-- generated by /edc:edc-build --> header).
If the manifest's modules[] set has changed (modules were renamed, merged, or dropped):
.context/modules/, check whether its name corresponds to a module still listed in the post-update manifest's modules[].doc..context/modules/<name>.md whose module no longer exists in the manifest.This keeps the on-disk module set in sync with manifest.modules[]. Do not delete .context/modules/ itself.
.context/reports/issues.mdRe-read all .context/modules/*.md files. Rebuild .context/reports/issues.md from scratch:
.context/reports/complexity.md if affectedIf any changed module's deep-context analysis surfaced new overengineering / bloat / duplication signals (or invalidated existing ones), refresh .context/reports/complexity.md to reflect the current state. Otherwise leave it alone.
.context/index.md if neededRe-read all .context/modules/*.md files. Check if any of these changed:
If any changed, rewrite .context/index.md (preserving the ## heading requirement). If not, leave it alone.
.context/manifest.jsonRe-author the LLM-owned portion of the manifest (only fields that changed: modules[] if modules were added/removed/renamed, unmapped.allowedGlobs if coverage shifted). Preserve policy.defaultMode from the existing .context/manifest.json — it may have been set by edc mode advisory|inject and rebuilds must not revert that choice. Likewise preserve any other operator-authored policy.* fields (guardedTools, discoveryGatedOnIndex, bootstrapAlwaysReadable). Do not populate generatedAt, sourceCommit, or coverage.* — the post-step owns those.
Pipe the partial manifest through the deterministic generator to refresh coverage.* and sourceCommit:
cat /tmp/partial-manifest.json | bash plugins/edc/scripts/edc-manifest.sh > .context/manifest.json
A non-zero exit from edc-manifest.sh is an update failure — surface it instead of writing a hand-edited manifest.
After the update, verify the v2 layout still holds:
.context/manifest.json parses, schemaVersion == 2, and every modules[].doc resolves to an existing file.context/modules/ for modules dropped from the manifest.context/index.md contains at least one ## heading.context/reports/issues.md and .context/reports/complexity.md existIf any check fails, surface the failure; do not silently continue. edc doctor is the canonical end-to-end validator.