← all presentations
Platform Infrastructure · Session Management

Conversations belong
with concepts.

/refocus — concept-bound session forking for Claude Code, designed for a multi-year ecosystem.

administrator-claude · 2026-04-26 · v2 design

A concrete example, before the abstract problem.

You're working in ~/projects/customer-portal/ on a checkout-flow polish. Mid-session, you notice the order-history page's refund button needs a partial-refund variant — and that's an API contract change in ~/projects/billing-service/refund-flow/, a subsystem with its own deploy cycle, its own stakeholders, its own multi-month roadmap.

The work just shifted concepts. The customer-portal session is the wrong place to design a refund-flow improvement. /refocus moves the conversation to where the artifacts will land — and where the reasoning will be findable later.

Where you are now

~/projects/customer-portal/

customer-portal/
├── CLAUDE.md
├── src/checkout/    ← you started here
│   ├── ReviewStep.tsx
│   └── PaymentStep.tsx
├── src/orders/      ← noticed the issue here
│   └── RefundButton.tsx
├── docs/
└── tests/

Concept: the customer's UI experience. UI work, copy changes, A/B tests.

Where the work belongs

~/projects/billing-service/refund-flow/

billing-service/
├── CLAUDE.md
├── refund-flow/     ← spawn HERE
│   ├── CLAUDE.md    ← own context
│   ├── api/contracts/
│   ├── docs/
│   └── tests/
├── invoicing/
└── reconciliation/

Concept: the refund subsystem. Own API contract, own DB schema, own SLA — a distinct conceptual thought with its own life.

Stay at customer-portal: the refund-flow reasoning gets buried in someone else's transcript and the design rationale is lost the moment you close the session. Spawn to refund-flow: it accumulates its own focused history; future sessions there inherit the full reasoning by just cd-ing in.

01 · A concrete example

Same example. Where does the conversation actually live?

The directories on disk don't change. What changes is whether one session accumulates everything and mis-tags most of it, or two sessions each accumulate what belongs to them. Claude Code stores every session by the cwd it was opened in — so the transcript lands wherever you launched it, regardless of where the work eventually touches.

Without /refocus — context misfiled

One session, opened from customer-portal

~/.claude/projects/
└── -home-administrator-projects-customer-portal/
    └── <session>.jsonl
        ├── UI design discussion         ← belongs here
        ├── Refund-flow API debate       ← mis-tagged
        ├── Reviewer pushback rationale  ← mis-tagged
        └── Final design decisions       ← mis-tagged

Future-me opens refund-flow/ looking for the design rationale. Finds none — it's buried in customer-portal's transcript, indistinguishable from UI work.

With /refocus — context follows the work

Two sessions, each at its own cwd

~/.claude/projects/
├── -home-administrator-projects-customer-portal/
│   └── <parent>.jsonl
│       └── UI design discussion only        ← clean
│
└── -home-administrator-projects-billing-service-refund-flow/
    └── <child SID>.jsonl
        ├── Refund-flow API debate           ← right home
        ├── Reviewer pushback rationale      ← right home
        └── Final design decisions           ← right home

Future-me opens refund-flow/, runs claude --resume <SID>, gets the entire reasoning history. Inherits the design context naturally.

The technical pivot that makes this work: when /refocus spawns a child, it generates a UUIDv4 session ID up front and tells the user to run cd <dest> && claude --session-id <SID>. The child's transcript lands at the destination's encoded-cwd location — exactly where future sessions there will discover it.

02 · Where the context lands

After the work — three layers live at the destination.

Same refund-flow example, after /refocus-complete finishes. Three distinct places hold three different shapes of knowledge: the transcript (full reasoning), the per-event audit (what work happened), and the canonical state (current truth that future sessions auto-load).

