fix(agent): filter discovery by spawn permissions

This commit is contained in:
afjcjsbx committed 2026-05-07 18:26:09 +02:00
1 parent 96fd887cad
commit b8f4257cee
7 files changed
+170 -34

No files matched your search

+4 -8
View File
@@ -98,7 +98,7 @@ Note:
### Discovery Multi-Agent (Automatica)
Quando esiste più di un agent, PicoClaw inietta automaticamente nel system prompt di ogni agent un registry strutturato dei peer. Non serve una chiamata aggiuntiva a un tool `list_agents`.
Quando un agent ha peer spawnabili, PicoClaw inietta automaticamente nel suo system prompt un registry strutturato dei peer. Non serve una chiamata aggiuntiva a un tool `list_agents`.
Questa discovery serve soprattutto a rendere affidabile la delega tramite `spawn` con `agent_id` esplicito.
@@ -112,9 +112,10 @@ Ogni entry include:
Dettagli importanti:
- La sezione include anche l'entry dell'agent corrente, quindi c'è self-awareness.
- La sezione include solo i peer che l'agent corrente può spawnare tramite `subagents.allow_agents`.
- L'agent corrente e i peer non spawnabili vengono omessi, così il modello non pianifica contro agent non disponibili.
- La discovery è volutamente leggera. Fornisce al modello solo l'identità necessaria per scegliere un peer: `id`, `name`, `description`.
- `config.json` resta il layer infrastrutturale: workspace, agent di default, routing e permessi di subagent.
- `config.json` resta il layer infrastrutturale: workspace, agent di default, routing e permessi di subagent. Questi permessi controllano anche la visibilità nella discovery.
- `AGENT.md` resta il layer di identità. Il codice runtime e i tool possono comunque usare `tools`, `skills`, `mcpServers` e `model` quando avviene la delega.
Forma dell'oggetto iniettato:
@@ -122,11 +123,6 @@ Forma dell'oggetto iniettato:
```json
{
"agents": [
{
"id": "main",
"name": "Main Assistant",
"description": "Agent generalista per richieste quotidiane."
},
{
"id": "research",
"name": "Research Agent",
+4 -8
View File
@@ -238,7 +238,7 @@ Notes:
### Agent Discovery (Automatic)
When more than one agent exists, PicoClaw injects a structured agent registry into each agent's system prompt on every turn. No extra `list_agents` tool call is required.
When an agent has spawnable peers, PicoClaw injects a structured agent registry into that agent's system prompt on every turn. No extra `list_agents` tool call is required.
This registry is intended to make delegation concrete and reliable, especially when using `spawn` with a target `agent_id`.
@@ -252,9 +252,10 @@ Each entry includes:
Important behavior:
- The discovery section includes the current agent's own entry, so the model has self-awareness.
- The discovery section includes only peer agents the current agent is permitted to spawn via `subagents.allow_agents`.
- The current agent and non-spawnable peers are omitted, so the model does not plan against unavailable agents.
- Discovery is intentionally lightweight. It gives the model only the identity it needs to choose a peer: `id`, `name`, and `description`.
- `config.json` remains the infrastructure layer: workspace, default agent selection, routing, and subagent permissions.
- `config.json` remains the infrastructure layer: workspace, default agent selection, routing, and subagent permissions. Those permissions also gate discovery visibility.
- `AGENT.md` remains the identity layer. Runtime/tool code can still use its `tools`, `skills`, `mcpServers`, and `model` fields when delegation happens.
Example injected shape:
@@ -262,11 +263,6 @@ Example injected shape:
```json
{
"agents": [
{
"id": "main",
"name": "Main Assistant",
"description": "Generalist agent for day-to-day requests."
},
{
"id": "research",
"name": "Research Agent",