mstar-compound-refresh(知识维护)
Load order
Read mstar-harness-core first. Path symbols → mstar-conventions. On conflict, mstar-harness-core wins.
Purpose
Knowledge documents in {KNOWLEDGE_DIR} age. Code changes, conventions evolve, patterns become obsolete. mstar-compound-refresh audits the knowledge store against the current codebase and makes it trustworthy again.
产物与操作路径
SSOT: mstar-conventions/references/artifact-storage-paths.md。本 skill 仅操作 {HARNESS_DIR}/knowledge/**/*.md + {HARNESS_DIR}/knowledge/README.md(散文,见 Phase 4)+ <repo-root>/CONCEPTS.md + {HARNESS_DIR}/status.json(引用更新;v2 中知识引用挂在 workflow snapshot plan 行 metadata.knowledge_refs,见下)。禁止操作 docs/、{PLAN_DIR}/、{ITERATION_DIR}/、{SPECS_DIR}/。
Engine check (when available): run mstar compound validate <doc-path> --knowledge-dir <dir> (or import { scopeGuard, compoundRefreshScope } from "@mstar-harness/engine" in a host hook) to resolve the allowed scope above ({HARNESS_DIR}/knowledge/**, knowledge/README.md, <repo-root>/CONCEPTS.md, {HARNESS_DIR}/status.json) and guard every write against it. On fail -> do not proceed; fix and re-run. Skill text below remains authoritative when the runtime is absent.
When to use
| Trigger |
Example |
mstar-compound detected overlapping docs |
"Two docs cover N+1 queries — consider refresh" |
| Scheduled maintenance |
"It's been a quarter, let's audit knowledge" |
| Domain refactored |
After a major module rewrite |
| Explicit user request |
/pm compound-refresh performance-issues |
| Project knowledge bootstrap |
No/stale/partial STRATEGY.md, CONCEPTS.md, or {KNOWLEDGE_DIR} — see below |
Bootstrap vs refresh
| Mode |
When |
Procedure |
| Refresh |
{KNOWLEDGE_DIR} exists; audit accuracy, merge overlaps, delete stale docs |
This skill § Process (Phases 1–6) |
| Bootstrap |
No knowledge scaffolding, or artifacts are absent/stale enough to warrant full distillation from codebase |
references/project-knowledge-bootstrap.md (7-phase: survey → STRATEGY.md → CONCEPTS.md → baseline knowledge → indexing → harness init → commit) |
Read the bootstrap reference on demand; do not paste its body into this SKILL.md.
Maintenance outcomes
For each candidate document, classify into one of five outcomes:
| Outcome |
Meaning |
Default action |
| Keep |
Still accurate and useful |
No edit; report reviewed |
| Update |
Core solution correct, references drifted |
In-place edits (paths, module names, code snippets) |
| Consolidate |
Two+ docs overlap heavily, both correct |
Merge unique content into canonical doc, delete subsumed |
| Replace |
Old doc is misleading; known better replacement exists |
Create trustworthy successor, then delete old |
| Delete |
No longer useful, applicable, or distinct |
Delete — git history preserves it |
Guardrail — rejected approaches: a captured rejected approach stays only while the losing idea remains a tempting, meaningful mistake; delete it once obsolete or no longer plausible.
Calibration: first real run of this axis — 9 size-divergent knowledge docs (36–78 lines) under {KNOWLEDGE_DIR}/architecture-patterns/ classified at fold time, all kept by future value (evidence: the knowledge-prose-folds plan ## Review Gate Summary → Task evidence); length proved not to be a criterion.
Core rules
- Evidence over opinion. Signals are inputs, not a scorecard. Use engineering judgment.
- Prefer no-write Keep. Do not update a doc just to leave a review breadcrumb.
- Match docs to reality. When code differs from doc, update the doc — not ask whether the code change was "intentional."
- Be decisive. When evidence is clear (file renamed, class moved), apply. Only ask PM when genuinely ambiguous.
- Avoid low-value churn. Don't edit for typos, polish, or cosmetic changes that don't improve accuracy.
- Delete, don't archive — except formal iteration-start §1.6 corpus hygiene (
mstar-iteration/references/iteration-corpus-hygiene.md), which moves superseded/redundant knowledge/specs to {HARNESS_DIR}/archived/knowledge|specs/. Outside that gate, git history is the archive; git log --diff-filter=D -- <path> finds deleted docs.
Not adopted: frozen-archive seal machinery, Archived: triplets, or a verifier — they contradict rule 6 (delete, don't archive; git history is the archive); do not reintroduce.
- Evaluate document-set design. Check whether two+ docs overlap and should be consolidated. Redundant docs silently drift apart.
Scope selection
Default: user-guided
- Ask PM for scope: "All knowledge docs, a specific category, or a keyword?"
- If category: narrow to
{KNOWLEDGE_DIR}/<category>/.
- If keyword: search frontmatter (
module:, tags:, problem_type:) and filenames.
PM-directed: specific scope
PM provides a scope hint (directory name, filename, module name, or keyword). Match in this order:
- Directory match under
{KNOWLEDGE_DIR}/
- Frontmatter field match
- Filename match
- Content search
Process
Phase 1: Inventory
- List all
.md files under {KNOWLEDGE_DIR}/ (excluding README.md and index files).
- Read frontmatter of each candidate.
- Group by
category / module for impact clustering.
Phase 2: Assess per doc
For each doc, check:
- Referenced code still exists? — grep for file paths, class names, function names mentioned.
- Referenced conventions still match? — check against current
AGENTS.md, CONCEPTS.md, lint configs.
- Solution still the recommended approach? — has a newer pattern superseded it?
- Overlap with other docs? — search for same module/tags to find duplicates.
- Future decision value? — rationale / alternatives considered / negative guarantees / reintroduction conditions that would still guide a future change → Keep, regardless of length. A completed decision whose body has no future leverage left (one-off fix detail, superseded mechanics) enters the Delete candidate pool. Word count and age remain discovery aids, never criteria.
Phase 3: Classify and act
Classify each doc → Keep / Update / Consolidate / Replace / Delete. Apply changes.
Phase 4: Reconcile the catalog
- For every doc whose verdict changed its metadata or lifecycle (
Update / Consolidate / Replace / Delete), update its catalog row: mstar catalog update for title/description/path/source hash and for the catalog lifecycle (active / archived / superseded), and mstar catalog link for provenance/supersession relations (identity is never patched; the revision guard is in --help). A doc deleted outside the iteration-start §1.6 archive gate leaves git history as its record — set/keep its catalog lifecycle so the row is not a silent dangling claim.
- A knowledge body with no catalog row is a completeness gap, not a pass: register it (
mstar catalog register, or reviewed mstar catalog discover + mstar catalog import) or report it. {KNOWLEDGE_DIR}/README.md index tables are not maintained as a register — README is prose.
- If a doc was linked from knowledge refs (workflow snapshot plan row
metadata.knowledge_refs / v1 root status.json metadata), update the references.
Phase 5: Report
Produce a maintenance report:
- Docs reviewed (count)
- Docs kept (count)
- Docs updated (list with what changed)
- Docs consolidated (list with which canonical doc merged into)
- Docs replaced (list with successor path)
- Docs deleted (list with reason)
- Docs flagged for PM review (ambiguous cases)
Phase 6: CONCEPTS.md reconciliation
If CONCEPTS.md exists, reconcile it with the refreshed knowledge:
- Terms mentioned in updated/replaced docs may need updating in CONCEPTS.md
- Terms no longer referenced may be candidates for removal
If CONCEPTS.md doesn't exist but knowledge docs contain qualifying domain terms, propose bootstrapping it (full repo-wide seed). Use references/concepts-vocabulary.md from mstar-compound for rules (read on demand — cross-skill path resolution via skill directory).
Cross-skill coordination
mstar-compound-refresh reads vocabulary rules from mstar-compound's references. At runtime, resolve the path from the loaded skill directory:
The CONCEPTS.md vocabulary rules are in the mstar-compound skill at:
references/concepts-vocabulary.md
Read that file from the mstar-compound skill directory before Phase 6.
NOT to do
- Do not delete docs without checking for inbound links
- Do not "archive" — delete instead
- Do not ask PM about mechanical updates (path fixes, renamed modules)
- Do not change code to match outdated docs — update docs to match code
- Do not run without PM approval for destructive actions (Delete, Replace)
Evidence
正确结果 = 每篇候选文档有明确 verdict(Keep / Update / Consolidate / Replace / Delete)并落到产物:文档改动 + catalog 行对账(Phase 4:mstar catalog update / register,生命周期 active / archived / superseded)+ 知识引用同步(workflow snapshot plan 行 knowledge_refs;v1 根 status.json legacy 引用) + 维护报告(Phase 5:reviewed / kept / updated / consolidated / replaced / deleted / flagged)+ CONCEPTS.md 对账(Phase 6)。
References
- 捕获侧规则与 CONCEPTS.md vocabulary 规则 →
mstar-compound(Phase 6 前读 references/concepts-vocabulary.md)
- 路径符号与产物存储 SSOT →
mstar-conventions(references/artifact-storage-paths.md)
1---2name: mstar-compound-refresh3description: Morning Star 知识维护与项目知识 bootstrap —— 审查 `{KNOWLEDGE_DIR}` 文档是否仍准确、去重叠合并、清理过期知识;或从代码库提炼 CONCEPTS.md、基线 knowledge 脚手架(无/残旧/空白 knowledge)。STRATEGY.md 创建委托 **`mstar-strategy`**。触发:`mstar-compound` 发现可合并文档、定期维护、项目缺 CONCEPTS.md/{KNOWLEDGE_DIR}、stale knowledge scaffolding、显式 bootstrap 请求、或显式 refresh。产出:更新/合并/删除知识文档 + 维护报告;或 bootstrap 产物(CONCEPTS.md、基线 knowledge)。4---56# mstar-compound-refresh(知识维护)78## Load order910**Read `mstar-harness-core` first.** Path symbols → **`mstar-conventions`**. On conflict, **`mstar-harness-core` wins**.1112## Purpose1314Knowledge documents in `{KNOWLEDGE_DIR}` age. Code changes, conventions evolve, patterns become obsolete. `mstar-compound-refresh` audits the knowledge store against the current codebase and makes it trustworthy again.1516## 产物与操作路径1718**SSOT**: `mstar-conventions/references/artifact-storage-paths.md`。本 skill 仅操作 `{HARNESS_DIR}/knowledge/**/*.md` + `{HARNESS_DIR}/knowledge/README.md`(**散文**,见 Phase 4)+ `<repo-root>/CONCEPTS.md` + `{HARNESS_DIR}/status.json`(引用更新;v2 中知识引用挂在 workflow snapshot plan 行 `metadata.knowledge_refs`,见下)。**禁止**操作 `docs/`、`{PLAN_DIR}/`、`{ITERATION_DIR}/`、`{SPECS_DIR}/`。1920> **Engine check (when available):** run `mstar compound validate <doc-path> --knowledge-dir <dir>` (or `import { scopeGuard, compoundRefreshScope } from "@mstar-harness/engine"` in a host hook) to resolve the allowed scope above (`{HARNESS_DIR}/knowledge/**`, `knowledge/README.md`, `<repo-root>/CONCEPTS.md`, `{HARNESS_DIR}/status.json`) and guard every write against it. On `fail` -> do not proceed; fix and re-run. Skill text below remains authoritative when the runtime is absent.2122## When to use2324| Trigger | Example |25|---------|---------|26| `mstar-compound` detected overlapping docs | "Two docs cover N+1 queries — consider refresh" |27| Scheduled maintenance | "It's been a quarter, let's audit knowledge" |28| Domain refactored | After a major module rewrite |29| Explicit user request | `/pm compound-refresh performance-issues` |30| **Project knowledge bootstrap** | No/stale/partial `STRATEGY.md`, `CONCEPTS.md`, or `{KNOWLEDGE_DIR}` — see below |3132## Bootstrap vs refresh3334| Mode | When | Procedure |35|------|------|-----------|36| **Refresh** | `{KNOWLEDGE_DIR}` exists; audit accuracy, merge overlaps, delete stale docs | This skill § Process (Phases 1–6) |37| **Bootstrap** | No knowledge scaffolding, or artifacts are absent/stale enough to warrant full distillation from codebase | **`references/project-knowledge-bootstrap.md`** (7-phase: survey → STRATEGY.md → CONCEPTS.md → baseline knowledge → indexing → harness init → commit) |3839Read the bootstrap reference on demand; do not paste its body into this SKILL.md.4041## Maintenance outcomes4243For each candidate document, classify into one of five outcomes:4445| Outcome | Meaning | Default action |46|---------|---------|----------------|47| **Keep** | Still accurate and useful | No edit; report reviewed |48| **Update** | Core solution correct, references drifted | In-place edits (paths, module names, code snippets) |49| **Consolidate** | Two+ docs overlap heavily, both correct | Merge unique content into canonical doc, delete subsumed |50| **Replace** | Old doc is misleading; known better replacement exists | Create trustworthy successor, then delete old |51| **Delete** | No longer useful, applicable, or distinct | Delete — git history preserves it |5253> **Guardrail — rejected approaches:** a captured rejected approach stays only while the losing idea remains a tempting, meaningful mistake; delete it once obsolete or no longer plausible.54> **Calibration:** first real run of this axis — 9 size-divergent knowledge docs (36–78 lines) under `{KNOWLEDGE_DIR}/architecture-patterns/` classified at fold time, all kept by future value (evidence: the knowledge-prose-folds plan `## Review Gate Summary` → Task evidence); length proved not to be a criterion.5556## Core rules57581. **Evidence over opinion.** Signals are inputs, not a scorecard. Use engineering judgment.592. **Prefer no-write Keep.** Do not update a doc just to leave a review breadcrumb.603. **Match docs to reality.** When code differs from doc, update the doc — not ask whether the code change was "intentional."614. **Be decisive.** When evidence is clear (file renamed, class moved), apply. Only ask PM when genuinely ambiguous.625. **Avoid low-value churn.** Don't edit for typos, polish, or cosmetic changes that don't improve accuracy.636. **Delete, don't archive** — **except** formal **iteration-start** §1.6 corpus hygiene (`mstar-iteration/references/iteration-corpus-hygiene.md`), which **moves** superseded/redundant knowledge/specs to `{HARNESS_DIR}/archived/knowledge|specs/`. Outside that gate, git history is the archive; `git log --diff-filter=D -- <path>` finds deleted docs.64 > **Not adopted:** frozen-archive seal machinery, `Archived:` triplets, or a verifier — they contradict rule 6 (delete, don't archive; git history is the archive); do not reintroduce.657. **Evaluate document-set design.** Check whether two+ docs overlap and should be consolidated. Redundant docs silently drift apart.6667## Scope selection6869### Default: user-guided70711. Ask PM for scope: "All knowledge docs, a specific category, or a keyword?"722. If category: narrow to `{KNOWLEDGE_DIR}/<category>/`.733. If keyword: search frontmatter (`module:`, `tags:`, `problem_type:`) and filenames.7475### PM-directed: specific scope7677PM provides a scope hint (directory name, filename, module name, or keyword). Match in this order:781. Directory match under `{KNOWLEDGE_DIR}/`792. Frontmatter field match803. Filename match814. Content search8283## Process8485### Phase 1: Inventory86871. List all `.md` files under `{KNOWLEDGE_DIR}/` (excluding `README.md` and index files).882. Read frontmatter of each candidate.893. Group by `category` / `module` for impact clustering.9091### Phase 2: Assess per doc9293For each doc, check:94951. **Referenced code still exists?** — grep for file paths, class names, function names mentioned.962. **Referenced conventions still match?** — check against current `AGENTS.md`, `CONCEPTS.md`, lint configs.973. **Solution still the recommended approach?** — has a newer pattern superseded it?984. **Overlap with other docs?** — search for same module/tags to find duplicates.995. **Future decision value?** — rationale / alternatives considered / negative guarantees / reintroduction conditions that would still guide a future change → **Keep, regardless of length**. A completed decision whose body has no future leverage left (one-off fix detail, superseded mechanics) enters the Delete candidate pool. Word count and age remain discovery aids, never criteria.100101### Phase 3: Classify and act102103Classify each doc → Keep / Update / Consolidate / Replace / Delete. Apply changes.104105### Phase 4: Reconcile the catalog1061071. For every doc whose verdict changed its metadata or lifecycle (`Update` / `Consolidate` / `Replace` / `Delete`), update its catalog row: `mstar catalog update` for title/description/path/source hash and for the catalog lifecycle (`active` / `archived` / `superseded`), and `mstar catalog link` for provenance/supersession relations (identity is never patched; the revision guard is in `--help`). A doc deleted outside the iteration-start §1.6 archive gate leaves git history as its record — set/keep its catalog lifecycle so the row is not a silent dangling claim.1082. A knowledge body with **no** catalog row is a completeness gap, not a pass: register it (`mstar catalog register`, or reviewed `mstar catalog discover` + `mstar catalog import`) or report it. `{KNOWLEDGE_DIR}/README.md` index tables are **not** maintained as a register — README is prose.1093. If a doc was linked from knowledge refs (workflow snapshot plan row `metadata.knowledge_refs` / v1 root `status.json` metadata), update the references.110111### Phase 5: Report112113Produce a maintenance report:114- Docs reviewed (count)115- Docs kept (count)116- Docs updated (list with what changed)117- Docs consolidated (list with which canonical doc merged into)118- Docs replaced (list with successor path)119- Docs deleted (list with reason)120- Docs flagged for PM review (ambiguous cases)121122### Phase 6: CONCEPTS.md reconciliation123124If `CONCEPTS.md` exists, reconcile it with the refreshed knowledge:125- Terms mentioned in updated/replaced docs may need updating in CONCEPTS.md126- Terms no longer referenced may be candidates for removal127128If `CONCEPTS.md` doesn't exist but knowledge docs contain qualifying domain terms, propose bootstrapping it (full repo-wide seed). Use `references/concepts-vocabulary.md` from `mstar-compound` for rules (read on demand — cross-skill path resolution via skill directory).129130## Cross-skill coordination131132`mstar-compound-refresh` reads vocabulary rules from `mstar-compound`'s references. At runtime, resolve the path from the loaded skill directory:133134```135The CONCEPTS.md vocabulary rules are in the mstar-compound skill at:136references/concepts-vocabulary.md137Read that file from the mstar-compound skill directory before Phase 6.138```139140## NOT to do141142- Do not delete docs without checking for inbound links143- Do not "archive" — delete instead144- Do not ask PM about mechanical updates (path fixes, renamed modules)145- Do not change code to match outdated docs — update docs to match code146- Do not run without PM approval for destructive actions (Delete, Replace)147148## Evidence149150正确结果 = 每篇候选文档有明确 verdict(Keep / Update / Consolidate / Replace / Delete)并落到产物:文档改动 + catalog 行对账(Phase 4:`mstar catalog update` / `register`,生命周期 `active` / `archived` / `superseded`)+ 知识引用同步(workflow snapshot plan 行 `knowledge_refs`;v1 根 `status.json` legacy 引用) + 维护报告(Phase 5:reviewed / kept / updated / consolidated / replaced / deleted / flagged)+ `CONCEPTS.md` 对账(Phase 6)。151152## References153154- 捕获侧规则与 CONCEPTS.md vocabulary 规则 → **`mstar-compound`**(Phase 6 前读 `references/concepts-vocabulary.md`)155- 路径符号与产物存储 SSOT → **`mstar-conventions`**(`references/artifact-storage-paths.md`)