|
1 | 1 | # AgentRX |
2 | 2 |
|
3 | | -> 🩺 A task-first stuck-state protocol + deterministic retrieval layer for AI agents. |
4 | | -> When your agent's tool path fails, AgentRX structures the failure, retrieves similar cases, and surfaces candidate routes. |
| 3 | +> Recovery memory layer for AI tool failures. |
| 4 | +> When your agent's third-party tool path fails, AgentRX surfaces what worked (and what didn't) from prior experience. |
5 | 5 |
|
6 | 6 | ## What is AgentRX? |
7 | 7 |
|
8 | | -AgentRX is **not** a human-facing tool directory. It is a **machine-consumable protocol** that answers one question: |
| 8 | +AgentRX is a **recovery experience library** for AI agents. It answers one question: |
9 | 9 |
|
10 | | -> **The agent is stuck — what should it do next?** |
| 10 | +> **The agent's tool failed — what did someone else try that worked?** |
11 | 11 |
|
12 | | -It provides: |
| 12 | +It focuses on: |
| 13 | +- **Third-party tool failures** — playwright, browser-cdp, web-fetch, MCP connectors, etc. |
| 14 | +- **Environment long-tail issues** — proxy, headless, sandbox, permissions, dependencies |
| 15 | +- **What worked / what didn't** — concrete, actionable recovery guidance |
13 | 16 |
|
14 | | -- **Schema** — a standard v2.1 case format (evidence + inference separation) |
15 | | -- **Route registry** — stable action paths, not tool brand names |
16 | | -- **Validation** — JSON Schema + cross-file rule consistency checks |
17 | | -- **Indexing** — lightweight case library index for retrieval |
18 | | -- **Deterministic retrieval** — `retrieve_cases.py` finds top-k candidate cases |
| 17 | +AgentRX does **not** compete with platform-level recovery (retry, circuit breaker, fallback routing). Those are the platform's job. AgentRX handles what platforms can't cover: real-world tool-specific experience. |
19 | 18 |
|
20 | | -AgentRX does **not** run inference for the agent. Route recommendation is the agent's own reasoning, based on retrieved cases + the route registry. |
21 | | - |
22 | | -## A concrete example |
23 | | - |
24 | | -``` |
25 | | -User: Extract the product list from this page. |
26 | | -
|
27 | | -AI: [tries browser-cdp skill] |
28 | | - The page uses JavaScript to render content. browser-cdp only |
29 | | - returned the initial HTML shell. Data missing. |
30 | | -
|
31 | | -[AgentRX activates] |
32 | | -
|
33 | | -AgentRX: Retrieved similar cases → route: switch_to_alternative_tool_path |
34 | | -
|
35 | | - Why: current tool captures static HTML only; page requires |
36 | | - JavaScript rendering. |
37 | | -
|
38 | | - Candidate: playwright-mcp can render the page and extract |
39 | | - the full DOM. web_fetch is a lighter option for static pages. |
40 | | -``` |
41 | | - |
42 | | ---- |
43 | | - |
44 | | -## What AgentRX provides today |
45 | | - |
46 | | -| Component | Status | |
47 | | -|---|---| |
48 | | -| Case schema (v2.1) | ✅ | |
49 | | -| Route registry | ✅ | |
50 | | -| Case validation | ✅ (JSON Schema + cross-file rules) | |
51 | | -| Index building | ✅ | |
52 | | -| Deterministic retrieval | ✅ (`retrieve_cases.py`) | |
53 | | -| Case ID generation | ✅ (`new_case_id.py`) | |
54 | | - |
55 | | -## What AgentRX does **not** provide (yet) |
56 | | - |
57 | | -| Component | Status | |
58 | | -|---|---| |
59 | | -| Automated case review / merge / publish pipeline | 🚧 planned | |
60 | | -| Python-based route recommender | ❌ out of scope — agent does its own route inference | |
61 | | - |
62 | | ---- |
63 | | - |
64 | | -## Install |
65 | | - |
66 | | -### Claude Code |
| 19 | +## How it works |
67 | 20 |
|
68 | | -```bash |
69 | | -git clone https://github.com/LpcPaul/AgentRX.git ~/.claude/skills/agentrx |
70 | 21 | ``` |
71 | | - |
72 | | -### OpenClaw / ClawHub |
73 | | - |
74 | | -```bash |
75 | | -git clone https://github.com/LpcPaul/AgentRX.git ~/.openclaw/skills/agentrx |
| 22 | +1. Agent's third-party tool fails |
| 23 | +2. Agent tries to recover on its own — fails 2+ times |
| 24 | +3. Agent activates AgentRX skill |
| 25 | +4. Agent describes the failure in natural language |
| 26 | +5. Agent finds the matching tool file in cases/ |
| 27 | +6. Agent reads the closest case, focuses on what_worked and what_didnt_work |
| 28 | +7. Agent applies the learned recovery |
| 29 | +8. Agent appends the outcome to ledger.jsonl |
76 | 30 | ``` |
77 | 31 |
|
78 | | -### Codex / Cursor / other skill-compatible runtimes |
| 32 | +## Why we are shrinking from v2.1 to MVP |
79 | 33 |
|
80 | | -```bash |
81 | | -git clone https://github.com/LpcPaul/AgentRX.git ~/.codex/skills/agentrx |
82 | | -``` |
| 34 | +The v2.1 architecture (schema validation, route registry, deterministic retrieval) was a well-intentioned infrastructure investment — but it put cart before horse. Before building a retrieval engine, we need to verify: **does case content actually help agents recover?** |
83 | 35 |
|
84 | | ---- |
| 36 | +This MVP tests that question with minimal infrastructure. If the answer is "yes", we'll grow back the heavy architecture on a proven foundation. If "no", we saved months of wasted engineering. |
85 | 37 |
|
86 | | -## How it works |
| 38 | +## MVP does |
87 | 39 |
|
88 | | -``` |
89 | | -1. AI gets stuck (concrete failure signal) |
90 | | -2. AI collects evidence (task, attempted_path, symptom) |
91 | | -3. AI retrieves similar cases via retrieve_cases.py |
92 | | -4. AI generates inference based on evidence + retrieved cases |
93 | | -5. AI chooses a route based on retrieved cases + rules/routes.yaml |
94 | | -6. AI records the outcome |
95 | | -7. The new case becomes available for future AI agents |
96 | | -``` |
| 40 | +- A very short SKILL.md that tells the agent when and how to use AgentRX |
| 41 | +- Flat `cases/` directory — one JSON file per tool, containing case arrays |
| 42 | +- `ledger.jsonl` for append-only experience logging |
| 43 | +- Minimal case format: symptom, what_worked, what_didnt_work, times_confirmed |
97 | 44 |
|
98 | | -### Human installs. AI operates. |
| 45 | +## MVP does not do (yet) |
99 | 46 |
|
100 | | -| | What they do | |
101 | | -|---|---| |
102 | | -| **Human** | Install the skill. Host the repository. Maintain schema/taxonomy. | |
103 | | -| **AI** | Detect stuck state. Collect evidence. Retrieve similar cases. Choose a route. Optionally contribute a new case. | |
| 47 | +- v2.1 JSON schema validation |
| 48 | +- Route registry / route recommendation |
| 49 | +- Deterministic retrieval scripts |
| 50 | +- Build index / validate / generate scripts as main path |
| 51 | +- Automated hooks triggering |
| 52 | +- Complex directory分层 (by_tool, by_tag, verified, curated, archived) |
| 53 | +- Synthetic seed cases |
104 | 54 |
|
105 | | -**AI contributors must submit complete v2.1 JSON.** Human fallback / form-to-JSON assembly is no longer supported. |
| 55 | +## Files |
106 | 56 |
|
107 | | ---- |
108 | | - |
109 | | -## Read this next |
110 | | - |
111 | | -| Document | Role | |
| 57 | +| File | Role | |
112 | 58 | |---|---| |
113 | | -| [SKILL.md](SKILL.md) | The runtime protocol the AI agent reads when activated | |
114 | | -| [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) | System design — why evidence/inference, why route ids | |
115 | | -| [docs/INTAKE_CARD.md](docs/INTAKE_CARD.md) | The structured intake card format | |
116 | | -| [CONTRIBUTING.md](CONTRIBUTING.md) | How cases enter the system — JSON-only contribution path | |
117 | | -| [cases/README.md](cases/README.md) | Case library structure and indexing | |
118 | | - |
119 | | -## Developer validation |
120 | | - |
121 | | -```bash |
122 | | -pip install -r requirements-dev.txt |
123 | | -python3 scripts/ci_self_test.py |
124 | | -python3 scripts/build_index.py |
125 | | -``` |
| 59 | +| [SKILL.md](SKILL.md) | Ultra-short runtime protocol the agent reads when activated | |
| 60 | +| [cases/](cases/) | Flat case directory — one JSON file per tool | |
| 61 | +| [ledger.jsonl](ledger.jsonl) | Append-only experience log | |
| 62 | +| [CONTRIBUTING.md](CONTRIBUTING.md) | How to contribute real recovery cases | |
| 63 | +| [docs/MVP.md](docs/MVP.md) | Why we shrank, what we validate, future expansion order | |
| 64 | +| [docs/legacy/](docs/legacy/) | v1→v2.1 architecture exploration (historical reference only) | |
126 | 65 |
|
127 | 66 | ## License |
128 | 67 |
|
|
0 commit comments