Task Continuity
Associate task state with a Task / Project, not with a single Conversation. The goal is to restore 'why we are doing it, where we are, and what is next' using a minimal working set — not by saving the entire chat history.
Working Boundaries
- By default, use
.task-memory/in the project root, unless the user has specified another directory. - The first version only uses Markdown files; do not introduce databases, embeddings, background services, global knowledge promotion, or automatic Git commits.
- Do not proactively modify business code. Whether memory files are included in Git is up to the user or project rules.
- The user's current explicit instruction has the highest authority; no memory can override it.
- Initial activation must come from an explicit invocation; once the project has a valid
HANDOFF, subsequent sessions can auto-restore.
When first setting up a project, reviewing existing progress, or configuring automatic restoration, you must read references/adoption.md. To create or verify file structure, fields, numbering, sources, and compression rules, read references/memory-protocol.md. To determine topic relationships, pause, or resume tasks, read references/topic-shift.md. Do not load all reference materials and historical memories at once during normal restores.
Activation State Machine
First, resolve the project root, then check .task-memory/HANDOFF.md and the currently effective AGENTS auto-restore block:
- Valid HANDOFF + effective managed block: Considered fully activated. Automatically restore the task without asking the user to explicitly invoke again or repeat initialization.
- Valid HANDOFF, but managed block missing or ineffective: The current session can be restored, but future automatic restores have no reliable entry point. Explain the configuration gap; only write the managed block after the user confirms the preview.
- HANDOFF does not exist, and the current invocation is explicit: Enter 'first-time activation'. Explicit invocations are only those where the user selects the skill via UI / runtime or explicitly names
$task-continuityin their request; automatic loading by the router or model due to semantic matching does not count as an explicit invocation. - HANDOFF does not exist, and it is only an implicit match: Do not create
.task-memory, do not modify project instructions, and do not interrupt the current request; continue working in the unactivated state.
A HANDOFF is only considered valid if it is readable, contains Task ID, Original Goal, Success Criteria, Scope, Constraints, and Current State, and has no unreplaced template placeholders. The existence of a directory, empty files, corrupted files, or only a Daily entry does not count as activation.
First-Time Activation
During first-time activation, read the adoption protocol first, and distinguish between new projects and projects with existing progress:
- First, read the applicable
AGENTS.override.md/AGENTS.mdinstruction chain in the current directory, then, based on the actual project structure, selectively read the README, design documents, plans, task records, version history, relevant implementations, and test evidence. Do not load the entire repository aimlessly. - If the project has substantial progress, categorize findings into 'user confirmed', 'repository facts', 'inferences', and 'unknown'. Based on this, draft the Task Contract and Current State. Repository state can only prove what happened, not what the user ultimately wants.
- Present the proposed Original Goal, Success Criteria, Scope, Constraints, Current Objective, completed progress, and open questions to the user, with key sources noted. Clearly state that confirmation will create
.task-memoryand add the auto-restore block to the project's effective instruction file; wait for user confirmation or correction. - Do not write formal memories, promote inferences to Decisions / Lessons, or modify AGENTS files before user confirmation. If there are multiple reasonable interpretations of the task, the user must choose; do not merge them yourself.
- For new projects: If the user's explicit invocation already fully specifies the goal, success criteria, scope, and constraints, you can form a draft directly based on those without asking repeat questions for already-clear fields. However, the Task Contract, managed block, and target files must still be shown and receive one explicit confirmation before writing anything. When fields that would change the direction of execution are missing, only ask the minimal necessary questions.
- After confirmation, the Task ID should be stable and not depend on a Conversation ID. Use the following templates as needed, rather than inventing parallel formats:
- templates/HANDOFF.md
- templates/DECISIONS.md
- templates/LESSONS.md
- templates/DAILY.md, with instances saved as
.task-memory/daily/YYYY-MM-DD.md
- When copying templates, replace all angle-bracket placeholders; either delete unavailable optional fields or write
Noneexplicitly — never leave placeholders in formal memories. - Use templates/AGENTS.task-continuity.md to append or update the only managed block in the currently effective AGENTS instruction file at the project root. If a non-empty
AGENTS.override.mdexists in the root, that is the target file for that layer; otherwise, use or createAGENTS.md. Preserve all existing content; stop and clearly explain that auto-restore has not been established if corruption, insufficient instruction budget, rule conflicts, or lack of permission to modify are encountered. - To prevent partial writes from being misinterpreted as activation, commit in the following order: prepare and validate auxiliary memory files → write and re-read the managed block → finally write and re-read the HANDOFF. Only report 'activated' after both the HANDOFF and the effective block have been successfully verified.
The Task Contract must contain at least Task ID, Original Goal, Success Criteria, Scope, and Constraints. Routine summaries must not modify it; it can only be modified when the user explicitly changes the contract, or when an Accepted Decision explicitly changes constraints, with the Decision recorded simultaneously.
Task Recovery
When a project's AGENTS instruction triggers this skill and the HANDOFF is valid, recover directly; do not ask 'do you want to activate?' again, and do not require the user to repeat $task-continuity. The skill cannot run automatically when the user has not sent any message or task; 'auto-restore' means that before the first project request in a new session started in this project or its subdirectories, it executes automatically. The current session that first writes the managed block will not reload the AGENTS instruction chain; the block takes effect starting from subsequent new sessions.
Recover in a progressive order, stopping as soon as enough information is available to execute the current request:
- First, read
HANDOFF.mdto confirm the Task Contract, Current Objective, Progress, Blockers, and Next Actions. - Only read the Decision and Lesson entries explicitly referenced by the HANDOFF.
- If still lacking necessary evidence, then read relevant recent Daily entries or project artifacts.
Do not load the entire DECISIONS.md, LESSONS.md, or all Daily entries by default. If the state is valid and has no conflicts, state the recovered Current Objective / Next Action in one sentence and proceed with the user's request without asking for repeated confirmation of the Task Contract. If memory conflicts with the user's current instruction, the current instruction takes precedence, and handle the historical relationship according to 'Conflicts and Corruption'.
Per-Turn Processing
Before executing a request, lightly classify it:
CONTINUE: Direct progression within the same Project, Goal, Deliverable, or Artifact; proceed normally.TANGENT: An explanation, investigation, or short side-branch related to the current task; answer the question without switching the Active Task or suggesting a switch.SWITCH: A separate task with clearly different Project, Goal, Deliverable, Artifact, and Intent.
Do not judge solely by keyword similarity; must combine project identity, goal, deliverables, artifacts, entities, phase, and user intent. For SWITCH, only when an Active Task with a clearly established context exists, and the new task is expected to require more than a single sentence to complete:
- First, create a checkpoint for the old task.
- Suggest starting a new session, but do not force it.
- If the user remains in the current session, continue responding, but do not write content from the new task into the old task's memory. MVP does not automatically maintain a multi-task stack; if the new task also requires persistent continuity, first determine independent memory ownership with the user, then initialize a new Task Contract.
After completing the user's request, classify memory candidates only when valuable new state has been produced:
| Type | Write Location |
|---|---|
STATE_CHANGE | HANDOFF.md |
DECISION | DECISIONS.md, update HANDOFF reference if necessary |
OBSERVATION | Today's Daily |
VERIFIED_LESSON | LESSONS.md, update HANDOFF reference if necessary |
NONE | Do not write |
Do not mechanically write files every turn 'for the sake of memory'. Multiple types can be produced in the same turn, but each piece of information should carry only its corresponding semantic meaning.
Writing & Promotion
- HANDOFF is the current minimal recoverable state snapshot, maintained by overwriting — it is not a historical log. Preserve the Task Contract, current state, unresolved Blockers, next steps, and necessary references; compress completed micro-steps and point details to the corresponding Daily.
- DAILY is raw, date-split event records and unverified observations; may include Action, Observation, Hypothesis, Status, and Next Validation.
- DECISIONS record engineering choices and rationale confirmed by the user or team. Old Decisions must never be deleted; when a change occurs, create a new Decision and use
Superseded/Superseded Byto retain the historical chain. - LESSONS only store reusable experience supported by actual evidence. Each entry must include Claim, Evidence, Applicable Conditions, Not Proven, and Confidence.
- Guesses, single-occurrence coincidences, unverified external opinions, and subjective inferences may only be stored in Daily; promote to Lesson only after sufficient evidence.
- Prefer recording stable sources: project artifacts, branches, commits, tests, or timestamps with text anchors. Conversation IDs are optional and must not become a strong dependency for recovery.
The following events trigger a HANDOFF checkpoint: change in Goal, Scope, Success Criteria, or Constraint; change in Phase or Current Objective; Blocker appears or is resolved; an Accepted Decision is made; an important test is completed; a pending task switch; this turn has produced significant task progress. If no event occurs, do not update.
Conflicts & Corruption
- Memory Missing: Initialize a new Task Contract from the current context and project evidence, and explicitly state that the historical state is unknown; do not pretend that recovery has occurred.
- Memory Corrupted: Preserve the corrupted original; do not overwrite in place. First create a timestamped recovery backup, then reconstruct only from verifiable sources. If safe reconstruction is impossible, stop writing and explain the situation to the user.
- Conflicting Decisions: If two conflicting Accepted Decisions have no supersedes relationship, explicitly mark the Conflict without guessing. The user's current explicit instruction may guide execution for the current turn; simultaneously create a new Decision, link and supersede the old one, then update the Task Contract.
- Uncertain Lesson: If evidence is insufficient, stay in Daily; do not dress it up as long-term experience through wording.
Immutable Rules
- Conversation is not equal to Task; tasks can span sessions, and a single session can contain multiple tasks.
- The Task Contract must not automatically change due to routine summaries.
- User's current explicit instruction > Task Contract > Accepted Decision > Verified Lesson > Daily Observation > Model Assumption.
- Unverified information must not enter LESSONS.
- Old Decisions must never be deleted; they can only be kept, rejected, deprecated, or replaced by a new Decision.
- HANDOFF only stores the current working state, not the full history, and should be kept to approximately 100–150 lines.
- Default recovery only reads HANDOFF, then loads minimally based on references.
- Related side-branches must not be mistaken for task switches; new session suggestions must not block the user.
- Memory writing is event-triggered, not enforced per-turn.
- The memory system itself must respect context budgets.