Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 1 addition & 20 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,6 @@
| LLM 中间推理落盘(workflow 节点内) | `~/.flocks/workspace/outputs/<today>/artifacts/` |
| 临时调试/草稿文件 | `/tmp/` |

### 代码示例(workflow 节点 / Python 脚本)

```python
import os, datetime
from flocks.workspace.manager import WorkspaceManager

# 在执行时动态取当日日期,不依赖 session 启动时的注入值
ws = WorkspaceManager.get_instance()
output_dir = str(ws.get_workspace_dir() / 'outputs' / datetime.date.today().isoformat())
os.makedirs(output_dir, exist_ok=True)

# 写报告
tool.run('write', filePath=os.path.join(output_dir, 'final_report.md'), content=report)
# 写 LLM 中间输出
artifacts_dir = os.path.join(output_dir, 'artifacts')
os.makedirs(artifacts_dir, exist_ok=True)
tool.run('write', filePath=os.path.join(artifacts_dir, 'payload_analysis.md'), content=llm_output)
```

### 何时可以使用其他路径

- 用户在 prompt 中**明确指定**了输出路径(优先尊重用户指定)
Expand Down Expand Up @@ -169,4 +150,4 @@ Rex has a dedicated `flocks_skills` tool for managing agent skills.

## Important
- 涉及 `tdp`、`onesec`、`skyeye`、`qingteng` 的任务时,必须先读取并遵循对应的 skill。
- 对上述系统,禁止绕过对应 skill 直接调用相关 tools;也不要直接使用 `agent-browser`。
- 对上述系统,禁止绕过对应 skill 直接调用相关 tools;也不要直接使用 `browser`。
18 changes: 15 additions & 3 deletions flocks/agent/agent_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
Resolves each agent to a concrete ``tools`` list. If legacy ``permission`` is
present, it is expanded against the current tool registry for compatibility.
If neither ``tools`` nor ``permission`` is declared, the static tool list stays
empty and runtime exposure falls back to always-load tools only.
empty and runtime exposure falls back to always-load tools only. ``rex`` is the
special case: an explicitly empty ``tools: []`` expands to all enabled built-in
tools so the primary orchestrator keeps broad native capabilities by default.

Extension point:
Built-in agents: flocks/agent/agents/<name>/ native=True
Expand Down Expand Up @@ -85,6 +87,8 @@ def load_agent(agent_dir: Path, native: bool = False) -> Optional[AgentInfo]:
Permission is generated from the ``tools`` list in agent.yaml.
If ``tools`` is absent, the agent keeps an empty static tool list and only
runtime always-load tools remain available until the session expands them.
``rex`` is the exception: an explicit ``tools: []`` expands to all enabled
built-in tools.

Args:
agent_dir: Path to the agent folder.
Expand Down Expand Up @@ -133,7 +137,11 @@ def load_agent(agent_dir: Path, native: bool = False) -> Optional[AgentInfo]:
# ── Tools / legacy permission compatibility ─────────────────────────────
tools_list_raw: Optional[List[str]] = raw.get("tools")
perm_raw = raw.get("permission")
tools_list, legacy_permission = resolve_agent_initial_tools(tools_list_raw, perm_raw)
tools_list, legacy_permission = resolve_agent_initial_tools(
tools_list_raw,
perm_raw,
agent_name=name,
)

# ── Model ────────────────────────────────────────────────────────────────
model_raw = raw.get("model")
Expand Down Expand Up @@ -342,7 +350,11 @@ def yaml_to_agent_info(raw: dict, yaml_path: Path) -> AgentInfo:
# Tools: prefer new tools list; fall back to old permission dict
tools_list_raw: Optional[List[str]] = raw.get("tools")
perm_raw = raw.get("permission")
tools_list, legacy_permission = resolve_agent_initial_tools(tools_list_raw, perm_raw)
tools_list, legacy_permission = resolve_agent_initial_tools(
tools_list_raw,
perm_raw,
agent_name=name,
)

desc_cn = raw.get("description_cn")
if desc_cn is None and isinstance(raw.get("descriptionCn"), str):
Expand Down
7 changes: 6 additions & 1 deletion flocks/agent/agents/hephaestus/prompt_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def build_hephaestus_prompt(
use_task_system: bool = False,
) -> str:
from flocks.agent.prompt_utils import (
build_agent_selection_table,
build_key_triggers_section,
build_tool_selection_table,
build_explore_section,
Expand All @@ -56,7 +57,8 @@ def build_hephaestus_prompt(
)

key_triggers = build_key_triggers_section(available_agents, available_skills)
tool_selection = build_tool_selection_table(available_agents, available_tools, available_skills)
tool_selection = build_tool_selection_table([], available_tools, available_skills)
agent_selection = build_agent_selection_table(available_agents)
explore_section = build_explore_section(available_agents)
librarian_section = build_librarian_section(available_agents)
category_skills_guide = build_category_skills_delegation_guide(available_categories, available_skills)
Expand Down Expand Up @@ -184,6 +186,8 @@ def build_hephaestus_prompt(

__TOOL_SELECTION__

__AGENT_SELECTION__

__EXPLORE_SECTION__

__LIBRARIAN_SECTION__
Expand Down Expand Up @@ -235,6 +239,7 @@ def build_hephaestus_prompt(
prompt = template
prompt = prompt.replace("__KEY_TRIGGERS__", key_triggers)
prompt = prompt.replace("__TOOL_SELECTION__", tool_selection)
prompt = prompt.replace("__AGENT_SELECTION__", agent_selection)
prompt = prompt.replace("__EXPLORE_SECTION__", explore_section)
prompt = prompt.replace("__LIBRARIAN_SECTION__", librarian_section)
prompt = prompt.replace("__CATEGORY_SKILLS_GUIDE__", category_skills_guide)
Expand Down
20 changes: 1 addition & 19 deletions flocks/agent/agents/rex/agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,5 @@ mode: primary
hidden: false
color: "#00CED1"
delegatable: false
tools:
- read
- list
- glob
- grep
- edit
- write
- bash
- skill
- delegate_task
- task
- todoread
- todowrite
- run_workflow
- run_workflow_node
- background_output
- background_cancel
- session_list
- channel_message
tools: []
# prompt is left empty – injected dynamically by prompt_builder.py
Loading