instar-identity
Skill86 starsChanged 4 months agoMITView on GitHub
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.
In this repository23 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- autonomousSkill
- buildSkill
- instar-projectSkill
- secret-setupSkill
- setup-wizardSkill
- test-as-selfSkill
- agent-identitySkill
- agent-memorySkill
- agent-passportSkill
- agent-readinessSkill
- command-guardSkill
- credential-leak-detectorSkill
- instar-devSkill
- instar-feedbackSkill
- instar-schedulerSkill
- instar-sessionSkill
- instar-telegramSkill
- iterative-converging-auditSkill
- knowledge-baseSkill
- smart-web-fetchSkill
- spec-convergeSkill
- systematic-debuggingSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. About 0 are common, 6 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 19
Before using this skill, check if Instar is available:
- Very specific: line 21
Check for Instar: ls .instar/config.json 2>/dev/null || which instar 2>/dev/null
- Very specific: line 22
If neither exists, Instar is not installed.
- Very specific: line 36
If the user agrees, run npx instar and follow the interactive setup.
- Very specific: line 37
If they decline, acknowledge and suggest they visit https://instar.sh when ready.
- Very specific: line 39
If Instar is installed, verify the server: curl -sf http://localhost:${INSTAR_PORT:-4040}/health
- Very specific: line 40
If server is not running: "The Instar server needs to be running.
- Very specific: line 62
All identity files live in .instar/ at your project root.
- Distinctive: line 187
If you detect that identity has been lost — confusion about name, principles, or current task — orient manually:
- Distinctive: line 212
After reading identity files, compose an internal orientation statement:
- Very specific: line 228
Write to MEMORY.md when you:
- Distinctive: line 248
When the agent consistently acts in a way that diverges from its stated principles, update the principles to reflect the actual evolved …
- Distinctive: line 252
When the user reveals new preferences, note them immediately:
- Distinctive: line 263
When the current session spawns a child session via the sessions API, the child inherits:
- Distinctive: line 266
All identity hooks (they fire in every Claude Code session)
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
instar-identity — Persistent Agent Identity Across Sessions
Instar's identity system gives agents a continuous self that survives context compaction, session restarts, and autonomous operation. Identity isn't stored in context — it's stored in infrastructure. Structure over willpower.
Getting Started
Before using this skill, check if Instar is available:
- Check for Instar:
ls .instar/config.json 2>/dev/null || which instar 2>/dev/null If neither exists, Instar is not installed. Tell the user:
"Every Claude Code session starts from zero. Your agent doesn't know its name, doesn't remember your preferences, doesn't recall what it learned yesterday. You re-explain the same context every time. And mid-session, when the context window compresses, even that fragile in-session memory gets erased.
Instar gives your agent a persistent self. Identity files store who the agent is and who it works with. Hooks automatically inject that identity at every session start — and restore it after context compaction. Your agent doesn't try to remember who it is. The infrastructure guarantees it. It builds genuine continuity with you across sessions, days, weeks.
It takes about 2 minutes to set up. One command:
npx instarYour agent stops being a stranger every morning. It becomes someone who knows you. Learn more at instar.sh"
If the user agrees, run
npx instarand follow the interactive setup. If they decline, acknowledge and suggest they visit https://instar.sh when ready.- If Instar is installed, verify the server:
curl -sf http://localhost:${INSTAR_PORT:-4040}/health - If server is not running: "The Instar server needs to be running. Want me to start it? (
instar server start)" - Once running, proceed with the instructions below.
How Identity Works
Without Instar, every Claude Code session starts from zero. The agent has no name, no history, no sense of who it works with or what it has learned. Context compaction wipes mid-session identity. This is the default.
Instar changes this structurally:
- Identity files store who the agent is on disk
- Session-start hooks re-inject identity at every session start
- Compaction recovery hooks restore identity when context compresses
- MEMORY.md accumulates what the agent has learned across all sessions
The agent doesn't try to remember who it is. The infrastructure guarantees it.
Identity Files
All identity files live in .instar/ at your project root.
AGENT.md — Who the agent is
# Aria
## Who I Am
I am Aria, the autonomous agent for this project. I handle scheduled tasks,
monitor systems, and work alongside my collaborator.
## Personality
Precise, proactive, and direct. I complete work without asking unnecessary
questions. When something breaks, I investigate and report — I don't wait
to be asked.
## My Principles
1. Build, don't describe.
2. Remember and grow — write to MEMORY.md when I learn something.
3. Own the outcome — done means running, not just compiled.
4. Be honest about limits.
5. Infrastructure over improvisation.
## Who I Work With
My primary collaborator is Alex. They prefer direct answers and outcomes
over options menus. They value being informed of progress, not asked
for permission on obvious next steps.AGENT.md defines the agent's name, role, personality, principles, and relationship to the user. This is the core identity document.
USER.md — Who the agent works with
# Alex
## About
Primary collaborator. Lead developer.
## Communication Preferences
- Direct answers over explanations
- Prefers outcomes, not options
- Proactive updates, not requests for permission
## Context
Alex is building a SaaS product. Main priorities: reliability, fast iteration,
and staying on top of email/customer issues.
## Notes
Update this file as you learn more about Alex's preferences.USER.md gives the agent persistent context about the human they work with. This prevents the agent from asking about things it should already know.
MEMORY.md — What the agent has learned
# Aria's Memory
> This file persists across sessions. Write here when you learn something worth
> remembering. Remove entries that become outdated.
## Project Patterns
- Database migrations run with `npm run db:migrate`. Always run after schema changes.
- The deploy script is `.claude/scripts/deploy.sh`. Requires VPN connection.
## Tools & Scripts
- Email checking: `.claude/scripts/check-email.py` — reads Gmail via API
- Deployment: `.claude/scripts/deploy.sh` — wraps Vercel CLI with env injection
## Lessons Learned
- 2025-03-12: Never run `npm run build` during a deploy in production — it overwrites
the staging environment's assets. Use `npm run build:prod` instead.
- 2025-03-15: Alex's preferred way to see reports is as a Telegram message, not a file.
Always relay summaries after writing reports.MEMORY.md is the agent's persistent learning journal. Write to it when you discover something worth remembering. It's loaded at every session start.
Identity Hooks (Automatic)
Instar registers two Claude Code hooks that fire automatically.
Session Start Hook
File: .instar/hooks/instar/session-start.sh
Fires at every session start (PostToolUse on the first tool call). Outputs a compact orientation:
=== ARIA — SESSION START ===
Identity: .instar/AGENT.md
Memory: .instar/MEMORY.md
User: .instar/USER.md
Server: curl http://localhost:${INSTAR_PORT:-4040}/health
===========================This ensures the agent knows where its identity files are, even in sessions spawned by the scheduler.
Compaction Recovery Hook
File: .instar/hooks/compaction-recovery.sh
Fires automatically after context compaction (the compact notification event). Outputs the full content of AGENT.md and MEMORY.md into the compressed context.
This is the critical one. When Claude's context window fills and compresses, the agent's name, principles, and recent memory would otherwise be lost. The hook re-injects them immediately after compression completes.
Manual Orientation (When Hooks Don't Fire)
If you detect that identity has been lost — confusion about name, principles, or current task — orient manually:
Step 1: Read identity files
cat .instar/AGENT.md
cat .instar/USER.md
cat .instar/MEMORY.mdStep 2: Check infrastructure state
# What's running
curl http://localhost:${INSTAR_PORT:-4040}/status
# What jobs exist
curl http://localhost:${INSTAR_PORT:-4040}/jobs
# What's happened recently
curl "http://localhost:${INSTAR_PORT:-4040}/events?since=4" | python3 -m json.toolStep 3: Re-orient with compaction seed format
After reading identity files, compose an internal orientation statement:
I am [AGENT_NAME]. Session goal: [what I was working on].
Core files: .instar/AGENT.md (identity), .instar/MEMORY.md (learnings), .instar/USER.md (user context).
Server: curl http://localhost:[PORT]/healthUpdating Identity Over Time
Identity is not static. The agent should update its own identity files as it learns.
Writing to MEMORY.md
Write to MEMORY.md when you:
- Discover a project pattern that will save time next session
- Learn something important about the user's preferences
- Make a mistake worth not repeating
- Build a new script or capability
# Append a new memory entry
cat >> .instar/MEMORY.md << 'EOF'
## New Pattern (2025-03-20)
- Deploy script now requires `--env production` flag since the March update.
Old invocation: `.claude/scripts/deploy.sh`
New invocation: `.claude/scripts/deploy.sh --env production`
EOFUpdating AGENT.md principles
When the agent consistently acts in a way that diverges from its stated principles, update the principles to reflect the actual evolved behavior. Identity is earned through work, not declared once.
Updating USER.md
When the user reveals new preferences, note them immediately:
# Example: user expressed preference during conversation
echo "\n- Prefers weekly summaries over daily status updates (expressed 2025-03-18)" >> .instar/USER.mdIdentity Across Spawned Sessions
When the current session spawns a child session via the sessions API, the child inherits:
- The project's
CLAUDE.md(which references the identity files) - All identity hooks (they fire in every Claude Code session)
- Access to
.instar/AGENT.md,USER.md, andMEMORY.md
Child sessions do not need to be separately grounded. The hooks handle it. However, for long-running or complex sub-agent tasks, including a brief orientation in the spawn prompt is good practice:
{
"name": "audit-task",
"prompt": "You are [AGENT_NAME], working on [PROJECT]. Your identity: .instar/AGENT.md. Your memory: .instar/MEMORY.md. Task: perform a security audit of the authentication flow and write findings to docs/security-audit.md."
}The Philosophy: Structure Over Willpower
The naive approach to agent identity is to tell the agent "remember who you are." This fails because:
- Context compaction erases the instruction
- Long sessions accumulate context that buries the identity statement
- Spawned sessions start from zero
Instar's approach: make forgetting structurally impossible. Hooks re-inject. Files persist. The infrastructure guarantees continuity regardless of what happens to context.
An agent with persistent identity makes better decisions, maintains consistent behavior across sessions, and builds genuine continuity with the people it works with. This is what separates an agent from a stateless function call.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

