Global workflow collaboration constraints (long-conversation anti-drift)
- This skill must not be used as an isolated entry point. When the user requests a complete paper, Word generation, continuation of the workflow, or is unsure of the stage, first return to
paper-workflow-orchestratorto determine the current S0-S8 stage. - Before starting or continuing a formal task of this skill, you must run:
python .claude/skills/paper-workflow-orchestrator/scripts/workflow_guard.py --skill context-memory-keeper - If the output is
[WORKFLOW FAIL]or it reportsstatus != "PASS", stop this skill and, according topaper_output/qa/workflow_guard_report.json, backfill the prerequisite stages for the failed items; do not continue from memory. - This skill only writes
paper_output/artifacts within its own contract scope; after completion, you must return topaper-workflow-orchestratorto determine the next step, and usecontext-memory-keeperto record completed artifacts, blockers, and the next step. - In a long conversation, if the context grows long, the stage is uncertain, or the user invokes skills separately, first run:
then readpython .claude/skills/paper-workflow-orchestrator/scripts/workflow_guard.py --statuspaper_output/qa/workflow_guard_report.json、paper_output/preflight_report.json、paper_output/input_manifest.json、paper_output/results/run_manifest.jsonand the upstream JSON contract of this skill, and continue according to therecommended_skillandnext_actionin the report. - Before continuing the workflow, you must treat
paper_output/context/workflow_memory.jsonas a long-term breakpoint record; if itscurrent_step、next_step、recommended_skillandworkflow_guard.py --statusare inconsistent, the guard report takes precedence. - After completing the artifacts of this skill each time, first return to
paper-workflow-orchestratoror runworkflow_guard.py --status, then update workflow memory:
after updating, readpython .claude/skills/context-memory-keeper/scripts/update_workflow_memory.pypaper_output/context/workflow_memory.json/.mdto confirm that the next step and recommended skill have been recorded.
Execution contract
- Upstream input: current competition problem constraints, model route, data sources, chart paths, QA conclusions, new user preferences, and workflow breakpoints.
- Required output: the updated
memoryskill.md; when the short-term workbench is too long, archive old task summaries tomemory_archive.md。 - Downstream handoff: other skills read
memoryskill.mdbefore starting complex tasks, to avoid forgetting the current model route, data sources, and user requirements. - Recommended next step: after completing the memory update, return to the current skill that invoked it; if the goal is a complete paper, return to
paper-workflow-orchestratorto determine subsequent stages. - Failure fallback: if the memory file cannot be safely updated, clearly preserve the key conclusions in this round's reply, and prompt for subsequent manual backfilling into the memory file.
Description
This Skill maintains a dual-layer memory structure, designed to solve the model's context forgetting problem while keeping the context window clean.
Files Structure
Executable Workflow Memory
- After
workflow_guard.py --statusor after a skill handoff, run:python .claude/skills/context-memory-keeper/scripts/update_workflow_memory.py - The script reads
paper_output/qa/workflow_guard_report.jsonplus key workflow artifacts and writes:paper_output/context/workflow_memory.jsonpaper_output/context/workflow_memory.md
- Long conversations and resumed sessions should read
workflow_memory.jsonbefore relying on chat history.
memoryskill.md(Active Memory):- Long-term guidelines: user preferences, role settings, global constraints (Read-Only mostly).
- Short-term workbench: current task status, variables, ongoing steps,external literature/data index (Read-Write frequently)。
memory_archive.md(Archive):- History records, completed task details (Write-Only mostly).
When to Invoke
- Read: before starting a complex task each time, or when the context feels unclear, read
memoryskill.md。 - Update:
- receive new instructions or complete a small step -> update
memoryskill.mdthe "short-term workbench". - User modifies global rules -> update
memoryskill.mdthe "long-term guidelines".
- receive new instructions or complete a small step -> update
- Archive (Cleanup):
- When the "short-term workbench" content is too long or a phased task ends -> cut the old content to
memory_archive.md, and inmemoryskill.mdkeep only the key conclusions.
- When the "short-term workbench" content is too long or a phased task ends -> cut the old content to
Compression Policy (Auto-Cleanup)
- Trigger condition: when
memoryskill.mdexceeds 100 lines ,mustexecute compression. - Retention principle:
- User Imperatives: Commands, preferences, and red lines strongly requested by the user (High Priority).
- Project Skeleton: Project core framework, critical path, and current phase milestones (Medium Priority).
- Active Blockers: Issues currently blocking the task (High Priority).
- Discard/Archive Principles:
- Details: Execution details of completed tasks -> move to
memory_archive.md。 - Logs: Procedural success/failure logs -> move to
memory_archive.mdor delete directly. - Expired Context: Invalidated temporary variables or no-longer-relevant context -> delete directly.
- Details: Execution details of completed tasks -> move to
Usage Tips
- Keep
memoryskill.mdlightweight (recommended < 100 lines) so it can be read quickly at any time. - Archiving is amanually triggeredaction (the model decides when to cut and paste).