Workspace Optimization Plan

Patterns from the Claude Code source leak mapped to our Continuous Claude setup — April 2026

Current Memory State

373
MEMORY.md lines (200 limit!)
28KB
MEMORY.md size
25
Topic files
40
Global rules (3,756 lines)

Pattern Alignment Score

3-Layer Memory Partial
Skeptical Verification Rule exists, not enforced
Memory Consolidation Missing
Semantic Memory Merging Missing
Adversarial Verification Missing
Context Budget Discipline Over budget
Risk Classification Implemented
Multi-agent Coordination Implemented

P0 MEMORY.md is 373 lines — only 200 get loaded

Right now, 46% of MEMORY.md is silently truncated every session. Everything below line 200 (venture portfolio, Flippa, Gumroad, video pipeline, social stack, document extraction, PepGuide socials) is invisible. We're paying for memory we can't use.

What the leak says

Claude Code's autoDream enforces: ≤200 lines, ≤25KB. MEMORY.md is an index of pointers, not the memory itself. Each entry <150 chars pointing to a topic file.

The Fix: Compress MEMORY.md to a pure index

BEFORE (current)
## Flippa Deal Scout
Runs daily at 8:30 AM. Scans Flippa content sites, scores 0-100, classifies into three deal types.
| Field | Detail |
|-------|--------|
| Location | opc/scripts/flippa/ |
... (15 lines)
AFTER (index entry)
## Flippa Deal Scout
- [Details](flippa_deal_scout.md) — Daily 8:30AM, scores listings 0-100. `scripts/flippa/`

Action Items

  • Extract all multi-line sections into dedicated topic files
  • Compress each MEMORY.md entry to 1-2 lines: link + one-sentence summary
  • Target: ≤150 lines, ≤15KB
  • Move venture portfolio table to venture_portfolio.md
  • Move video pipeline to video_pipeline.md
  • Move social media stack to social_media_stack.md
  • Move Flippa/Gumroad details to their own files
  • Move Typefully rate limits to typefully_api.md

P1 40 global rules (3,756 lines) — all loaded every session

Every session loads 3,756 lines of rules. The 6 postgres-*.md files alone are 1,500+ lines of reference material that's only relevant during database work. This wastes context and degrades prompt cache hit rates.

What the leak says

CLAUDE.md gets reinserted every turn change. Bloated instructions = tokens re-paid on every single message. The tool system uses on-demand loading — fetch knowledge when needed, not upfront.

The Fix: Tier the rules

TierWhatLinesLoad Strategy
AlwaysCore behavior (destructive-commands, git, api-keys, claim-verification, no-haiku)~300Keep in ~/.claude/rules/
On-DemandPostgres (6 files), Supabase, WordPress, content pipeline, video pipeline~2,500Move to ~/.claude/references/ — load via skill or explicit request
ProjectDocker rebuild, team knowledge, dockerize-services~150Keep in project .claude/rules/

Action Items

  • Create ~/.claude/references/ directory for on-demand material
  • Move postgres-*.md (6 files, ~1,500 lines) to references
  • Move supabase-workflow.md (~200 lines) to references
  • Move wordpress-server-optimization.md (~150 lines) to references
  • Move content-pipeline.md, video-pipeline.md, internal-linking.md to references
  • Create a postgres skill that loads the postgres references on demand
  • Net savings: ~2,500 lines removed from every session's context

P2 Memory Consolidation

No autoDream equivalent. Memory grows monotonically. Contradictions accumulate. Stale entries persist.

What to build

  • Weekly consolidation script that:
    • Scans all topic files for contradictions
    • Merges duplicate observations
    • Prunes entries older than 90 days with no references
    • Keeps MEMORY.md under 150 lines
  • Use existing PostgreSQL memory system's embeddings to detect semantic duplicates
  • Safety cap: never reduce any section by >50% in one pass
  • Run as a scheduled task (Windows Task Scheduler, weekly Sunday)

P2 Skeptical Memory Verification

We have claim-verification.md but it's a rule, not enforced mechanically. Memory claims get trusted without verification.

What to build

  • Add verification markers to memory entries:
    • [verified 2026-03-15] = confirmed against codebase
    • [stale?] = not verified in >30 days
  • Consolidation script marks entries as stale when their referenced files have changed
  • At session start, if a memory entry references a file that's been modified since last verification, flag it

P3 Adversarial Verification Phase

Our /review skill does parallel reviews but doesn't have an explicit "try to break it" adversarial agent.

What to add

  • Add an adversarial verification step to /build and /fix workflows
  • Spawn a separate agent with the prompt: "Your job is to find problems with this implementation. Try to break it."
  • Two phases: existence check (does the deliverable exist?) + adversarial challenge (edge cases, error handling, security)
  • Results logged before marking task complete

P3 Prompt Cache Awareness

No visibility into cache hit rates. We don't know how much context bloat costs us.

What to track

  • The rules bloat (P1) is the biggest cache-breaker — 3,756 lines reinserted every turn
  • Reducing rules to ~1,200 lines (core only) means the shared prefix stays stable across turns
  • Fewer context changes = higher cache hit rate = lower cost per message
  • After P1 cleanup, monitor Braintrust traces for cache_read_input_tokens ratio

Implementation Roadmap

PriorityTaskEffortImpactStatus
P0 Compress MEMORY.md to pure index (≤150 lines) 30 min Restores 173 lines of invisible memory Ready now
P1 Move reference rules to ~/.claude/references/ 20 min -2,500 lines from every session context Ready now
P2 Build memory consolidation script 2 hrs Prevents memory rot over time Design ready
P2 Add verification timestamps to memory 1 hr Catches stale/wrong memories Design ready
P3 Add adversarial verification to /build and /fix 1 hr Catches bugs before completion Design ready
P3 Cache hit rate monitoring 30 min Cost visibility After P1

Key Insight

Our workspace already has the right architecture (3-layer memory, multi-agent, risk tiers). The problem is discipline: MEMORY.md grew past its budget, reference material leaked into always-on rules, and there's no automated pruning. The leak confirms we built the right patterns — we just need to enforce the budgets that make them work.

P0 + P1 together take ~50 minutes and recover ~2,700 lines of wasted context per session. That's the highest-ROI optimization available right now.