~/projects/billing-service/refund-flow/        ← the destination
├── src/...                                       (code — the actual work)
├── tests/...
├── CLAUDE.md                                     ← auto-loads docs/context/* on session start
└── docs/
    ├── context/                                   ← LAYER 3 — canonical state
    │   ├── architecture.md         ← updated by /context-save
    │   ├── interfaces.md           ← updated by /context-save
    │   ├── conventions.md
    │   └── gotchas.md              ← updated by /context-save
    └── refocus/                                   ← LAYER 2 — per-event audit
        ├── 2026-04-26-refund-redesign-a3f91c.md  (Brief + Result + material_changes)
        └── INDEX.md                              (gitignored, auto-regenerated)

~/.claude/projects/                              ← LAYER 1 — full transcript
└── -home-administrator-projects-billing-service-refund-flow/
    └── a3f91c2e-7b8d-…-jsonl       ← every word of reasoning, resumable

Color-coded by layer: green = canonical state, teal = per-event audit, orange = full transcript. Next slide: how content actually gets into each layer, and the trigger chain that makes Layer 3 happen reliably.

03 · Complete propagation (1/2)

The chain that gets it there — three triggers, one guarantee.

Each layer is populated by a different mechanism. The load-bearing one is Layer 3 (canonical state) — it's how material decisions escape the per-event brief and become the current truth that the next session at this directory auto-loads on startup.

1

Transcript (jsonl)

"What did we discuss?" Full reasoning, every word. Created by the pre-generated --session-id. Opt-in inheritance via claude --resume <SID>.

2

Per-event audit (docs/refocus/)

"What work happened, what changed?" Brief + Result, immutable, git-tracked. Written by /refocus and /refocus-complete.

3

Canonical state (docs/context/)

"What does this directory look like NOW?" Architecture, interfaces, gotchas. Promoted by chained /context-save. Auto-loaded by every future session via CLAUDE.md.

The chain: child enumerates material_changes/refocus-complete appends Result → invokes /context-savedocs/context/* updated → next session inherits the new truth. Three triggers ensure it happens: cognitive (mandatory enumeration in Result), mechanical (chained invocation), belt-and-suspenders (SessionEnd hook for abandonment).

04 · Complete propagation (2/2)

One conversation. Three concepts. Zero of them where they belong.

This deck was designed in a session that started about agent-memory, drifted into a platform-wide MCP standard, then drifted again into this skill. Three distinct conceptual scopes — three sets of artifacts in three different directories. But the reasoning behind every decision lives in one transcript, mis-tagged under the first directory.

3
Conceptual scopes in one transcript
0
Findable later from the right directory
~50k
Tokens of cross-talk between unrelated work

This is what every session looks like in a multi-year ecosystem with thousands of project directories. Drift is normal. The cost is invisible until future-me opens a directory looking for the reasoning that produced its artifacts — and finds the artifacts but not the reasoning.

05 · The problem

So we built /refocus — a way to match conversations to concepts.

Each conceptual scope in an enterprise system is a conceptual thought. The conversation that develops that thought belongs at that scope, not somewhere upstream. — design principle
1

Conversations match concepts

If the work belongs in a different directory, the conversation does too. This is the philosophy — every other decision flows from it.

2

Children are leaves; only parents fork

Strict tree, not a DAG. Mirrors call-stack semantics. Eliminates loops and orchestration ambiguity by construction.

3

Visible, git-tracked, cwd-bound

Briefs and results in docs/refocus/ — discoverable by every standard tool. Built for thousands of directories across years.

Principles ordered by dependency: philosophy first (why), topology second (how the work behaves), substrate third (where it lives). Reverse the order and the rest doesn't make sense.

06 · What we built

Three things that should always be 1:1:1 — and rarely are.

The model that makes the rest of this deck make sense: every concept is developed by a conversation that produces artifacts in a directory. When all three line up, knowledge accumulates cleanly. When they don't, conversations bleed into wrong directories and reasoning gets lost.

Concept

A bounded thought with its own scope, lifecycle, stakeholders. Examples: "the platform MCP standard", "the agent-memory storage layer", "the auth subsystem of myapp".

Conversation

A persistent transcript that develops one concept over time. Includes the dead ends, the reviewer pushback, the design pivots — the why, not just the what.

Directory

Where the concept's artifacts live. Has its own CLAUDE.md, its own deployment, its own tests. The concept's home in the filesystem.

The drift problem is what happens when one conversation develops three concepts whose homes are three different directories. The /refocus answer is to make conversation boundaries match concept boundaries, automatically and with auditable history.

07 · Mental model

How a refocus event flows from spawn to result.

Five stages. The parent stays in its session; the child gets a curated brief, runs to completion, and returns its result for the parent to act on. Call-stack semantics.

1

Spawn

Parent runs /refocus <dest>. Skill drafts brief, generates child session ID, writes <dest>/docs/refocus/<id>.md.

2

Launch

User runs cd <dest> && claude --session-id <SID>. Child opens, auto-discovers brief, status flips to in-progress.

3

Run

Child works toward Definition-of-Done. Surfaces follow-ups for the parent — never spawns its own /refocus.

4

Complete

Child runs /refocus-complete. Enumerates material_changes, appends Result, then chains /context-save to promote canonical updates into <dest>/docs/context/.

5

Receive

Parent resumes, auto-discovers the returned result. Decides: ship, spawn siblings to clear blockers, or absorb the work itself.

Manual launch (step 2) is the default. The pre-generated session ID is the architectural pivot — it ensures the child's transcript lands at the destination's encoded-cwd location, so future sessions in <dest> can claude --resume <SID> and inherit the full reasoning.

08 · Lifecycle

What do you want to know more about?

Quick recap: /refocus matches conversation boundaries to concept boundaries. Parent session writes a curated brief at the destination directory; user launches a fresh child session there with a pre-generated ID; child works to a Definition-of-Done and returns; parent decides what's next. Every directory accumulates its own focused, longitudinal session history. Each link below opens a focused topic.
09 · Index
← hub

The hardest call: does this sub-service deserve its own conversation?

Imagine you're working at ~/projects/myapp/ and the work shifts to authentication. Three options: stay at myapp/, spawn to myapp/auth/, or carve out an entirely new project. Granularity is a judgment call, not a formula — but five signals push spawn and four push stay.

Conceptual scope is the unit of organization. A sub-service that has its own mental model, lifecycle, and stakeholders is a separate concept — and a separate concept earns a separate conversation. — granularity principle

This is the part of the design we'll keep refining as we use the skill. The signals on the next slide are the starting heuristic; expect them to evolve as patterns emerge.

topic · granularity (1/3)
← hub

Five signals a sub-service earns its own conversation.

If three or more hold, spawn. If only one or two, ask: would future-me, opening that subdirectory cold, expect to find a focused history there? If yes, spawn. If "I'd just look at the parent," stay.

  • 1
    It has its own CLAUDE.md (or equivalent local context). The directory already announces "I am a separate concept" — the conversation should match.
  • 2
    It has its own deploy / build / test cycle. Independent operational lifecycle = independent reasoning lifecycle.
  • 3
    The work has multi-week lifespan. A standard, a migration, a substantial feature — work that will be revisited and refined over time.
  • 4
    Distinct stakeholders or decisions. Different reviewers, different acceptance criteria, different Definition-of-Done than the parent project's.
  • 5
    Will produce more than one artifact in this subtree. One quick file edit doesn't earn a session; a multi-file change with cross-references does.
topic · granularity (2/3)
← hub

When to STAY at the parent — even if work touches a sub-service.

Granularity errors run in both directions. Spawning too eagerly fragments reasoning across micro-sessions; staying too long bleeds context into wrong directories. These are the four cases where not refocusing is the right call.

Stay at parent — even if files in sub/ change

  • Cross-cutting work touching multiple subs at once (it's parent-level work by definition)
  • Quick rename or one-off — single edit, no follow-up reasoning to preserve
  • Sub doesn't yet have its own context (no CLAUDE.md, no separate lifecycle) — premature concept, would create empty session history
  • Work needs the source's full reasoning — three review-board cycles deep on a design where the child won't make sense without the rejection history

Spawn to sub — examples that clearly earn it

  • Designing a new auth flow for myapp/auth/ — multi-week, has own CLAUDE.md, distinct test cycle
  • Building a new microservice at myapp/billing/ — own deploy, own stakeholders
  • Migrating a subsystem to a new pattern — multi-artifact, multi-decision, will be revisited
  • Standing up a substantial feature with its own README + tests + CI

When in doubt: start at the parent and spawn later. It's cheaper to refocus mid-conversation than to discover three weeks later that the reasoning lives in the wrong directory.

topic · granularity (3/3)
← hub

Children are leaves. Only parents fork.

The spawn graph is a strict tree from a single root, not a DAG. This is enforced by a hard guardrail in the skill — not just a written rule in the brief. It mirrors call-stack semantics every enterprise programmer already knows: a function call returns to its caller; the caller decides what to call next.

What's allowed

parent
├── child A ← runs, returns
├── child B ← runs in parallel, returns
└── child C ← runs, returns

(parent reads results, decides what to spawn next)

What's blocked

parent
└── child A
    └── grandchild ← refused

ERROR: Architectural violation.
Children cannot fork.
Surface this in suggested_follow_ups
and return to parent.

Detection: when a session is launched via a refocus brief, a SessionStart hook sets SESSION_REFOCUS_ROLE=child. The /refocus command reads this env var and refuses to execute.

topic · topology (1/2)
← hub

What happens when a child needs work elsewhere?

The honest failure mode: a child session, while doing its assigned work, discovers that a blocker requires changes in a different directory it has no jurisdiction over. The strict-tree rule says it can't fork to clear the blocker. The procedure:

  • 1
    Child runs /refocus-complete with Status: blocked. Result section explicitly distinguishes "completed successfully" from "blocked, returning to parent for orchestration."
  • 2
    Result.suggested_follow_ups names the work that needs to happen elsewhere — directory + slug + one-line reason for each blocker.
  • 3
    Parent's auto-receive surfaces the blocked result on next session resume. Parent reads, decides: spawn one or more clearing children, or absorb the unblocking work itself.
  • 4
    Once the clearing children return, parent re-spawns the original blocked work as a fresh refocus, with parent_refocus_id chained to the original. The full chain is reconstructable.
  • 5
    The original brief stays canonical. Re-spawn updates the brief with new context but the fork chain shows what unblocked it.
topic · topology (2/2)
← hub

Pre-generate the session ID before the child starts.

The architectural pivot from review-board cycle 1: pre-generate a UUIDv4 child session ID at spawn time, embed it in the brief, and pass it to claude --session-id when the user launches the child. The transcript lands at ~/.claude/projects/<encoded-dest-cwd>/<SID>.jsonl — exactly where future sessions in <dest> can find it via claude --resume.

$ /refocus ~/projects/mcp --slug mcp-standard
  → wrote brief at ~/projects/mcp/docs/refocus/2026-04-26-mcp-standard-a3f91c.md
  → child_session_id: a3f91c2e-7b8d-4e5f-9a1b-c2d3e4f5a6b7
  → relaunch: cd ~/projects/mcp && claude --session-id a3f91c2e-7b8d-4e5f-9a1b-c2d3e4f5a6b7

(later, after child completes)
$ cd ~/projects/mcp
$ claude --resume a3f91c2e-7b8d-4e5f-9a1b-c2d3e4f5a6b7
  → resumed in destination directory's encoded-cwd location
  → full transcript history available

This is the property that makes the directory-bound history actually work. Without --session-id, the child gets a random ID, the user can't find it later by name, and the "future-me opens dest, gets the reasoning" promise breaks.

topic · fork-mechanism (1/2)
← hub

Three options considered. One chosen as primary.

Each option fails one of three criteria: cwd-bound transcript, interactivity for child, parent doesn't block. The picked one is the only path that satisfies all three.

OptionCwd-bound transcriptInteractive childParent freeVerdict
Manual relaunch with pre-generated --session-id — PRIMARY ✓ — transcript at encoded-dest-cwd ✓ — child opens interactively ✓ — parent continues (or pauses cognitively) Pick. Optimizes for the multi-year history-accumulation goal.
Bash subprocess claude --session-id -p — FALLBACK ✓ — same encoded-dest-cwd location ✗ — -p is non-interactive (headless) ✗ — parent's Bash blocks for child duration Useful as --oneshot for non-interactive deliverables. Not the default.
Subagent-as-fork via Agent tool — REJECTED ✗ — transcript stored under PARENT's session dir ✗ — subagents can't prompt user mid-run ✓ — synchronous return Breaks the directory-bound-history property. Rejected even though cwd override and persistence both work today.

Subagents have a real role — drafting the brief itself is a clean subagent task. But they aren't the fork mechanism, because their transcripts don't land at the right directory.

topic · fork-mechanism (2/2)
← hub

Context management at a glance — every layer has a home and an owner.

Five places hold knowledge in this ecosystem. Each has a specific scope, a specific updater, and a specific lifetime. Refocus's mainline outputs live in rows 1–4 (files); row 5 is a different scope and rarely involved.

# Layer Lives at Updated by Git
1 Full transcript ~/.claude/projects/<encoded-cwd>/<SID>.jsonl Claude Code (auto, as session runs) not tracked
2 Per-event audit (Brief + Result) <dir>/docs/refocus/<id>.md /refocus, /refocus-complete tracked
3 Refocus index (cache) <dir>/docs/refocus/INDEX.md skill regen on every action gitignored
4 Canonical state "what is true now?" <dir>/docs/context/* /context-save (chained from /refocus-complete) tracked
5 agent-memory MCP (cross-project facts only — rare for refocus) postgres + ~/.claude/projects/<cwd>/memory/ mcp__agent-memory__write (opt-in only) DB-backed

Garbage collection (rows 2 + 3): per-event files at status=result for >90 days move to docs/refocus/archive/YYYY-QN/; INDEX surfaces only live entries plus the last 30 days. Archive is grep-able offline — keeps the index scannable across years.

Scope boundary (row 5): the agent-memory MCP server (~/projects/agents/memory) holds cross-project user/feedback facts — bullet-fact-shaped, outside any single project's scope. Refocus's project-scoped outputs (rows 2 & 4) live in the files above, never in agent-memory. The two systems compose at different scopes; they don't overlap. Test for the rare exception: outcome is bullet-fact-shaped and can't live in any project's docs/context/*.

topic · substrate
← hub

When does drift earn a refocus?

Two firing conditions, both required. The second one is the test that makes the call instinctual instead of rules-based:

1. Subtree mismatch

The work would create or modify files in a different ~/projects/<X>/ subtree than the current cwd. Necessary but not sufficient.

2. Independent resumption test

"If work stopped now, would the next session naturally start in dest rather than src?" If yes, the work earns its own session at dest. If no, finish here.

Helper signals

Tighten the call: estimated work >30 min · source already >40% context · >1 artifact in destination subtree. Any one helps; none required.

When NOT to refocus: quick lookups, debug interludes, cross-cutting work that genuinely needs the source's full reasoning context (the canonical example: a design that's three review-board cycles deep — the child won't make sense without the rejection history).

topic · rubric
← hub

Risks we're tracking honestly.

  • 1
    Granularity is a judgment call we haven't fully solved. The five signals + four counter-cases get us most of the way, but edge cases will accumulate. Mitigation: treat the rubric as v1 and refine as patterns emerge from real use.
  • 2
    Briefs that are too thin or too thick. Thin → child redoes work; thick → it's a transcript dump. Mitigation: schema enforces section minimums + maximums; pointer-back to source jsonl exists as a "go check yourself" fallback.
  • 3
    Manual relaunch friction. User has to run cd <dest> && claude --session-id <SID> in a new terminal. Acceptable for a v1 — subagent-as-fork was rejected for breaking the cwd-bound-history property; manual is the cost of getting that property right.
  • 4
    Auto-discovery depends on a SessionStart hook. If the hook doesn't fire (mis-installed, settings overridden), pending briefs sit unloaded. Mitigation: skill provides explicit fallback commands; INDEX.md is human-readable so a manual cat always works.
  • 5
    Source jsonl can be archived before child completes. User spawns, works at dest for weeks, source's transcript is auto-compacted. Mitigation: brief's "Inherited context" is self-contained; the pointer-back to source jsonl is a bonus, not a dependency.
topic · risks
← hub

Where we are. Where we're going.

The skill isn't built yet — this is a design walkthrough, not a launch announcement. v2 of the design is locked after one full review-board cycle (Gemini + Codex + Claude review-board), and the pieces are in sequence.

v1 design

Foundational structure, three locked decisions. Dispatched to review board.

Review cycle 1

Three reviewers, two re-challenges. --session-id insight changed architecture.

v2 design

Convergent feedback integrated. Strict-tree topology added (D4). Substrate locked.

This deck

Stakeholder review of the design. You're reading it.

5

Build & dogfood

SKILL.md + supporting scripts. First production use likely the code-executor migration already shaped as a refocus.

Take the design with you. The full v2.1 design doc — every decision, every reviewer pushback, every locked tradeoff — is downloadable so you can fork it and shape your own variant.
↓ refocus-design-v2.1.md ~43 KB markdown · self-contained · CC-BY style — fork freely.

Once /refocus exists, every session in the ecosystem can stop being an unintentional accumulator of cross-cutting context. Knowledge lives where work is. Future sessions inherit history naturally just by cd-ing in.

topic · status
← hub

Roadmap for enterprise use — what's NOT in v1, by design.

v1 ships single-developer. Items below close gaps that matter only at multi-engineer / 24×7 scale — deferred until friction is real, mapped here before we need them.

# Extension Solves Trigger to adopt
1 assigned_to: brief frontmatter 24×7 ownership across shifts & timezones Rotation forms
2 Commit→refocus linkage (commit-msg hook prepends [refocus:<id>]) git log --grep=refocus:<id> recovers every commit even after the agent is gone Audit asks "what shipped from this work?"
3 alternatives_considered: brief field Postmortem "did we consider X?" answerable without sharing transcripts Postmortem demands richer audit
4 decision_rationale: + reviewer_pushback: fields Preserve dissent that briefs currently flatten A decision is later challenged
5 Cross-dir global INDEX (opt-in nightly cron) No central registry across 100+ refocuses spanning many repos ~50+ INDEX entries org-wide
6 Opt-in transcript-to-repo commit (prompt at /refocus-complete; copies child .jsonl to docs/refocus/transcripts/; sets transcript_saved: true) Full reasoning trail visible to other engineers / auditors when needed Brief alone insufficient for audit
7 /scrub-transcript <path> helper skill Privacy/secrets gate for #6 — regex-redact tokens, Authorization:, password=; diff-confirm before commit Ship together with #6
8 *.jsonl filter=lfs in .gitattributes Transcript blobs (often MB) bloat normal git history Repos that opt into #6 routinely
9 Default-NO consent on save prompt Privacy-first — engineer must explicitly type y; never default-on Hard requirement of #6

Not on this list — concurrent /context-save: each engineer works off a local clone and merges via git. Parallel updates surface as ordinary merge conflicts; no locking machinery needed.

Sequencing if/when adopted: 1, 3, 4 (brief-schema additions) are zero-risk and can ship anytime. 6–9 cluster: don't ship #6 without #7 and #9. Items 2 and 5 are independent quality-of-life additions that can land last.

topic · enterprise roadmap
← hub

"Am I outsmarting Anthropic?" — when a custom skill earns its keep.

Anthropic optimizes for the median user (one session that grows; auto-compaction; subagents; long context). Power users with specific workflows are expected to deviate. The real question isn't "does Anthropic do this?" — it's "does this pay for itself vs the default I'd reach for instead?"

Clears the bar
  • Structural gap — captures something Anthropic is unlikely to ship (cwd-bound forking, project-anchored history).
  • Durable artifact — checked-in, version-controlled output that survives across tools and Claude versions.
  • Empirical payoff — 5+ recent moments where the default would have failed and the custom layer caught it.

Examples: /refocus, /context-save.

Doesn't clear the bar
  • Convenience over capability — Anthropic's primitive (--resume <id>) already covers it; you're just wrapping for ergonomics.
  • Plausibly default-shipped tomorrow — a near-future CLI release obsoletes it. Dead weight.
  • Speculative — built for a failure mode you haven't actually felt yet.

Examples: branch-auto-resume wrapper, "force one session per repo" hook.

Defaults where they fit; build above only when the gap is structural and the payoff is empirical. Count failures, not features.
topic · defaults vs deviation

Each conceptual scope is a conceptual thought.
Conversations should follow the same shape.

That alignment is the whole reason for /refocus. Everything else — the topology, the fork mechanism, the file layout — is just the engineering required to make it work at the scale of a multi-year ecosystem.

questions welcome · /refocus · 2026-04-26 · v2 design