feat: per-workflow state isolation with project/ namespace (v10.2)#27
Open
volkz wants to merge 1 commit into
Open
feat: per-workflow state isolation with project/ namespace (v10.2)#27volkz wants to merge 1 commit into
volkz wants to merge 1 commit into
Conversation
Adds a three-tier memory structure that eliminates cross-workflow state clobber when two Claude Code windows work on the same repo simultaneously. New layout: .cc10x/v10/ ├── project/ ← NEW: long-lived cross-workflow state │ ├── activeContext.md (architecture, decisions, durable patterns) │ ├── patterns.md │ └── progress.md ├── workflows/ │ ├── <wf-id>.json (existing hook artifact) │ ├── <wf-id>.events.jsonl (existing) │ └── <wf-id>/ ← NEW: per-workflow isolated state │ ├── activeContext.md (current focus, active phase) │ ├── patterns.md │ └── progress.md ├── activeContext.md (kept — backward-compat fallback) ├── patterns.md └── progress.md Changes: - cc10x_hooklib.py: add project_state_dir() and workflow_state_dir(wf_id) helpers - cc10x_pretooluse_guard.py: expand write guard to cover all three tiers dynamically - cc10x_context_migration.py: add flat→project promotion on first SessionStart; add project/workflows to source-discovery skip-list - cc10x-router/SKILL.md: update §2 (two-tier memory load), §6 (wf state dir init), §13 (split memory finalization with write routing table) - session-memory/SKILL.md: update memory surfaces, load order, load-bearing boundaries Backward compatibility: - Root-flat files are preserved (copy, not move) as fallback - Existing workflow artifact schema unchanged; state_root still points at .cc10x/v10/ - Heading contract identical across all three tiers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When two Claude Code windows work on the same repo simultaneously, they both write to the same flat
activeContext.md— last writer wins, state gets clobbered. There is no isolation between parallel workflows on the same repo.Solution
Adds a three-tier memory structure that eliminates cross-workflow state collision:
Two parallel Claude Code windows on the same repo each write exclusively to their own
workflows/<wf-id>/directory while sharing read-only access toproject/for durable project context.Changes
scripts/cc10x_hooklib.pyproject_state_dir()— returns.cc10x/v10/project/, creates it on demandworkflow_state_dir(workflow_id)— returns.cc10x/v10/workflows/<wf-id>/, creates it on demandscripts/cc10x_pretooluse_guard.py_protected_memory_paths(), which dynamically covers all three tiers: root-flat,project/, and any existingworkflows/<wf-id>/directoriesscripts/cc10x_context_migration.py_migrate_flat_to_project()— one-time intra-v10 migration that copies existing root-flat memory files intoproject/on the first SessionStart after upgrading. Idempotent via a.project-namespace-migratedmarker. Copies (not moves) to preserve the backward-compat fallback.projectandworkflowsto the source-discovery skip-list in_discover_sources()so the new namespace subdirectories are never treated as legacy migration sourcesskills/cc10x-router/SKILL.mdproject/first, then loadworkflows/{wf}/when aworkflow_uuidis already known (resume path). Defines the merge precedence rule.mkdir -p .cc10x/v10/workflows/{workflow_uuid}MEMORY_NOTES.patterns→project/patterns.md.MEMORY_NOTES.learnings+verification→workflows/{wf}/. Cross-workflow promotions clearly defined.skills/session-memory/SKILL.mdBackward Compatibility
state_rootstill points at.cc10x/v10/workflow_uuidcontinue working via the root-flat fallback until their first new workflowTest Plan
project/created on first workflow; per-wf dir created after UUID generation in §6cc10x_context_migration.pycopies root-flat →project/on SessionStart;.project-namespace-migratedmarker prevents repeat runsworkflows/<wf>/dirs;project/is shared read contextproject/activeContext.mdfrom a write agent is audited/blockedworkflows/<wf>/activeContext.mdfrom a write agent is audited/blockedMEMORY_NOTES.patternslands inproject/patterns.md; workflow-local items stay inworkflows/<wf>/_discover_sources()does not treatproject/orworkflows/as migration sourcesworkflow_uuidcontext continue to use root-flat fallback without errors