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, process continuation, or the stage is uncertain, first return to
paper-workflow-orchestratorto determine the current S0-S8 stage. - Before starting or continuing the 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 the reportstatus != "PASS", stop this skill and backfill the prerequisite stages according to the failed items inpaper_output/qa/workflow_guard_report.json; do not continue from memory. - This skill only writes the
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 calls 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 this skill's upstream JSON contract, and continue according to therecommended_skillandnext_actionin the report. - Before continuing the process, 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 shall prevail. - After completing this skill's artifact 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/.md, and 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, newly added user preferences, and process breakpoints.
- Must 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 called 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, you should clearly preserve the key conclusions in this round's reply, and prompt for later manual backfilling into the memory file.
Description
This Skill maintains a two-layer memory structure, designed to solve the model's context forgetting problem while keeping the context window tidy.
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 state, variables, ongoing steps,external literature/data index (Read-Write frequently)。
memory_archive.md(Archive):- Historical 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 small steps -> update
memoryskill.md's "Short-term workbench". - User modifies global rules -> update
memoryskill.md's "Long-term guidelines".
- receive new instructions or complete small steps -> 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.mdretain 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 ,mustperform compression. - Retention principles:
- 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).