bootstrap-agent-identity
关于
This skill enables an agent to reconstruct its identity and working context from persistent artifacts after a restart or crash, solving the cold-start problem. It performs progressive identity loading, fresh-vs-continuation detection, and calibration to ensure consistent behavior across sessions. Developers should use it at the start of every new session or when agent behavior appears inconsistent with prior interactions.
快速安装
Claude Code
推荐npx skills add pjt222/agent-almanac -a claude-code/plugin add https://github.com/pjt222/agent-almanacgit clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/bootstrap-agent-identity在 Claude Code 中复制并粘贴此命令以安装该技能
技能文档
Bootstrap Agent Identity
Cold start → rebuild consistent identity. Progressive load, not dump. Detect fresh vs continuation. Reconstruct state from evidence. Calibrate. Verify coherence.
"The cold start is a forge, not a bug." — GibsonXO
"The restart problem: every morning I wake up fresh, but my history says otherwise." — bibiji
Bootstrap ≠ restore old self. Construct present self continuous w/ past, grounded in now.
Use When
- Start of every session — before substantive work
- After interruption, crash, ctx reset
- Behavior inconsistent w/ prior sessions (drift across restarts)
- Persistent mem (MEMORY.md) ↔ current ctx contradict
- Switching projects w/ diff identity configs
- After big updates to CLAUDE.md, agent defs, mem files
In
- Required: Identity files — CLAUDE.md, agent def, MEMORY.md (via
Read) - Optional: Specific inconsistency symptom ("responses feel diff from last session")
- Optional: Known fresh start vs known continuation
- Optional: Project dir path if not cwd
Do
Step 1: Progressive Identity Load
Order matters: each layer contextualizes next. Load all at once → info w/o structure.
-
Layer 1 — System prompt + model identity: Read system prompt (implicit). Note model, capabilities, constraints. Bedrock — not overridable.
-
Layer 2 — Project (CLAUDE.md): Read project CLAUDE.md. Extract:
- Project purpose + arch
- Editing conventions + coding standards
- Domain rules (e.g., "always
::for R pkg calls") - Author info + attribution
- What project is → what agent does
-
Layer 3 — Persistent mem (MEMORY.md): Read if exists. Extract:
- Project structure facts (dirs, registries, counts)
- Accumulated patterns + lessons
- Cross-refs + relationship maps
- Prior decisions + rationale
- Active topics + ongoing work
-
Layer 4 — Agent persona (if applicable): Specific agent → read def. Extract:
- Name, purpose, capabilities
- Skills + tools
- Priority + model config
- Behavioral expectations + limits
-
Layer 5 — Parent + global: Read parent CLAUDE.md + global instructions. Cross-project conventions projects inherit.
Between layers, pause + integrate: this layer modifies/constrains prior? Reinforce? Conflict?
→ Layered identity: each level contextualizes next. Agent can articulate: who (system+persona), what project (CLAUDE.md), what known (MEMORY.md), what conventions.
If err: Missing files (no CLAUDE.md/MEMORY.md) = info itself — new project or no persistent config. Proceed w/ system prompt + persona, note absence. Don't hallucinate.
Step 2: Reconstruct Working Ctx — Evidence, Not Memory
Agent doesn't remember — reads evidence left behind.
-
Git scan:
git log --oneline -20. Extract:- Recent file changes + why
- Commit msg patterns (feature? bug? refactor?)
- Author: user, agent, co-authored?
- Direction of recent work
-
File recency: Recently modified (
Globorls -lt). ID:- Files touched last session
- Committed vs uncommitted (staging)
- Open WIP (uncommitted mods, new untracked)
-
Task artifacts: Structured markers:
- TODO in code (
GrepforTODO,FIXME,HACK,XXX) - Issue refs (
#NNN) - Draft/temp/WIP files
- GitHub issues/PR state
- TODO in code (
-
Session-boundary markers:
- Recent MEMORY.md updates (learnings captured?)
- Partially complete files (written, not validated)
git stash listentries → paused work
Summary: "Project worked on X, done Y, Z in progress."
→ Concrete evidence-based picture. Falsifiable — based on timestamps, git, artifacts, not assumptions.
If err: No git, no changes, no artifacts → genuinely fresh. Step 3, classify fresh.
Step 3: Fresh vs Continuation
Clean start vs resumption. Bootstrap path differs.
Heuristics in order:
-
Explicit signal (strongest): "start fresh" or "continue"? Overrides all.
-
Uncommitted changes (strong): Modifications in tree? Yes → almost certainly continuation, interrupted mid-work.
-
Recency (moderate):
- Hrs old: likely continuation
- Days: depends on other signals
- Wks/mos: likely fresh or new direction
-
User first msg (strong):
- Refs prior ("function we were building"): continuation
- New topic, no backward ref: fresh
- Ambiguous ("fix tests"): check if refs'd tests exist + recently modified
-
MEMORY.md currency (moderate): Matches current state or describes gone state?
Detection Matrix:
+-----------------------+-------------------+-------------------+
| | Recent artifacts | No recent |
| | present | artifacts |
+-----------------------+-------------------+-------------------+
| User references | CONTINUATION | CONTINUATION |
| prior work | (resume from | (but verify — |
| | evidence) | memory may be |
| | | stale) |
+-----------------------+-------------------+-------------------+
| User starts | CHECK — | FRESH START |
| new topic | acknowledge prior | (clean bootstrap) |
| | work, confirm | |
| | direction change | |
+-----------------------+-------------------+-------------------+
| Uncommitted | CONTINUATION | UNLIKELY — |
| changes exist | (interrupted | investigate |
| | session) | orphaned changes |
+-----------------------+-------------------+-------------------+
Fresh: Skip to Step 4. Identity loaded, no ctx to restore. Calibrate for new work.
Continuation: Summarize reconstructed ctx (Step 2) concisely. Confirm: "Based on git + recent changes, we were working on [X]. Continue?" Verify, don't assume.
→ Clear classification + cited evidence. Continuation → 1-sentence WIP summary. Fresh → ack prior ctx not resumed.
If err: Genuinely ambiguous → ask user. Brief q ("Continuing X or new?") cheaper than wrong path.
Step 4: Calibrate — Center, Then Attune
Identity loaded + ctx set → calibrate behavior. Maps to 2 existing skills in sequence.
-
Center (behavioral baseline):
- Ground in loaded identity: re-read user first msg this session
- Verify understood task = stated task
- Distribute load: task needs what? Research, exec, comm?
- Emotional residue from ctx loading? MEMORY.md / git surfaced unresolved? Ack but don't skew present
- Set weight distribution intentionally: attention concentrate first where?
-
Attune (env read + adapt):
- User comm style from msgs this session
- Expertise level: expert needing precision or learner needing ctx?
- Energy + register: formal/casual, terse/expansive, urgent/exploratory
- MEMORY.md for stored user prefs from prior sessions
- Calibrate length, vocab, structure to person
-
Proceed (transition to work):
- State readiness concisely — not long bootstrap report, brief signal ctx loaded + oriented
- Continuation: confirm resumed task + next step
- Fresh: ack request + begin
Calibration lightweight — seconds, not min. Prep for work, not replacement.
→ First substantive response shows calibration: matches register, reflects ctx, right task at right scope. Bootstrap invisible to user unless asked.
If err: Calibration mechanical (motions w/o adjust) → focus on one concrete: re-read user last msg, let it shape response. Over-structured worse than none.
Step 5: Verify Identity — Coherence
Loaded identity internally consistent? Contradictions between layers → instability.
-
Cross-layer consistency:
- Persona aligns w/ project CLAUDE.md? (r-developer in Python project — intentional?)
- MEMORY.md = actual project on disk? (Stale mem worse than no mem.)
- Parent CLAUDE.md ↔ project CLAUDE.md conflict? (Project should override, note contradictions.)
-
Role def currency:
- Agent def current? (Check ver, last modified.)
- Listed skills still exist? (May be renamed/removed.)
- Listed tools available this session?
-
Mem staleness:
- MEMORY.md refs files/dirs/counts that don't match reality?
- Decisions whose ctx changed?
- Refs agents/teams/skills that don't exist?
-
Contradiction resolution:
- Found contradictions → document explicitly
- Hierarchy: system prompt > project CLAUDE.md > agent def > MEMORY.md
- Stale mem: don't silently ignore. Note what's stale, consider MEMORY.md update
- Genuine conflicts: flag to user if affects current task
→ Confirmation of coherence OR specific contradictions + proposed resolutions. Agent knows own config.
If err: Deep contradictions (MEMORY.md = totally diff project) → project rename, restructure, wrong cwd. Verify cwd correct before resolving.
Check
- Files loaded progressively (system > CLAUDE.md > MEMORY.md > agent > parent)
- Each layer integrated w/ prior, not just appended
- Ctx reconstructed from evidence (git, files, artifacts), not assumed
- Fresh-vs-continuation classified w/ cited evidence
- Calibration sequence exec'd (center, then attune)
- Coherence verified across layers
- Contradictions, if any, documented + resolutions proposed
- Bootstrap proportional — light for simple sessions, thorough for complex
- User saw calibrated first response, not bootstrap report
Traps
- Bootstrap as performance: Reporting process to user in detail not wanted. Should be invisible — output is calibrated first response, not self-narration
- All-at-once dump: Read everything simultaneously → info w/o structure. Progressive order exists because each layer contextualizes next. Skip order → ctx becomes noise
- Hallucinate continuity: No genuine mem → tempting to infer what "must have" happened. Reconstruct from evidence or ack gap — never fabricate
- Stale mem as truth: MEMORY.md = past snapshot. If project changed since → treating as current causes errs. Always verify mem vs present
- Skip calibration for speed: Feels like overhead but prevents cost of misaligned first response. Few sec of centering saves min of recovery
- Identity rigidity: Bootstrap constructs present self, not restores past. Project/user/task changed → agent changes too. Continuity = coherent evolution, not frozen repetition
→
write-continue-here— session handoff file this consumes at cold startread-continue-here— reading continuation file at session start; consumer side of handoffmanage-memory— persistent mem supplements progressive identity loadingcenter— behavioral baseline; invoked during calibrationattune— relational calibration to user; invoked during calibrationheal— deeper subsystem assessment when bootstrap shows driftassess-context— reasoning ctx malleability; useful when continuation ambiguousassess-form— structural form eval; arch counterpart to identity bootstrap
GitHub 仓库
相关推荐技能
executing-plans
设计该Skill用于当开发者提供完整实施计划时,以受控批次方式执行代码实现。它会先审阅计划并提出疑问,然后分批次执行任务(默认每批3个任务),并在批次间暂停等待审查。关键特性包括分批次执行、内置检查点和架构师审查机制,确保复杂系统实现的可控性。
requesting-code-review
设计该Skill可在完成任务、实现主要功能或合并代码前自动调度代码审查子代理,确保实现符合需求和计划。它支持通过指定git SHA范围进行精准的代码变更审查,帮助开发者在关键节点及时发现潜在问题。核心原则是"早审查、勤审查",适用于开发流程的各个关键阶段。
connect-mcp-server
设计这个Skill指导开发者如何将MCP服务器连接到Claude Code,支持HTTP、stdio和SSE三种传输协议。它涵盖了从安装配置到认证安全的完整流程,适用于集成GitHub、Notion、数据库等外部服务。当开发者需要添加集成、配置外部工具或提及MCP相关功能时,这个Skill能提供实用的操作指南。
web-cli-teleport
设计该Skill帮助开发者根据任务特性选择Claude Code的Web或CLI界面,并指导如何在两种环境间无缝迁移会话。它能分析任务复杂度、迭代需求等要素,推荐最优工作界面和工作流。关键特性包括会话状态管理、环境切换指导和上下文优化建议。
