Loading...
Loading...
Writing technical articles and blog posts. Use when creating articles in docs/articles/ or blog content explaining patterns, techniques, or lessons learned.
npx skill4agent add epicenterhq/epicenter technical-articlesfoobarConversation Spec File Subagent
│ │ │
│ write context │ │
│───────────────────>│ │
│ │ │
│ │ read file │
│ │<──────────────────│
│ │ │
│ │ fresh context │
│ │──────────────────>│| Instead of | Do this |
|---|---|
| Copy-pasting context | Write to spec file |
| Re-explaining each prompt | Pass the filename |
[1-2 sentences: what the problem is]
\`\`\`typescript
// code showing the problem
const result = table.find(id); // O(n) scan every time
\`\`\`
[1 sentence: why this is bad, bridge to solution]
\`\`\`typescript
// code showing the solution
const result = index.get(id); // O(1) lookup
\`\`\`
[1-2 sentences: what this means for the reader][Paragraph explaining the problem]
[Paragraph explaining the approach]
[Paragraph explaining the implementation]
[Paragraph explaining the result]
\`\`\`typescript
// single code block at the bottom
\`\`\`In this article, we'll explore how context management works in agent workflows and discuss some approaches to improving it.
Write your context to a file, not a prompt. When a conversation spawns sub-agents, each one starts with a blank slate. If the context lives in a spec file on disk, every agent can read it fresh instead of relying on copy-pasted prompt fragments that drift.
The system uses a layered approach to handle data storage efficiently. Each layer provides a different level of abstraction, allowing consumers to interact with data at the appropriate granularity for their use case.
wrapsRowStore, which wrapsCellStore. Each layer adds one thing:YKeyValueLwwhandles conflict resolution,YKeyValueLwwparses cell keys into row/column pairs, andCellStoremaintains an in-memory index for O(1) lookups. The consumer only seesRowStore.RowStore
# Write Context to a File, Not a Prompt
When a conversation spawns sub-agents, each one starts fresh. If your context
lives only in the conversation, you'll re-explain it every time. Write it to a
file instead.
```typescript
// Instead of crafting a long prompt with embedded context:
task({ prompt: `Here's the schema: ${schema}. Here's the migration plan: ${plan}. Now implement step 3...` })
// Write context to a spec file, then reference it:
await writeFile('specs/migration-plan.md', context);
task({ prompt: 'Read specs/migration-plan.md and implement step 3.' })
```
The spec file solves three problems at once. Sub-agents get full context without
prompt bloat. The context doesn't drift between invocations because there's one
source of truth. And you can read the file yourself to verify what agents are
working from.
```
Conversation Spec File Sub-agent
│ │ │
│ write context │ │
│───────────────────>│ │
│ │ read file │
│ │<──────────────────│
│ │ fresh context │
│ │──────────────────>│
```
This also changes how you think about agent prompts. Instead of "give the agent
all the context it needs," the question becomes "does the spec file contain
everything?" That's a better question because you can check it: open the file,
read it, see if it's complete.
| Without spec file | With spec file |
| ----------------------------- | --------------------------- |
| Context drifts per invocation | Single source of truth |
| Prompt grows with complexity | Prompt stays short |
| Can't verify what agent sees | Read the file yourself |
| Copy-paste between agents | All agents read same file |
The overhead is one file write. The payoff is every sub-agent in the
conversation working from the same, verifiable context.foobar