Maintenance Capsule
Build the smallest repository-local project kernel that lets a fresh agent recover the project's identity, verify current reality, and continue from the right place without freezing the implementation.
Standardize what must be remembered, not how every project must be built. The capsule is a navigation and decision layer; the repository, Git state, tests, deployed behavior, and other current sources remain the operational truth.
Choose a mode
- init: The repository has no capsule. Inspect it and create the minimum useful capsule.
- audit: A capsule or project instructions exist. Find duplication, stale facts, contradictions, and implementation-level overconstraint; remove what does not change decisions.
- refresh: The project goal, architecture, or stable baseline changed. Update the capsule to describe the new truth instead of appending history.
- resume: Work continues in a new window, model, person, or stage. Read the capsule, reconcile it with current reality, identify the current stage and next minimal action, then continue or report discrepancies before changing files.
Infer the mode from the request and repository. Do not ask when the evidence makes the choice clear.
Inspect before writing
Read the real repository first:
- Check Git status and preserve unrelated user changes.
- Read existing repository instructions, README, primary entry points, tests, and deployment configuration.
- Inspect current outputs or interfaces when user-visible correctness matters.
- Identify the source of truth for facts that can drift.
- Distinguish enduring intent from temporary state and implementation detail.
Do not create a capsule from the user's prompt alone when the repository can answer the question.
Apply the narrow waist
Keep five cross-environment invariants:
- Goal: What outcome must the project create, and for whom?
- Boundaries: What truths, non-goals, safety limits, or identity must not be lost?
- Evidence: What observable checks prove improvement or regression?
- Stable baseline: What accepted artifact, version, or live target is the comparison or rollback point?
- Current handoff: What stage is active, what is unfinished or unverified, and what is the next minimal action?
Leave implementation choices open unless a specific path is required for safety, compatibility, or deterministic correctness.
Do not confuse the stable baseline with work in progress. A baseline is accepted evidence; current handoff state may be incomplete, uncertain, or blocked.
Create the minimum capsule
Default to one file:
GOAL.md
Add only when earned by the project:
AGENTS.md # repository-local rules that change agent behavior
HANDOFF.md # handoff state too large or volatile for GOAL.md
observable baseline # evidence with real comparison value
GOAL.md
Keep it concise and decision-bearing. Include:
- one-sentence project goal;
- 3–5 success criteria;
- the smallest set of narrow-waist boundaries;
- an upgrade method that changes one primary variable per iteration;
- project-specific acceptance evidence;
- the current stable baseline, if one exists;
- a short current handoff: stage, completed state, unfinished or unverified items, blockers, and next minimal action.
Treat GOAL.md as the project's identity card plus a short baton. Keep the handoff section compact and replace stale state instead of appending a diary. If it becomes longer than roughly 10–20 lines, changes much more frequently than project identity, or contains substantial temporary detail, move it to HANDOFF.md and leave a pointer in GOAL.md.
For comparisons, use improved / unchanged / regressed + evidence. Avoid numeric scores without a calibrated scale. Require critical identity and engineering quality not to regress, and require at least one evidenced improvement before release.
AGENTS.md
Create or retain repository AGENTS.md only when local rules materially change decisions or protect the project. Host-wide rules alone are sufficient otherwise.
Keep repository instructions shorter than the goal document. When needed, it should:
- tell agents to read
GOAL.md and inspect current reality first;
- protect source-of-truth and safety constraints;
- require scoped changes and real verification;
- preserve the user's commit, push, deployment, and destructive-action boundaries.
Point to GOAL.md; do not duplicate it. Prefer 4–7 rules.
HANDOFF.md
Create HANDOFF.md only when the short baton no longer fits cleanly in GOAL.md. Keep only operational continuation state:
- current stage and last verified result;
- unfinished and explicitly unverified work;
- blockers or external dependencies;
- next minimal action;
- temporary safety warnings needed by the next agent.
Do not duplicate project identity, enduring boundaries, history, or general process rules. Replace resolved state and use Git or decision records for history.
Observable baseline
Choose evidence by project type:
- UI: one approved screenshot or rendered artifact;
- API: contract tests and representative HTTP responses;
- CLI: golden commands and outputs;
- data pipeline: audit report or small golden dataset;
- library: public API tests;
- documentation: representative reader questions and expected answers.
Reuse verified artifacts when available. Do not manufacture a baseline merely to satisfy the structure. Add multiple baselines only when each protects a materially different risk.
Audit by deletion
For every capsule statement, ask:
- Does it change a future decision?
- Is it enduring rather than temporary?
- Is it already enforced by code, tests, or Git?
- Does it duplicate another rule?
- Does it protect an outcome, or merely freeze an implementation?
Delete or merge statements that fail these tests. Do not add repository rules, directory blueprints, separate handoff files, changelogs, or process checklists by default. Add them only when project complexity creates a demonstrated decision, safety, verification, or recovery need.
When existing files would be semantically overwritten, present the intended diff before editing unless the user explicitly authorized direct execution.
Refresh without accumulation
After a milestone:
- Re-check the repository and external source of truth.
- Replace stale current-state facts; do not preserve them as history in the capsule.
- Update the baseline only after the new result is accepted.
- Refresh the short handoff after a meaningful phase boundary; split or merge
HANDOFF.md according to its current size and volatility.
- Keep project history in Git, releases, or dedicated decision records—not in
GOAL.md or HANDOFF.md.
- Re-run the deletion audit and validation.
Resume without archaeology
For resume mode:
- Read
GOAL.md, then optional repository AGENTS.md and HANDOFF.md.
- Check the minimum real state needed to validate the handoff: Git status, relevant entry points, tests, outputs, or external source of truth.
- State the recovered goal, active stage, discrepancies, and next minimal action.
- If capsule and reality conflict, treat reality as evidence and pause before changing project identity, boundaries, or accepted baseline.
- Continue under the existing acceptance standard; do not rebuild project context from scratch unless the capsule demonstrably fails.
Completion check
Before handing off:
- verify a fresh agent can identify the goal, boundaries, evidence, stable baseline, current stage, and next minimal action;
- verify continuation does not require a full-repository archaeology pass or repeated background questions;
- confirm implementation freedom remains explicit;
- run relevant project validation;
- show the capsule diff and what was removed;
- do not commit, push, deploy, tag, or overwrite existing files beyond the user's authorization.
1---2name: maintenance-capsule3description: Create, audit, refresh, or resume from a repository-local maintenance capsule: a goal-oriented standard project kernel that preserves identity, boundaries, acceptance evidence, stable baseline, and current handoff state across windows, models, people, and environments. Use when the user says 基因胶囊, 维护胶囊, 项目胶囊, 保存项目, 保存项目上下文, 保存当前项目状态, 固定项目, 固定项目风格, 固定当前项目状态, 项目封存, 项目交接, 换窗口继续, 接着做, 以后方便维护, 稳定风格, 维护升级, or asks to create or refine GOAL.md, optional repository AGENTS.md or HANDOFF.md, reduce bloated project rules, preserve a project for later continuation, or quickly recover where work stopped. Treat save, preserve, stabilize, handoff, and cross-window continuation requests as capsule requests by default; do not trigger on 固定 alone, ordinary code maintenance, a bug fix, or a one-off task with no continuity need.4---56# Maintenance Capsule78Build the smallest repository-local project kernel that lets a fresh agent recover the project's identity, verify current reality, and continue from the right place without freezing the implementation.910Standardize what must be remembered, not how every project must be built. The capsule is a navigation and decision layer; the repository, Git state, tests, deployed behavior, and other current sources remain the operational truth.1112## Choose a mode1314- **init**: The repository has no capsule. Inspect it and create the minimum useful capsule.15- **audit**: A capsule or project instructions exist. Find duplication, stale facts, contradictions, and implementation-level overconstraint; remove what does not change decisions.16- **refresh**: The project goal, architecture, or stable baseline changed. Update the capsule to describe the new truth instead of appending history.17- **resume**: Work continues in a new window, model, person, or stage. Read the capsule, reconcile it with current reality, identify the current stage and next minimal action, then continue or report discrepancies before changing files.1819Infer the mode from the request and repository. Do not ask when the evidence makes the choice clear.2021## Inspect before writing2223Read the real repository first:24251. Check Git status and preserve unrelated user changes.262. Read existing repository instructions, README, primary entry points, tests, and deployment configuration.273. Inspect current outputs or interfaces when user-visible correctness matters.284. Identify the source of truth for facts that can drift.295. Distinguish enduring intent from temporary state and implementation detail.3031Do not create a capsule from the user's prompt alone when the repository can answer the question.3233## Apply the narrow waist3435Keep five cross-environment invariants:36371. **Goal**: What outcome must the project create, and for whom?382. **Boundaries**: What truths, non-goals, safety limits, or identity must not be lost?393. **Evidence**: What observable checks prove improvement or regression?404. **Stable baseline**: What accepted artifact, version, or live target is the comparison or rollback point?415. **Current handoff**: What stage is active, what is unfinished or unverified, and what is the next minimal action?4243Leave implementation choices open unless a specific path is required for safety, compatibility, or deterministic correctness.4445Do not confuse the stable baseline with work in progress. A baseline is accepted evidence; current handoff state may be incomplete, uncertain, or blocked.4647## Create the minimum capsule4849Default to one file:5051```text52GOAL.md53```5455Add only when earned by the project:5657```text58AGENTS.md # repository-local rules that change agent behavior59HANDOFF.md # handoff state too large or volatile for GOAL.md60observable baseline # evidence with real comparison value61```6263### GOAL.md6465Keep it concise and decision-bearing. Include:6667- one-sentence project goal;68- 3–5 success criteria;69- the smallest set of narrow-waist boundaries;70- an upgrade method that changes one primary variable per iteration;71- project-specific acceptance evidence;72- the current stable baseline, if one exists;73- a short current handoff: stage, completed state, unfinished or unverified items, blockers, and next minimal action.7475Treat `GOAL.md` as the project's identity card plus a short baton. Keep the handoff section compact and replace stale state instead of appending a diary. If it becomes longer than roughly 10–20 lines, changes much more frequently than project identity, or contains substantial temporary detail, move it to `HANDOFF.md` and leave a pointer in `GOAL.md`.7677For comparisons, use **improved / unchanged / regressed + evidence**. Avoid numeric scores without a calibrated scale. Require critical identity and engineering quality not to regress, and require at least one evidenced improvement before release.7879### AGENTS.md8081Create or retain repository `AGENTS.md` only when local rules materially change decisions or protect the project. Host-wide rules alone are sufficient otherwise.8283Keep repository instructions shorter than the goal document. When needed, it should:8485- tell agents to read `GOAL.md` and inspect current reality first;86- protect source-of-truth and safety constraints;87- require scoped changes and real verification;88- preserve the user's commit, push, deployment, and destructive-action boundaries.8990Point to `GOAL.md`; do not duplicate it. Prefer 4–7 rules.9192### HANDOFF.md9394Create `HANDOFF.md` only when the short baton no longer fits cleanly in `GOAL.md`. Keep only operational continuation state:9596- current stage and last verified result;97- unfinished and explicitly unverified work;98- blockers or external dependencies;99- next minimal action;100- temporary safety warnings needed by the next agent.101102Do not duplicate project identity, enduring boundaries, history, or general process rules. Replace resolved state and use Git or decision records for history.103104### Observable baseline105106Choose evidence by project type:107108- UI: one approved screenshot or rendered artifact;109- API: contract tests and representative HTTP responses;110- CLI: golden commands and outputs;111- data pipeline: audit report or small golden dataset;112- library: public API tests;113- documentation: representative reader questions and expected answers.114115Reuse verified artifacts when available. Do not manufacture a baseline merely to satisfy the structure. Add multiple baselines only when each protects a materially different risk.116117## Audit by deletion118119For every capsule statement, ask:120121- Does it change a future decision?122- Is it enduring rather than temporary?123- Is it already enforced by code, tests, or Git?124- Does it duplicate another rule?125- Does it protect an outcome, or merely freeze an implementation?126127Delete or merge statements that fail these tests. Do not add repository rules, directory blueprints, separate handoff files, changelogs, or process checklists by default. Add them only when project complexity creates a demonstrated decision, safety, verification, or recovery need.128129When existing files would be semantically overwritten, present the intended diff before editing unless the user explicitly authorized direct execution.130131## Refresh without accumulation132133After a milestone:1341351. Re-check the repository and external source of truth.1362. Replace stale current-state facts; do not preserve them as history in the capsule.1373. Update the baseline only after the new result is accepted.1384. Refresh the short handoff after a meaningful phase boundary; split or merge `HANDOFF.md` according to its current size and volatility.1395. Keep project history in Git, releases, or dedicated decision records—not in `GOAL.md` or `HANDOFF.md`.1406. Re-run the deletion audit and validation.141142## Resume without archaeology143144For resume mode:1451461. Read `GOAL.md`, then optional repository `AGENTS.md` and `HANDOFF.md`.1472. Check the minimum real state needed to validate the handoff: Git status, relevant entry points, tests, outputs, or external source of truth.1483. State the recovered goal, active stage, discrepancies, and next minimal action.1494. If capsule and reality conflict, treat reality as evidence and pause before changing project identity, boundaries, or accepted baseline.1505. Continue under the existing acceptance standard; do not rebuild project context from scratch unless the capsule demonstrably fails.151152## Completion check153154Before handing off:155156- verify a fresh agent can identify the goal, boundaries, evidence, stable baseline, current stage, and next minimal action;157- verify continuation does not require a full-repository archaeology pass or repeated background questions;158- confirm implementation freedom remains explicit;159- run relevant project validation;160- show the capsule diff and what was removed;161- do not commit, push, deploy, tag, or overwrite existing files beyond the user's authorization.