Commit 7b457aa
feat(agent): pure orchestrator pattern with per-skill delegation tools (tinyhumansai#496)
* feat(agent): pure orchestrator pattern with per-skill delegation tools (tinyhumansai#478)
Refactors the main agent from a direct tool-calling model to a pure
orchestrator that delegates all work through dynamically generated tools.
Architecture changes:
- Orchestrator only sees generated tools (notion, gmail, research,
run_code, review_code, plan, spawn_subagent) — skill tools are
architecturally unreachable from the main agent
- Each installed skill auto-generates a delegation tool at build time
(SkillDelegationTool) that routes to skills_agent with the correct
skill_filter
- Static archetype tools (research, run_code, etc.) delegate to their
respective sub-agents
- visible_tool_specs filters the function-calling schema sent to the
provider, enforcing the orchestrator boundary at the API level
Prompt changes:
- Rewrote AGENTS.md as a lean orchestrator prompt — no more routing
tables or agent_id instructions
- Orchestrator skips TOOLS.md, MEMORY.md, HEARTBEAT.md (~6k tokens
saved per turn) — subagents get tool specs from the registry
- Workspace .md files auto-sync via builtin-hash mechanism so prompt
updates ship automatically to existing installs
Bug fixes:
- ModelSpec::Hint now resolves to {hint}-v1 (e.g. agentic-v1) instead
of hint:agentic which the backend rejected
- validate_skill_filter now uses skill_id from the engine tuple instead
of splitting on __ in the raw tool name (which always failed)
- Memory context forwarded to subagents via ParentExecutionContext
Observability:
- Added [agent] tagged logs for tool responses, agent state transitions,
and delegation decisions throughout turn.rs
See docs/agent-prompt-architecture.excalidraw for the visual diagram.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* style: rustfmt orchestrator_tools.rs
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* style: cargo fmt
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: address CodeRabbit review — dispatch guard, fork specs, decouple sync
- Enforce visible-tool allowlist at dispatch time (not just schema)
- Fork mode uses visible_tool_specs (not full registry)
- De-duplicate spawn_subagent when extending orchestrator tools
- Raw tool output moved to debug level, info level logs metadata only
- Decouple workspace file sync from prompt rendering so skipped files
still get synced to disk
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent b8ded44 commit 7b457aa
15 files changed
Lines changed: 1226 additions & 146 deletions
File tree
- docs
- src/openhuman
- agent
- agent
- harness
- prompts
- tools
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
74 | 83 | | |
75 | 84 | | |
76 | 85 | | |
| |||
198 | 207 | | |
199 | 208 | | |
200 | 209 | | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
201 | 234 | | |
202 | 235 | | |
203 | 236 | | |
204 | 237 | | |
205 | 238 | | |
206 | 239 | | |
| 240 | + | |
| 241 | + | |
207 | 242 | | |
208 | 243 | | |
209 | 244 | | |
| |||
227 | 262 | | |
228 | 263 | | |
229 | 264 | | |
| 265 | + | |
230 | 266 | | |
231 | 267 | | |
232 | 268 | | |
| |||
405 | 441 | | |
406 | 442 | | |
407 | 443 | | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
408 | 463 | | |
409 | 464 | | |
410 | 465 | | |
| 466 | + | |
411 | 467 | | |
412 | 468 | | |
413 | 469 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| 59 | + | |
58 | 60 | | |
59 | 61 | | |
60 | 62 | | |
| |||
87 | 89 | | |
88 | 90 | | |
89 | 91 | | |
| 92 | + | |
90 | 93 | | |
91 | 94 | | |
92 | 95 | | |
93 | 96 | | |
94 | 97 | | |
95 | 98 | | |
96 | 99 | | |
| 100 | + | |
| 101 | + | |
97 | 102 | | |
98 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
99 | 109 | | |
100 | 110 | | |
101 | 111 | | |
| |||
188 | 198 | | |
189 | 199 | | |
190 | 200 | | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
191 | 207 | | |
192 | 208 | | |
193 | 209 | | |
| |||
201 | 217 | | |
202 | 218 | | |
203 | 219 | | |
204 | | - | |
| 220 | + | |
205 | 221 | | |
206 | 222 | | |
207 | 223 | | |
| |||
234 | 250 | | |
235 | 251 | | |
236 | 252 | | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
237 | 258 | | |
238 | 259 | | |
239 | 260 | | |
| |||
246 | 267 | | |
247 | 268 | | |
248 | 269 | | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
249 | 274 | | |
250 | 275 | | |
251 | 276 | | |
| |||
309 | 334 | | |
310 | 335 | | |
311 | 336 | | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
312 | 342 | | |
313 | 343 | | |
314 | 344 | | |
| |||
338 | 368 | | |
339 | 369 | | |
340 | 370 | | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
341 | 388 | | |
342 | 389 | | |
343 | 390 | | |
| |||
348 | 395 | | |
349 | 396 | | |
350 | 397 | | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
351 | 402 | | |
352 | 403 | | |
353 | 404 | | |
| |||
399 | 450 | | |
400 | 451 | | |
401 | 452 | | |
| 453 | + | |
402 | 454 | | |
403 | 455 | | |
404 | 456 | | |
| |||
420 | 472 | | |
421 | 473 | | |
422 | 474 | | |
423 | | - | |
424 | | - | |
425 | | - | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
441 | 490 | | |
442 | | - | |
| 491 | + | |
443 | 492 | | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
444 | 506 | | |
445 | 507 | | |
446 | 508 | | |
| |||
466 | 528 | | |
467 | 529 | | |
468 | 530 | | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
469 | 542 | | |
470 | 543 | | |
471 | 544 | | |
| |||
527 | 600 | | |
528 | 601 | | |
529 | 602 | | |
| 603 | + | |
530 | 604 | | |
531 | 605 | | |
532 | 606 | | |
| |||
559 | 633 | | |
560 | 634 | | |
561 | 635 | | |
562 | | - | |
| 636 | + | |
563 | 637 | | |
564 | 638 | | |
565 | 639 | | |
| |||
667 | 741 | | |
668 | 742 | | |
669 | 743 | | |
| 744 | + | |
670 | 745 | | |
671 | 746 | | |
672 | 747 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
26 | 28 | | |
| 29 | + | |
| 30 | + | |
27 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
28 | 41 | | |
29 | 42 | | |
30 | 43 | | |
| |||
36 | 49 | | |
37 | 50 | | |
38 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
39 | 55 | | |
40 | 56 | | |
41 | 57 | | |
| |||
57 | 73 | | |
58 | 74 | | |
59 | 75 | | |
| 76 | + | |
| 77 | + | |
60 | 78 | | |
61 | 79 | | |
62 | 80 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
58 | | - | |
| 57 | + | |
59 | 58 | | |
60 | 59 | | |
61 | 60 | | |
| |||
0 commit comments