Browse Source

refactor(sync): Remove caching overhead for faster bootstrap

- Replace MD5 hash validation with direct file reads
- Remove subagent spawn (was spawning Haiku for cache generation)
- Use parallel reads/globs instead of sequential cache checks
- Reduce from 6+ permission prompts to 2 tool batches

The files being read are small enough that caching adds more
overhead than it saves. Simpler is faster.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
0xDarkMatter 3 months ago
parent
commit
fcf7e72f89
1 changed files with 23 additions and 57 deletions
  1. 23 57
      commands/sync.md

+ 23 - 57
commands/sync.md

@@ -4,77 +4,43 @@ description: "Session bootstrap - read project context (README, AGENTS, docs, sk
 
 # Sync - Session Bootstrap
 
-Read yourself into this project. Loads essential context without exploring the full codebase.
+Read yourself into this project. Fast, direct file reads - no caching overhead.
 
-## CRITICAL: Cache-First Strategy
+## Execution
 
-### Step 1: Check Cache
+### Step 1: Parallel Reads
 
-First, read `.claude/sync-cache.json`. If it exists and is valid, skip to Step 3.
+Read these files simultaneously (skip any that don't exist):
 
-Cache is valid if ALL are true:
-- File exists
-- `readme_hash` matches current README.md hash
-- `agents_hash` matches current AGENTS.md hash
-- `plan_hash` matches current docs/PLAN.md hash (or both null if file missing)
+| File | Purpose |
+|------|---------|
+| `README.md` | Project overview |
+| `AGENTS.md` | Agent instructions |
+| `CLAUDE.md` | Project-specific rules |
+| `docs/PLAN.md` | Current plan (first 50 lines) |
+| `.claude/session-cache.json` | Saved session state |
 
-To check hashes, run ONE bash command:
-```bash
-md5sum README.md AGENTS.md docs/PLAN.md 2>/dev/null
-```
+### Step 2: Parallel Globs
 
-### Step 2: Generate Cache (only if cache invalid/missing)
-
-**INVOKE THE TASK TOOL** with `subagent_type: "general-purpose"` and `model: "haiku"`:
+Run these globs simultaneously to discover extensions:
 
 ```
-Gather project context. Return markdown.
-
-READ (skip if missing):
-- README.md (full)
-- AGENTS.md (full)
-- CLAUDE.md (first 100 lines)
-- docs/PLAN.md (first 100 lines)
-
-GLOB:
-- docs/*.md
-- .claude/commands/*.md
-- .claude/skills/*/SKILL.md
-- .claude/agents/*.md
-
-RETURN THIS FORMAT:
-
-## Summary
-[1-2 paragraphs from README/AGENTS]
-
-## Quick Reference
-| Category | Items |
-|----------|-------|
-| **Project** | [name] - [purpose] |
-| **Docs** | [filenames] |
-| **Commands** | [names] or None |
-| **Skills** | [names] or None |
-| **Agents** | [names] or None |
+docs/*.md
+commands/*.md OR .claude/commands/*.md
+skills/*/SKILL.md OR .claude/skills/*/SKILL.md
+agents/*.md OR .claude/agents/*.md
 ```
 
-Then WRITE `.claude/sync-cache.json`:
-```json
-{
-  "readme_hash": "[MD5 hash of README.md]",
-  "agents_hash": "[MD5 hash of AGENTS.md]",
-  "plan_hash": "[MD5 hash of docs/PLAN.md or null if missing]",
-  "content": "[the markdown output]"
-}
-```
-
-### Step 3: Display Output
+### Step 3: Git State
 
-Read cache, then run ONE bash for live state:
+One bash command for live state:
 ```bash
-git branch --show-current && git status --porcelain | wc -l && test -f .claude/session-cache.json && stat -c %Y .claude/session-cache.json 2>/dev/null
+git branch --show-current 2>/dev/null && git status --porcelain 2>/dev/null | wc -l
 ```
 
-Output cached content + live git/plan/state info.
+### Step 4: Output
+
+Format and display the results.
 
 ## Output Format