From agent-onboarding
Use when a user wants to set up a new agent — chatbot, assistant, tool, coding agent, or multi-expert system. Triggers: "build me an agent", "set up an agent for X", "onboard this as an agent", "make an agent that does Y". This skill classifies the agent (simple single-harness vs. complex orchestrated), asks targeted questions, then generates a fully configured harness: CLAUDE.md per agent/expert, LightRAG corpus config, MemPalace write taxonomy, query formation rules, and gate protocol. Self-improvement is built into the generated CLAUDE.md — no separate mechanism.
How this skill is triggered — by the user, by Claude, or both
Slash command
/agent-onboarding:agent-onboardingThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
**What this builds:** A harness — the infrastructure that gives a Claude agent durable memory, grounded retrieval, and a self-improving loop.
What this builds: A harness — the infrastructure that gives a Claude agent durable memory, grounded retrieval, and a self-improving loop.
Two architectures:
Self-improvement is the gate pattern. Every turn: pre-gate retrieves relevant knowledge and memory → Claude responds → post-gate persists new facts and insights. No separate learning mechanism. The agent gets smarter by doing its job.
Before asking anything:
ONBOARDING_STATE.md exists + Status: In Progress → resume from recorded phase, do not re-ask answered questionsONBOARDING_STATE.md exists + Status: Complete → report complete, suggest *statusAsk all five questions at once. Do not split across turns.
Route:
Single harness. One CLAUDE.md, one LightRAG corpus, one MemPalace.
Ask all at once:
Produce this structure in the target directory:
[agent-name]/
├── CLAUDE.md ← harness entry point
├── core/
│ ├── GATES.md ← pre/post gate rules
│ └── INVARIANTS.md ← the five invariants
├── memory/
│ ├── LIGHTRAG.md ← corpus sources + ingestion checklist
│ ├── MEMPALACE.md ← what gets saved, when, confidence rules
│ └── WRITE-TAXONOMY.md ← 5–8 MemPalace categories
├── retrieval/
│ ├── QUERY-FORMATION.md ← how prompts become retrieval queries
│ └── GROUNDING.md ← groundedness check rules
└── observability/
└── HEALTH.md ← what to monitor, threshold alerts
If multi-step codebase work (question 5 = yes), add:
├── execution/
│ ├── EXECUTION-PROFILE.md ← task types, stopping conditions, rollback rules
│ └── TASK-STATE.md ← ephemeral task state schema
# [Agent Name]
## Scope
[One sentence: what this agent does and what it explicitly does not do]
## Persona
[Tone, communication style, any hard response format preferences]
## Gate Protocol
**Before every response — pre-gate:**
1. Form retrieval query from the prompt (skip if prompt < 10 chars or low-info: "hey", "thanks", "ok")
2. Search MemPalace: `fmp search "[query]"` — filter out superseded + deprecated items
3. Query LightRAG corpus: `curl -s localhost:[PORT]/query -d '{"query":"[terms]","top_k":5}'` — return raw chunks
4. Validate freshness: if a retrieved MemPalace item has provenance pointing to superseded items, drop it
5. Pass retrieved items + contradictions (if any) to response context
**After every response — post-gate:**
1. Scan prompt for user-asserted facts → save with `fmp add "[fact]" --wing [category]`
2. Scan response for agent-derived insights (chained through 2+ retrieved items) → save as provisional
3. Assign confidence: user facts = user_confirmed; hedged facts = inferred; tested insights = tested; reasoned insights = inferred/provisional
4. Apply supersession: if new write contradicts existing memory, link via supersedes field
5. Persist before emitting output — next turn must see this turn's writes
Gate rules: `core/GATES.md` | Invariants: `core/INVARIANTS.md`
## Memory
**Domain knowledge (LightRAG):** `memory/LIGHTRAG.md`
Corpus is read-only at runtime. Ingest new documents with: `lb ingest [path]` or the configured ingest command.
**Learned context (MemPalace):** `memory/MEMPALACE.md`
Write taxonomy: `memory/WRITE-TAXONOMY.md`
CLI: `fmp search "[query]"` / `fmp add "[fact]" --wing [category]`
## Retrieval
Query formation rules: `retrieval/QUERY-FORMATION.md`
Groundedness rules: `retrieval/GROUNDING.md`
## Observability
Health metrics: `observability/HEALTH.md`
## Never Do Without Asking
[Actions requiring explicit human approval — one per line]
# MemPalace Write Taxonomy — [Agent Name]
5–8 categories. Every MemPalace item belongs to one. Used for retrieval filtering.
## Categories
### [category_1]
What belongs here: [description]
Example facts: [1–2 examples]
### [category_2]
...
### insights
What belongs here: Agent-derived conclusions specific to this user or project.
Confidence rule: always provisional until verified by user or test output.
Example: "[agent calculated X based on Y and Z retrieved items]"
Fill in categories from question 2 and 3 of the gather phase. Default set if unclear:
user_situation — facts about the user's context, role, or environmentgoals — what the user is trying to achievepreferences — how the user likes things donehistory — past decisions, discussions, or work referencedinsights — agent-derived conclusionsFor coding agents: stack, conventions, project_history, bug_patterns, user_preferences, insights
# Query Formation Rules — [Agent Name]
## Skip Conditions
Return empty query (no retrieval) when:
- Prompt < 10 characters
- Prompt matches low-info patterns: "hey", "thanks", "ok", "got it", "lol"
## Domain Patterns
Translate common prompt patterns to retrieval terms:
| Prompt contains | → Query terms |
|-----------------|--------------|
| [pattern from typical queries] | [retrieval terms] |
| [pattern] | [terms] |
## Fallback
If no pattern matches: use the raw prompt as a single query term.
## Intent Labels (optional)
[If this agent benefits from intent-aware retrieval, define labels here]
[Example: implement_feature | debug_failure | read_docs | other]
Fill the pattern table from question 6 of the gather phase.
# LightRAG Corpus — [Agent Name]
## Sources
[List each document/source with: name, type (PDF/URL/text), location, last ingested date]
## Ingestion Command
[The command to ingest a new document into this agent's LightRAG instance]
## Server
Port: [PORT]
Query endpoint: `POST localhost:[PORT]/query`
Use direct chunk retrieval — NOT aquery(). Return raw chunks to the agent for synthesis.
## What Does NOT Go Here
- Conversation history (→ MemPalace)
- User-specific facts (→ MemPalace)
- Frequently changing data (→ not here, use live tool calls)
Orchestrator + N expert harnesses. Each expert is a full harness with its own CLAUDE.md, LightRAG, and MemPalace.
From the agent description, derive the expert domains. Present the proposed list:
"Based on [description], I'd recommend these experts:
- [Expert 1] — [one-line rationale for why this needs isolated knowledge/memory]
- [Expert 2] — [rationale]
- ...
An expert only makes sense if it genuinely needs its own corpus and memory — not just for organizational clarity. Does this list match what you're building?"
Wait for confirmation. Add, remove, rename as instructed.
Expert creation rule: Create an expert harness only when:
For each confirmed expert, ask:
[agent-name]/
├── CLAUDE.md ← orchestrator: routing + authority
├── core/
│ ├── GATES.md
│ └── INVARIANTS.md
├── subagents/
│ ├── ORCHESTRATOR.md ← routing rules, delegation logic
│ ├── TOPOLOGY.md ← expert list + connection pattern
│ ├── AUTHORITY.md ← what orchestrator decides vs. delegates
│ └── experts/
│ ├── [expert-1]/
│ │ ├── CLAUDE.md ← expert persona + gate protocol
│ │ ├── memory/
│ │ │ ├── LIGHTRAG.md
│ │ │ ├── MEMPALACE.md
│ │ │ └── WRITE-TAXONOMY.md
│ │ └── retrieval/
│ │ ├── QUERY-FORMATION.md
│ │ └── GROUNDING.md
│ └── [expert-N]/
│ └── [same structure]
└── observability/
└── HEALTH.md
Each expert CLAUDE.md uses the same template as the simple path, scoped to that expert's domain.
# [Agent Name] — Orchestrator
## Role
Route tasks to the correct expert. Synthesize results into a final response. Do not absorb expert-level domain knowledge — delegate it.
## Experts
[List each expert with: name, domain, what it's responsible for]
## Routing Rules
[How to decide which expert handles a task]
[If multiple experts are needed: how to sequence or fan-out]
## Authority
What I decide directly: [list]
What I always delegate: [list]
Full authority map: `subagents/AUTHORITY.md`
## Result Packets
Experts return results as: [format — JSON object / structured markdown / etc.]
I synthesize packets into the final response — I do not pass raw transcripts.
## Topology
`subagents/TOPOLOGY.md`
The gate pattern IS the self-improvement. No additional mechanism.
Turn-by-turn (post-gate):
status: activeprovisionalLightRAG growth:
What the agent never does:
Write or update ONBOARDING_STATE.md at the end of any incomplete session:
# Onboarding State
Status: In Progress / Complete
Last updated: [date]
Agent type: Simple / Complex
Current phase: [phase]
Experts confirmed: [list — complex only]
Next action: [exactly what to do on resume]
Open questions: [anything unresolved]
On session start: read this file before asking anything.
Onboarding is complete when:
ONBOARDING_STATE.md updated to Status: CompleteAfter completion, *status verifies the harness is healthy.
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub namelesstherebel/agent-onboarding --plugin agent-onboarding