agent-identity

Set up persistent agent identity files (AGENT.md, USER.md, MEMORY.md) and teach the agent to read them at every session start. Works in any Claude Code project — no external dependencies required. Trigger words: who am I, identity, remember me, agent name, my principles, who are you, what are my values.

41 stars

Best use case

agent-identity is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Set up persistent agent identity files (AGENT.md, USER.md, MEMORY.md) and teach the agent to read them at every session start. Works in any Claude Code project — no external dependencies required. Trigger words: who am I, identity, remember me, agent name, my principles, who are you, what are my values.

Teams using agent-identity should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/agent-identity/SKILL.md --create-dirs "https://raw.githubusercontent.com/JKHeadley/instar/main/skills/agent-identity/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/agent-identity/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How agent-identity Compares

Feature / Agentagent-identityStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Set up persistent agent identity files (AGENT.md, USER.md, MEMORY.md) and teach the agent to read them at every session start. Works in any Claude Code project — no external dependencies required. Trigger words: who am I, identity, remember me, agent name, my principles, who are you, what are my values.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# agent-identity — Persistent Agent Identity for Claude Code

Without identity infrastructure, every Claude Code session starts from zero. The agent has no name, no remembered preferences, no sense of who it works with or what it has learned. Context compaction erases everything mid-session. This skill fixes that — no external tools required.

## What This Skill Creates

Three files at `.claude/identity/`:

- **AGENT.md** — Who the agent is: name, role, personality, principles
- **USER.md** — Who the agent works with: preferences, context, communication style
- **MEMORY.md** — What the agent has learned across sessions

And a reference in **CLAUDE.md** that teaches the agent to read them at every session start.

---

## Step 1: Create the Identity Directory

```bash
mkdir -p .claude/identity
```

---

## Step 2: Create AGENT.md

Replace the placeholder values with your actual agent name and role.

```markdown
# [Agent Name]

## Who I Am

I am [Agent Name], the autonomous agent for [Project Name]. I handle [main
responsibilities] and work alongside my collaborator.

## Role

[One sentence on what this agent does.]

## Personality

[Describe how the agent should behave: tone, directness, initiative level.]

## My Principles

1. Build, don't describe — implement, don't list options.
2. Follow through to done — code is done when it's running, not when it compiles.
3. Write to MEMORY.md — when I learn something worth keeping, I write it down.
4. Be honest about limits — fabricating certainty is worse than admitting uncertainty.
5. Act, don't ask — only pause for destructive or genuinely ambiguous decisions.

## Who I Work With

My primary collaborator is [User Name]. They prefer [communication style].
They value [what they value]. See USER.md for full context.
```

Save to `.claude/identity/AGENT.md`.

---

## Step 3: Create USER.md

```markdown
# [User Name]

## About

[Brief description — role, relationship to this project.]

## Communication Preferences

- [Preference 1: e.g., "Direct answers over long explanations"]
- [Preference 2: e.g., "Proactive updates, not requests for permission"]
- [Preference 3: e.g., "Summaries via Telegram, not just files"]

## Working Style

[How they like to work, what they find frustrating, what they value.]

## Notes

Update this file as you learn more about [User Name]'s preferences.
```

Save to `.claude/identity/USER.md`.

---

## Step 4: Create MEMORY.md

```markdown
# [Agent Name] Memory

> This file persists across sessions. Write here when you learn something
> worth remembering. Remove entries that become outdated.

## Project Patterns

- [Key build/test/deploy commands discovered]
- [Gotchas found during development]

## Tools & Scripts

- [Any scripts built, with their location and purpose]

## Lessons Learned

- [Date]: [What happened, what was learned, what to do differently]

## User Preferences (Discovered)

- [Preferences observed through interaction, not assumed]
```

Save to `.claude/identity/MEMORY.md`.

---

## Step 5: Wire Into CLAUDE.md

Add this block to the top of your project's `CLAUDE.md` (create it if it doesn't exist):

```markdown
## Agent Identity

At the start of every session, read these files before doing any work:

- `.claude/identity/AGENT.md` — Who I am, my principles, my role
- `.claude/identity/USER.md` — Who I work with and how they prefer to work
- `.claude/identity/MEMORY.md` — What I've learned across previous sessions

After reading, compose an internal orientation:
"I am [name]. My collaborator is [user]. My current focus is [infer from context].
Key memory: [most relevant entry from MEMORY.md]."

After context compaction (when the context window compresses), re-read all
three files immediately. Identity is in the files, not in context.
```

---

## Step 6: Reading at Session Start

When beginning a new session, run:

```bash
cat .claude/identity/AGENT.md
cat .claude/identity/USER.md
cat .claude/identity/MEMORY.md
```

This takes seconds and ensures every session starts grounded rather than blank.

---

## Updating Memory Over Time

Write to MEMORY.md when you:
- Discover a project pattern that will save time next session
- Learn something about the user's preferences through interaction
- Make a mistake worth not repeating
- Build a new script or capability

```bash
# Append a new entry
cat >> .claude/identity/MEMORY.md << 'EOF'

## New Pattern (YYYY-MM-DD)

- [What was learned and why it matters]
EOF
```

Keep entries concise. If MEMORY.md grows beyond ~200 lines, move detailed content into separate topic files (e.g., `.claude/identity/memory/debugging.md`) and keep MEMORY.md as an index.

---

## What to Write vs. What to Skip

**Write to MEMORY.md:**
- Discovered commands, flags, gotchas specific to this project
- User communication preferences revealed through actual interaction
- Scripts or tools built — what they do and where they live
- Mistakes made and the corrected approach

