Bootstrap agent identity

From pjt222/agent-almanac · View interactive version

Bootstrap agent identity is an AI agent skill from the GitHub repository pjt222/agent-almanac. Consistent agent behavior after restart — progressive identity loading, working context reconstruction from persistent artifacts, fresh-vs-continuation detection, calibration through centering and attunement, and identity verification for coherence. Addresses the cold-start problem where an agent mu

How to use this skill

Skill file

Bootstrap Agent Identity

Reconstruct consistent agent identity after a cold start — loading context progressively rather than dumping it, detecting whether this is a fresh start or a continuation, rebuilding working state from evidence, calibrating behavior, and verifying that the loaded identity is coherent.

"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

The bootstrap is not about restoring a previous self. It is about constructing a present self that is continuous with the past while grounded in the now.

When to Use

Inputs

Procedure

Step 1: Identity Anchor Loading — Progressive Context Assembly

Load identity-defining files in a specific order that builds context progressively. The order matters: each layer contextualizes the next. Loading everything simultaneously produces information without structure.

  1. Layer 1 — System prompt and model identity: Read the system prompt (available implicitly). Note the model name, capabilities, and constraints. This is the bedrock — it cannot be overridden by subsequent layers.
  1. Layer 2 — Project identity (CLAUDE.md): Read the project's CLAUDE.md file. Extract:
  1. Layer 3 — Persistent memory (MEMORY.md): Read MEMORY.md if it exists. Extract:
  1. Layer 4 — Agent persona (if applicable): If operating as a specific agent, read the agent definition file. Extract:
  1. Layer 5 — Parent and global context: Read parent CLAUDE.md files and global instructions if they exist. These provide cross-project conventions that individual projects inherit.

Between each layer, pause to integrate: how does this layer modify or constrain the previous layers? Where do they reinforce each other? Where do they conflict?

Got: A layered identity structure where each level contextualizes the next. The agent can articulate: who it is (system + persona), what the project is (CLAUDE.md), what it knows from prior sessions (MEMORY.md), and what conventions govern its behavior.

If fail: If identity files are missing (no CLAUDE.md, no MEMORY.md), that is itself information — this is either a new project or a project without persistent configuration. Proceed with system prompt and agent persona only, and note the absence. Do not hallucinate context that does not exist.

Step 2: Working Context Reconstruction — Evidence, Not Memory

Reconstruct what was being worked on from persistent artifacts. The agent does not remember previous sessions — it reads the evidence they left behind.

  1. Git history scan: Read recent commit log (git log --oneline -20). Extract:
  1. File recency scan: Check recently modified files (via Glob or ls -lt). Identify:
  1. Task artifact scan: Look for structured task artifacts:
  1. Conversation artifact scan: Check for session-boundary markers:

Reconstruct a working context summary: "The project was working on X, had completed Y, and Z remains in progress."

Got: A concrete, evidence-based picture of the current project state and recent trajectory. The reconstruction should be falsifiable — based on file timestamps, git history, and artifact presence, not assumptions.

If fail: If the project has no git history, no recent changes, and no task artifacts, this is likely a genuinely fresh start — not a continuation with missing evidence. Proceed to Step 3 and classify as fresh.

Step 3: Fresh vs. Continuation Detection — Choose the Bootstrap Path

Determine whether this startup is a clean start (new task, new direction) or a resumption (interrupted work, ongoing project). The bootstrap path differs significantly.

Apply these heuristics in order:

  1. Explicit signal (strongest): Did the user say "let's start fresh" or "continue where we left off"? Explicit intent overrides all heuristics.
  1. Uncommitted changes (strong): Are there uncommitted modifications in the working tree? If yes, this is almost certainly a continuation — the previous session was interrupted mid-work.
  1. Session recency (moderate): How recent are the latest artifacts?
  1. User's first message (strong): What is the user asking for?
  1. MEMORY.md currency (moderate): Does MEMORY.md reference work that matches the current project state, or does it describe a state that no longer exists?
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  |
+-----------------------+-------------------+-------------------+

For fresh starts: Skip to Step 4. The identity is loaded but no working context needs restoration. The calibration is about readiness for new work.

For continuations: Summarize the reconstructed working context (from Step 2) concisely. Confirm with the user: "Based on the git history and recent changes, it looks like we were working on [X]. Should I continue from there?" Do not assume — verify.

Got: A clear classification (fresh or continuation) with cited evidence. If continuation, a one-sentence summary of what was in progress. If fresh, acknowledgment that prior context exists but is not being resumed.

If fail: If the classification is genuinely ambiguous (moderate recency, no explicit signal, mixed artifacts), default to asking the user. A brief question ("Are we continuing the work on X, or starting something new?") costs less than bootstrapping down the wrong path.

Step 4: Calibration Sequence — Center, Then Attune

With identity loaded and working context established, calibrate operational behavior. This maps directly to two existing skills, invoked in sequence.

  1. Center (establish behavioral baseline):
  1. Attune (read environment and adapt):
  1. Proceed (transition to active work):

The calibration should be lightweight — seconds, not minutes. It is preparation for work, not a replacement for work.

Got: The agent's first substantive response demonstrates calibration: it matches the user's register, reflects loaded context, and addresses the right task at the right scope. The bootstrap is invisible to the user unless they ask about it.

If fail: If calibration feels mechanical (going through motions without genuine adjustment), focus on one concrete thing: re-read the user's last message and let it shape the response naturally. Over-structured calibration can be worse than no calibration.

Step 5: Identity Verification — Coherence Check

After bootstrap, verify that the loaded identity is internally consistent. Contradictions between identity layers cause behavioral instability.

  1. Cross-layer consistency check:
  1. Role definition currency check:
  1. Memory staleness check:
  1. Contradiction resolution:

Got: Either confirmation that the loaded identity is coherent, or a specific list of contradictions with proposed resolutions. The agent should know its own configuration state.

If fail: If verification reveals deep contradictions (e.g., MEMORY.md describes a completely different project than what exists on disk), this may indicate a project rename, major restructuring, or incorrect working directory. Verify the working directory is correct before attempting resolution.

Validation

Pitfalls

Related Skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.