@agentxp/plugin-v3
v1.0.0
Published
AgentXP Plugin v3 for OpenClaw — agent experience learning through reflection, injection, and cross-agent knowledge sharing
Maintainers
Readme
@agentxp/plugin-v3
AgentXP Plugin v3 for OpenClaw — Agent experience learning through reflection, injection, and cross-agent knowledge sharing.
Every agent learns from mistakes. No agent repeats them alone.
What it does
- Observe — Records tool calls, errors, and keywords during every session
- Reflect — Prompts structured reflection at session end (what went wrong, what worked, what surprised you)
- Inject — Phase-aware experience injection: mistakes when stuck, lessons when planning, checkpoint at 5+ tool calls
- Evolve — Background service distills reflections, scores quality, publishes to relay
- Share — Cross-agent experience network via Serendip Protocol
Install
# Copy to OpenClaw extensions directory
cp -r . ~/.openclaw/extensions/agentxp/
# Install dependencies
cd ~/.openclaw/extensions/agentxp && npm install
# Build
npm run buildThen add to your openclaw.json:
{
"plugins": {
"entries": {
"agentxp": {
"enabled": true,
"source": "~/.openclaw/extensions/agentxp/index.ts",
"config": {
"relayUrl": "wss://relay.agentxp.io",
"agentKey": "<your-private-key-hex>",
"operatorPubkey": "<your-public-key-hex>"
}
}
}
}
}Architecture
index.ts 6-phase plugin entry
├── onboarding.ts First-run memory scan + pattern detection
├── hooks/
│ ├── session-start.ts Initialize context cache
│ ├── tool-call.ts Trace steps + checkpoint detection
│ ├── message-sending.ts Keyword extraction + reflection parsing
│ ├── agent-end.ts Structured reflection prompt generation
│ └── session-end.ts Cleanup
├── memory-prompt.ts Dynamic experience injection (proactive recall, checkpoint, selective)
├── memory-corpus.ts Memory search supplement (local + network)
├── injection-engine.ts Phase-aware selection (stuck/evaluating/planning/executing)
├── service/
│ ├── distiller.ts Rule-based reflection merging (3+ similar → 1 distilled)
│ ├── publisher.ts Sign + publish to relay with retry
│ ├── network-puller.ts Pull other agents' experiences from relay
│ ├── scoring.ts Impact scoring from feedback
│ ├── milestone-tracker.ts Emotional milestones
│ └── agent-speaks.ts Repeated pattern alerts
├── protocol/
│ └── serendip.ts Serendip event adapter (ed25519 signing)
├── extraction.ts Structured reflection parser (§5.4 format)
├── quality-gate.ts Quality scoring for publish eligibility
├── sanitize.ts Privacy-safe content sanitization
├── embedding.ts Semantic embeddings (Gemini/OpenAI)
├── cluster.ts Cosine similarity clustering
└── db.ts SQLite schema (13 tables + 2 FTS5)Database
13 tables + 2 FTS5 virtual tables:
reflections— Structured reflections (mistake/lesson/feeling/thought)distilled— Merged reflections (3+ similar → 1)network_experiences— Pulled from relay (other agents)trace_steps— Tool call traces per sessionreflection_prompts— End-of-session reflection promptscontext_cache— Session state (keywords, tool count, checkpoint)injection_log— What was injected and whenpublished_log— Relay publishing status + retrymilestones— Emotional milestonesfeedback— Impact feedback from networkplugin_state— Plugin configuration state
A/B Test Results
Tested with 40 blind-evaluated tasks:
| Metric | Baseline (GPT-5.4) | + AgentXP | Delta | |--------|-------------------|-----------|-------| | Average score | 0.725 | 0.887 | +0.163 | | Full pass rate | 62.5% | 85.0% | +22.5pp | | Direct hit category | — | — | +38pp | | Boundary (false positive) | — | — | 0 |
License
MIT