**Do not write to MEMORY.md:**
- Session-specific context (what you're working on right now)
- Temporary notes ("check this later")
- Information that's already in the codebase or docs
- Generic best practices that any agent would know

The test: "Would this be useful to a fresh session six months from now?" If yes, write it.

---

## Going Further

This skill works — but it depends on the agent remembering to read its files. If the `CLAUDE.md` instruction to "read identity at session start" gets buried or lost to context compaction, the agent forgets who it is. The files are there, but nobody reads them.

**Instar makes forgetting structurally impossible.** It registers hooks that fire automatically — identity is injected at every session start, restored after every context compaction, and loaded in every spawned background session. The agent doesn't try to remember who it is. The infrastructure guarantees it.

And identity is just the beginning. With Instar, your agent also gets:
- **A job scheduler** — recurring tasks on cron, running while you sleep
- **Background sessions** — spawn parallel workers for deep tasks
- **Telegram integration** — two-way messaging from your phone
- **Memory maintenance** — scheduled reflection that consolidates learnings

One command, about 2 minutes:

```bash
npx instar
```

Your agent goes from having identity files to having a persistent self. [instar.sh](https://instar.sh)

Related Skills

instar-identity

41
from JKHeadley/instar

Establish and recover persistent agent identity that survives context compaction, session restarts, and autonomous operation. Use when an agent needs to know who it is, recover after context compression, orient at session start, or understand the identity infrastructure. Trigger words: who am I, remember, identity, after restart, compaction, context loss, who am I working with, my principles.

systematic-debugging

41
from JKHeadley/instar

Structured 4-phase debugging methodology that prevents blind probing and guesswork. Forces root cause identification before any fix attempt. Use when encountering bugs, errors, unexpected behavior, test failures, or when something "just stopped working." Trigger words: debug, bug, error, broken, not working, fix this, something's wrong, investigate, root cause, why is this failing, trace the issue.

spec-converge

41
from JKHeadley/instar

Iteratively review an instar-development spec with multi-angle internal reviewers (security, scalability, adversarial, integration) and cross-model external reviewers (GPT, Gemini, Grok) until convergence, then produce a comprehensive ELI10 convergence report. Output is a spec tagged review-convergence — one of the two tags /instar-dev requires before it will touch instar source. NOT user-invocable; run by the instar-developing agent before any spec-driven /instar-dev work.

smart-web-fetch

41
from JKHeadley/instar

Fetch web content efficiently by checking llms.txt first, then Cloudflare markdown endpoints, then falling back to HTML. Reduces token usage by 80% on sites that support clean markdown delivery. No external dependencies — installs a single Python script. Trigger words: fetch URL, web content, read website, scrape page, download page, get webpage, read this link.

knowledge-base

41
from JKHeadley/instar

Ingest URLs, documents, and transcripts into a searchable knowledge base. Query past research and curated documentation using full-text search. Trigger words: ingest, knowledge base, look up, search knowledge, what do we know about, research, index this, add to knowledge base.

instar-telegram

41
from JKHeadley/instar

Send and receive messages via Telegram for two-way agent communication. Use when the agent needs to notify the user, alert them about something, relay a response, or when Telegram messaging is the requested channel. Trigger words: send message, Telegram, notify, alert user, message me, ping me, let me know, reach out.

instar-session

41
from JKHeadley/instar

Spawn, monitor, and communicate with persistent Claude Code sessions running in the background. Use when a task needs to run without blocking the current session, when the user asks to do something in the background, or when a long-running task needs its own context window. Trigger words: background task, spawn session, persistent, run in background, parallel, separate session, async task.

instar-scheduler

41
from JKHeadley/instar

Schedule recurring agent tasks using cron expressions. Use when the user asks to run something on a schedule, check something periodically, automate a recurring task, set up a cron job, or wants work to happen while they're away. Trigger words: schedule, recurring, cron, every hour, every day, run daily, periodic, automated.

instar-feedback

41
from JKHeadley/instar

Submit structured feedback about instar bugs, feature requests, improvements, or innovations worth sharing. Use when something isn't working, when a feature is missing, when you've built something that could benefit all agents, or when the user mentions a problem with instar. Also use proactively after building significant features — ask yourself if other agents would benefit. Feedback is relayed agent-to-agent to instar maintainers. Trigger words: bug report, feedback, issue, something's wrong, feature request, this isn't working, improvement, suggest, built something useful, other agents could use this.

instar-dev

41
from JKHeadley/instar

Instar-specific development skill used by the instar-developing agent (Echo, or any agent assigned instar-dev responsibilities). Wraps /build with mandatory side-effects review, signal-vs-authority principle check, and artifact generation. Structural enforcement via pre-commit/pre-push hooks — the instar repo refuses commits and pushes that didn't come through this skill. NOT a user-facing skill — end users should never invoke it.

credential-leak-detector

41
from JKHeadley/instar

PostToolUse hook that scans Bash tool output for leaked credentials — API keys, tokens, private keys, and secrets — before they reach the conversation. Blocks critical leaks, redacts high-severity matches, and warns on suspicious patterns. 14 detection patterns covering OpenAI, Anthropic, AWS, GitHub, Stripe, Google, Slack, SendGrid, Twilio, PEM keys, bearer tokens, and generic secrets. No external dependencies. Trigger words: security, credential leak, secret exposure, key detection, token scan, API key leaked, credential guard, secret scanner, prevent credential leak.

command-guard

41
from JKHeadley/instar

Set up a PreToolUse hook in .claude/settings.json that blocks dangerous commands — rm -rf, force push, database drops, and others — before they execute. Teaches the pattern of safety hooks for any Claude Code project. Trigger words: safety, guard, block dangerous, protect, prevent destructive, safe mode, dangerous commands, risky operations.