Claude Code From Scratch — AI skill for Claude Code
Build an AI Coding Agent from Scratch — Learning Context Engineering Step by Step.
How to install Claude Code From Scratch
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open First-Principal-Labs/claude-code-from-scratch and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
What Claude Code From Scratch does
Build an AI Coding Agent from Scratch — Learning Context Engineering Step by Step. Companion code for the book.
Alternatives in AI
- Context Engineering Agent Skills — Context engineering patterns for agent skills 13.9k ★
- Context Engineering Intro — GitHub Repo stars Context engineering - the new way of AI coding assistants Context engineering guide 12.8k ★
- Lovcode — A desktop companion app for AI coding tools 315 ★
README
Claude Code from Scratch — Chapter 4
**Conversation Management: The Art of Multi-Turn Context**
Tag: `ch04-conversation-management` | Version: `0.4.0`
What's New in This Chapter
Building on Chapter 3's multi-turn CLI, this chapter adds:
- Conversation persistence (
core/history.ts) — save/load conversations as JSON files to disk - Resume conversations —
--resumeflag or/resumecommand to pick up where you left off - Conversation IDs — each conversation gets a unique ID for tracking
- Auto-save on exit — conversations are automatically saved when you quit
- Budget warnings — caution at 60% window utilization, critical at 80%
- History browser —
/historylists saved conversations,/resume [id]loads one
Context Engineering Concepts
- The stateless illusion — LLMs have zero memory; continuity comes from resending the full history
- Message array = state — the conversation's messages array IS the complete state
- Context pressure — history grows ~500-2000 tokens per turn while the window stays fixed
- Persistence — saving the message array to disk bridges the gap between sessions
- Long conversation strategies — sliding window, summarization, selective retention (theory; implemented in Ch 10)
Run It
npm install
npm start # Start a new conversation
npm start -- --resume # Resume the most recent conversation
Commands
| Command | Action |
|---|---|
/save |
Save the current conversation to disk |
/history |
List all saved conversations |
/resume [id] |
Resume a saved conversation (most recent if no ID) |
/clear |
Start a fresh conversation |
/stats |
Show conversation statistics and budget status |
/prompt |
Display the system prompt |
quit |
Auto-save and exit |
Project Structure
claude-from-scratch/
├── src/
│ ├── index.ts # CLI with persistence and budget warnings
│ ├── config.ts # Mod
Related Skills
Stack Ia Dev
Tool-agnostic AI software engineering stack: deterministic safety guardrails, project-context profiling, multi
Build Your Own Agent
Build your own AI Agent from scratch — 11 architecture modules + 6 emergent behaviors, extracted from 600K lin
Crisp Reading
AI reading companion — turn any book into understanding. Fuses 6 reading methodologies into interactive HTML r
Skills For AI Agents
Companion materials for the book Skills for AI Agents
Your First AI Employee
Eight skills, the workspace files they read, and one command that installs them into your own OpenClaw agent.
Kratos Agent
Kratos Agent is an autonomous terminal AI coding engineer featuring a universal LLM Brain, dynamic step planni
Related Agents
Presentation Vibe Coding
当用户想要更新、修改或修复 VIBE-CODING 演示文稿(presentation/vibe-coding-to-agentic-engineering/index.html)时,主动使用此 Agent — 包括幻灯
Adhd Study Coach
Your ongoing ADHD-friendly study companion, for any subject. Use this to start a study session, review what's
Abacus AI Agent
Abacus.AI, the company behind ChatLLM and CodeLLM, ships its coding assistant as an agent extension for VS Cod