makefile-agent 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. makefile_agent-0.3.0/LICENSE +21 -0
  2. makefile_agent-0.3.0/PKG-INFO +265 -0
  3. makefile_agent-0.3.0/README.md +240 -0
  4. makefile_agent-0.3.0/make_agent/__init__.py +0 -0
  5. makefile_agent-0.3.0/make_agent/agent.py +190 -0
  6. makefile_agent-0.3.0/make_agent/agent_shell.py +93 -0
  7. makefile_agent-0.3.0/make_agent/app_dirs.py +51 -0
  8. makefile_agent-0.3.0/make_agent/builtin_tools.py +380 -0
  9. makefile_agent-0.3.0/make_agent/create_agent.py +228 -0
  10. makefile_agent-0.3.0/make_agent/main.py +210 -0
  11. makefile_agent-0.3.0/make_agent/memory.py +170 -0
  12. makefile_agent-0.3.0/make_agent/parser.py +351 -0
  13. makefile_agent-0.3.0/make_agent/settings.py +92 -0
  14. makefile_agent-0.3.0/make_agent/templates/orchestra.mk +99 -0
  15. makefile_agent-0.3.0/make_agent/tools.py +193 -0
  16. makefile_agent-0.3.0/makefile_agent.egg-info/PKG-INFO +265 -0
  17. makefile_agent-0.3.0/makefile_agent.egg-info/SOURCES.txt +31 -0
  18. makefile_agent-0.3.0/makefile_agent.egg-info/dependency_links.txt +1 -0
  19. makefile_agent-0.3.0/makefile_agent.egg-info/entry_points.txt +3 -0
  20. makefile_agent-0.3.0/makefile_agent.egg-info/requires.txt +2 -0
  21. makefile_agent-0.3.0/makefile_agent.egg-info/top_level.txt +1 -0
  22. makefile_agent-0.3.0/pyproject.toml +57 -0
  23. makefile_agent-0.3.0/setup.cfg +4 -0
  24. makefile_agent-0.3.0/tests/test_agent.py +163 -0
  25. makefile_agent-0.3.0/tests/test_app_dirs.py +89 -0
  26. makefile_agent-0.3.0/tests/test_builtin_tools.py +291 -0
  27. makefile_agent-0.3.0/tests/test_create_agent.py +325 -0
  28. makefile_agent-0.3.0/tests/test_e2e_smoke.py +37 -0
  29. makefile_agent-0.3.0/tests/test_main.py +72 -0
  30. makefile_agent-0.3.0/tests/test_memory.py +602 -0
  31. makefile_agent-0.3.0/tests/test_parser.py +498 -0
  32. makefile_agent-0.3.0/tests/test_settings.py +255 -0
  33. makefile_agent-0.3.0/tests/test_tools.py +333 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Dmitriy Sorochenkov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,265 @@
1
+ Metadata-Version: 2.4
2
+ Name: makefile-agent
3
+ Version: 0.3.0
4
+ Summary: AI‑assistant‑as‑Makefile: a tool to create and manage AI agents using a simple YAML configuration.
5
+ Author: Dmitriy Sorochenkov
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/dmtr/make-agent
8
+ Project-URL: Repository, https://github.com/dmtr/make-agent
9
+ Project-URL: Issues, https://github.com/dmtr/make-agent/issues
10
+ Keywords: ai,agent,makefile,llm,automation
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
18
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
19
+ Requires-Python: >=3.11
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: any-llm-sdk[anthropic,ollama,openai,openrouter]==1.13.0
23
+ Requires-Dist: pyyaml>=6
24
+ Dynamic: license-file
25
+
26
+ # make-agent
27
+
28
+ An AI agent whose system prompt and tools are defined in a Makefile.
29
+
30
+ Each Makefile target annotated with a `# <tool>` comment block becomes a callable tool. The agent invokes targets via `make`, passing parameters as `KEY=value` arguments. A `define SYSTEM_PROMPT` block sets the agent's system prompt.
31
+
32
+ ## Installation
33
+
34
+ ```
35
+ uv pip install .
36
+ ```
37
+
38
+ Requires Python 3.11+ and a working `make` binary. Uses [any-llm-sdk](https://pypi.org/project/any-llm-sdk/) for model access, so any API keys (e.g. `ANTHROPIC_API_KEY`) must be set in the environment.
39
+
40
+ ## Usage
41
+
42
+ ```
43
+ ANTHROPIC_API_KEY=<key> uv run make_agent [run] [-f FILE] [--model MODEL] [--prompt PROMPT | --prompt-file FILE] [--with-memory]
44
+ ```
45
+
46
+ - `-f FILE` — Makefile to load. Searched in the current directory first, then `~/.make-agent/<project>/agents/`. Defaults to the value in `settings.yaml`, or `./Makefile` if not set.
47
+ - `--model MODEL` — any-llm model string. Defaults to the value in `settings.yaml`.
48
+ - `--prompt PROMPT` — send a single prompt and exit instead of entering the interactive shell
49
+ - `--prompt-file FILE` — send a single prompt read from `FILE` and exit
50
+ - `--agents-dir DIR` — directory for specialist `.mk` files (default: `~/.make-agent/<project>/agents/`)
51
+ - `--agent-model MODEL` — model used when running specialist agents via `run_agent` (default: same as `--model`)
52
+ - `--with-memory` — enable persistent conversation memory (see [Memory](#memory))
53
+ - `--disable-builtin-tools TOOLS` — comma-separated built-in tool names to disable, or `all`
54
+ - `--max-tool-output CHARS` — truncate tool stdout to this many characters; `0` = unlimited (default: 20000)
55
+ - `--max-tokens N` — max tokens in the model response (default: 4096)
56
+ - `--max-retries N` — max retry attempts on rate limit errors (default: 5)
57
+ - `--tool-timeout SECONDS` — timeout for each tool subprocess (default: 600)
58
+ - `--debug` — write all messages to `~/.make-agent/<project>/logs/make-agent.log`
59
+
60
+ Without `--prompt`, the agent starts an interactive REPL. Type `exit`, `quit`, or press Ctrl-D to leave.
61
+
62
+ ### First run — setup wizard
63
+
64
+ If no `settings.yaml` exists for the project and no Makefile is found automatically, the agent prompts you to create one:
65
+
66
+ ```
67
+ No settings.yaml found for this project.
68
+ Let's create one. Press Enter to accept the default shown in brackets.
69
+
70
+ Makefile path [Makefile]: ./my-agent.mk
71
+ Model [anthropic/claude-haiku-4-5-20251001]:
72
+
73
+ Saved settings to ~/.make-agent/Users_alice_proj_myapp/settings.yaml
74
+ ```
75
+
76
+ ## Project settings
77
+
78
+ All per-project data is stored under `~/.make-agent/`:
79
+
80
+ ```
81
+ ~/.make-agent/
82
+ └── <project-slug>/ # e.g. Users_alice_proj_myapp
83
+ ├── settings.yaml # default model and Makefile
84
+ ├── memory.db # conversation history (when memory is enabled)
85
+ ├── agents/ # specialist agent .mk files
86
+ └── logs/
87
+ └── make-agent.log # debug log (written when --debug is set)
88
+ ```
89
+
90
+ The **project slug** is the absolute path of the working directory with the leading `/` stripped and remaining `/` replaced by `_`.
91
+
92
+ ### settings.yaml
93
+
94
+ ```yaml
95
+ model: anthropic/claude-haiku-4-5-20251001
96
+ makefile: ./my-agent.mk
97
+ memory: true # optional — enable persistent memory
98
+ agent_model: anthropic/claude-opus-4-5 # optional — model for run_agent calls
99
+ ```
100
+
101
+ All fields are optional. CLI flags always take precedence over `settings.yaml` values.
102
+
103
+ ## Makefile format
104
+
105
+ ```makefile
106
+ define SYSTEM_PROMPT
107
+ You are a filesystem assistant.
108
+ endef
109
+
110
+ .PHONY: list-files greet
111
+
112
+ # <tool>
113
+ # List files in a directory.
114
+ # @param DIR string The directory path to list
115
+ # </tool>
116
+ list-files:
117
+ @ls -la $(DIR)
118
+
119
+ # <tool>
120
+ # Greet someone.
121
+ # @param NAME string The name to greet
122
+ # </tool>
123
+ greet:
124
+ @echo "Hello, $(NAME)!"
125
+ ```
126
+
127
+ ### Special comment blocks
128
+
129
+ - `define SYSTEM_PROMPT ... endef` sets the system prompt passed to the model. The content is raw text — no `#` prefix needed. `endef` must be on its own line with no indentation.
130
+ - `# <tool> ... # </tool>` marks the following target as an LLM-callable tool. Lines starting with `# @param NAME type description` declare parameters (JSON Schema primitives: `string`, `number`, `integer`, `boolean`). All other lines form the tool description.
131
+
132
+ ### Parameters and `$(PARAM_FILE)`
133
+
134
+ Every declared parameter automatically gets two Make variables injected at call time:
135
+
136
+ - `$(PARAM)` — the value as a Make variable with shell-escaped value. Convenient for single-line values.
137
+ - `$(PARAM_FILE)` — path to a temp file containing the full, unescaped value. Use this for multiline content or when the value might contain shell metacharacters.
138
+
139
+ ```makefile
140
+ # <tool>
141
+ # Write content to a file.
142
+ # @param FILE_PATH string Destination file path
143
+ # @param CONTENT string Content to write (may be multiline)
144
+ # </tool>
145
+ write-file:
146
+ @cat "$(CONTENT_FILE)" > "$(FILE_PATH)"
147
+ ```
148
+
149
+ Targets without a `# <tool>` block are invisible to the model.
150
+
151
+ ## Built-in tools
152
+
153
+ Every agent automatically receives four built-in tools alongside its Makefile-defined tools — no Makefile declaration needed:
154
+
155
+ | Tool | What it does |
156
+ |---|---|
157
+ | `list_agent` | Scan the agents directory and return each specialist's name and description |
158
+ | `validate_agent` | Parse and validate a named specialist's Makefile, reporting any errors |
159
+ | `create_agent` | Generate a new `.mk` file from a YAML spec and save it to the agents directory |
160
+ | `run_agent` | Delegate a task to a specialist agent and return its output |
161
+
162
+ The agents directory defaults to `~/.make-agent/<project>/agents/` and can be changed with `--agents-dir`.
163
+
164
+ ## Memory
165
+
166
+ Agents can persist every conversation turn to a local SQLite database and search it in future sessions.
167
+
168
+ ### Enabling memory
169
+
170
+ ```bash
171
+ # One-time flag
172
+ make_agent --with-memory -f my-agent.mk
173
+
174
+ # Always on for this project (settings.yaml)
175
+ memory: true
176
+ ```
177
+
178
+ The database is stored at `~/.make-agent/<project-slug>/memory.db`. Every user message and final agent reply is written automatically.
179
+
180
+ The project directory layout becomes:
181
+
182
+ ```
183
+ ~/.make-agent/
184
+ └── <project-slug>/
185
+ ├── settings.yaml
186
+ ├── memory.db # conversation history (created on first use)
187
+ ├── agents/
188
+ └── logs/
189
+ ```
190
+
191
+ ### Memory tools
192
+
193
+ When memory is enabled, three additional built-in tools are injected:
194
+
195
+ | Tool | What it does |
196
+ |---|---|
197
+ | `get_recent_messages(limit)` | Return the N most recent messages in chronological order |
198
+ | `search_user_memory(query, limit, from_date, to_date)` | FTS5 keyword search over past user messages |
199
+ | `search_agent_memory(query, limit, from_date, to_date)` | FTS5 keyword search over past agent replies |
200
+
201
+ **FTS5 search tips** — the search is keyword-based, not semantic:
202
+
203
+ - Use short keywords, not sentences: `"goal project"` not `"what is the goal of this project"`
204
+ - Use `OR` for broader recall: `"goal OR objective OR purpose"`
205
+ - Stop words (`the`, `of`, `is`, `a`) are not indexed — omit them
206
+ - If a search returns nothing, retry with broader or alternative keywords
207
+ - Use `get_recent_messages` when you need recent context and don't know which keywords to search for
208
+
209
+ ### Orchestrator pattern
210
+
211
+ `examples/orchestra.mk` shows how to use the built-in tools to build a self-managing agent that creates and improves specialist agents at runtime:
212
+
213
+ ```bash
214
+ # Interactive session
215
+ make_agent -f examples/orchestra.mk
216
+
217
+ # Single prompt
218
+ make_agent -f examples/orchestra.mk --prompt "Summarise the git log for the last week"
219
+ ```
220
+
221
+ For every task the orchestrator:
222
+
223
+ 1. Calls `list_agent` to discover available specialists.
224
+ 2. Delegates to an existing specialist with `run_agent`, or designs and saves a new one with `create_agent` first.
225
+ 3. Improves any specialist by calling `create_agent` with the same name — it overwrites the previous version.
226
+
227
+ ### YAML spec for `create_agent`
228
+
229
+ ```yaml
230
+ system_prompt: "You are a specialist that searches source code for patterns."
231
+ tools:
232
+ - name: search-files
233
+ description: Search files for a text pattern and return matching lines.
234
+ params:
235
+ - name: PATTERN
236
+ type: string
237
+ description: The text pattern to search for
238
+ - name: DIR
239
+ type: string
240
+ description: The directory to search in
241
+ recipe:
242
+ - '@grep -rn "$(PATTERN)" "$(DIR)" || echo "No matches found"'
243
+ ```
244
+
245
+ `make-agent-create` converts this spec into a standard `make-agent` Makefile.
246
+
247
+ ## Example
248
+
249
+ `examples/orchestra.mk` is the orchestrator agent — it manages specialist agents using the built-in tools and also exposes three simple no-parameter tools for system information:
250
+
251
+ ```bash
252
+ make_agent -f examples/orchestra.mk
253
+ ```
254
+
255
+ | Tool | Recipe |
256
+ |---|---|
257
+ | `current-dir` | `pwd` |
258
+ | `os-info` | `uname -a` |
259
+ | `current-date` | `date` |
260
+
261
+ ## Running tests
262
+
263
+ ```
264
+ uv run pytest
265
+ ```
@@ -0,0 +1,240 @@
1
+ # make-agent
2
+
3
+ An AI agent whose system prompt and tools are defined in a Makefile.
4
+
5
+ Each Makefile target annotated with a `# <tool>` comment block becomes a callable tool. The agent invokes targets via `make`, passing parameters as `KEY=value` arguments. A `define SYSTEM_PROMPT` block sets the agent's system prompt.
6
+
7
+ ## Installation
8
+
9
+ ```
10
+ uv pip install .
11
+ ```
12
+
13
+ Requires Python 3.11+ and a working `make` binary. Uses [any-llm-sdk](https://pypi.org/project/any-llm-sdk/) for model access, so any API keys (e.g. `ANTHROPIC_API_KEY`) must be set in the environment.
14
+
15
+ ## Usage
16
+
17
+ ```
18
+ ANTHROPIC_API_KEY=<key> uv run make_agent [run] [-f FILE] [--model MODEL] [--prompt PROMPT | --prompt-file FILE] [--with-memory]
19
+ ```
20
+
21
+ - `-f FILE` — Makefile to load. Searched in the current directory first, then `~/.make-agent/<project>/agents/`. Defaults to the value in `settings.yaml`, or `./Makefile` if not set.
22
+ - `--model MODEL` — any-llm model string. Defaults to the value in `settings.yaml`.
23
+ - `--prompt PROMPT` — send a single prompt and exit instead of entering the interactive shell
24
+ - `--prompt-file FILE` — send a single prompt read from `FILE` and exit
25
+ - `--agents-dir DIR` — directory for specialist `.mk` files (default: `~/.make-agent/<project>/agents/`)
26
+ - `--agent-model MODEL` — model used when running specialist agents via `run_agent` (default: same as `--model`)
27
+ - `--with-memory` — enable persistent conversation memory (see [Memory](#memory))
28
+ - `--disable-builtin-tools TOOLS` — comma-separated built-in tool names to disable, or `all`
29
+ - `--max-tool-output CHARS` — truncate tool stdout to this many characters; `0` = unlimited (default: 20000)
30
+ - `--max-tokens N` — max tokens in the model response (default: 4096)
31
+ - `--max-retries N` — max retry attempts on rate limit errors (default: 5)
32
+ - `--tool-timeout SECONDS` — timeout for each tool subprocess (default: 600)
33
+ - `--debug` — write all messages to `~/.make-agent/<project>/logs/make-agent.log`
34
+
35
+ Without `--prompt`, the agent starts an interactive REPL. Type `exit`, `quit`, or press Ctrl-D to leave.
36
+
37
+ ### First run — setup wizard
38
+
39
+ If no `settings.yaml` exists for the project and no Makefile is found automatically, the agent prompts you to create one:
40
+
41
+ ```
42
+ No settings.yaml found for this project.
43
+ Let's create one. Press Enter to accept the default shown in brackets.
44
+
45
+ Makefile path [Makefile]: ./my-agent.mk
46
+ Model [anthropic/claude-haiku-4-5-20251001]:
47
+
48
+ Saved settings to ~/.make-agent/Users_alice_proj_myapp/settings.yaml
49
+ ```
50
+
51
+ ## Project settings
52
+
53
+ All per-project data is stored under `~/.make-agent/`:
54
+
55
+ ```
56
+ ~/.make-agent/
57
+ └── <project-slug>/ # e.g. Users_alice_proj_myapp
58
+ ├── settings.yaml # default model and Makefile
59
+ ├── memory.db # conversation history (when memory is enabled)
60
+ ├── agents/ # specialist agent .mk files
61
+ └── logs/
62
+ └── make-agent.log # debug log (written when --debug is set)
63
+ ```
64
+
65
+ The **project slug** is the absolute path of the working directory with the leading `/` stripped and remaining `/` replaced by `_`.
66
+
67
+ ### settings.yaml
68
+
69
+ ```yaml
70
+ model: anthropic/claude-haiku-4-5-20251001
71
+ makefile: ./my-agent.mk
72
+ memory: true # optional — enable persistent memory
73
+ agent_model: anthropic/claude-opus-4-5 # optional — model for run_agent calls
74
+ ```
75
+
76
+ All fields are optional. CLI flags always take precedence over `settings.yaml` values.
77
+
78
+ ## Makefile format
79
+
80
+ ```makefile
81
+ define SYSTEM_PROMPT
82
+ You are a filesystem assistant.
83
+ endef
84
+
85
+ .PHONY: list-files greet
86
+
87
+ # <tool>
88
+ # List files in a directory.
89
+ # @param DIR string The directory path to list
90
+ # </tool>
91
+ list-files:
92
+ @ls -la $(DIR)
93
+
94
+ # <tool>
95
+ # Greet someone.
96
+ # @param NAME string The name to greet
97
+ # </tool>
98
+ greet:
99
+ @echo "Hello, $(NAME)!"
100
+ ```
101
+
102
+ ### Special comment blocks
103
+
104
+ - `define SYSTEM_PROMPT ... endef` sets the system prompt passed to the model. The content is raw text — no `#` prefix needed. `endef` must be on its own line with no indentation.
105
+ - `# <tool> ... # </tool>` marks the following target as an LLM-callable tool. Lines starting with `# @param NAME type description` declare parameters (JSON Schema primitives: `string`, `number`, `integer`, `boolean`). All other lines form the tool description.
106
+
107
+ ### Parameters and `$(PARAM_FILE)`
108
+
109
+ Every declared parameter automatically gets two Make variables injected at call time:
110
+
111
+ - `$(PARAM)` — the value as a Make variable with shell-escaped value. Convenient for single-line values.
112
+ - `$(PARAM_FILE)` — path to a temp file containing the full, unescaped value. Use this for multiline content or when the value might contain shell metacharacters.
113
+
114
+ ```makefile
115
+ # <tool>
116
+ # Write content to a file.
117
+ # @param FILE_PATH string Destination file path
118
+ # @param CONTENT string Content to write (may be multiline)
119
+ # </tool>
120
+ write-file:
121
+ @cat "$(CONTENT_FILE)" > "$(FILE_PATH)"
122
+ ```
123
+
124
+ Targets without a `# <tool>` block are invisible to the model.
125
+
126
+ ## Built-in tools
127
+
128
+ Every agent automatically receives four built-in tools alongside its Makefile-defined tools — no Makefile declaration needed:
129
+
130
+ | Tool | What it does |
131
+ |---|---|
132
+ | `list_agent` | Scan the agents directory and return each specialist's name and description |
133
+ | `validate_agent` | Parse and validate a named specialist's Makefile, reporting any errors |
134
+ | `create_agent` | Generate a new `.mk` file from a YAML spec and save it to the agents directory |
135
+ | `run_agent` | Delegate a task to a specialist agent and return its output |
136
+
137
+ The agents directory defaults to `~/.make-agent/<project>/agents/` and can be changed with `--agents-dir`.
138
+
139
+ ## Memory
140
+
141
+ Agents can persist every conversation turn to a local SQLite database and search it in future sessions.
142
+
143
+ ### Enabling memory
144
+
145
+ ```bash
146
+ # One-time flag
147
+ make_agent --with-memory -f my-agent.mk
148
+
149
+ # Always on for this project (settings.yaml)
150
+ memory: true
151
+ ```
152
+
153
+ The database is stored at `~/.make-agent/<project-slug>/memory.db`. Every user message and final agent reply is written automatically.
154
+
155
+ The project directory layout becomes:
156
+
157
+ ```
158
+ ~/.make-agent/
159
+ └── <project-slug>/
160
+ ├── settings.yaml
161
+ ├── memory.db # conversation history (created on first use)
162
+ ├── agents/
163
+ └── logs/
164
+ ```
165
+
166
+ ### Memory tools
167
+
168
+ When memory is enabled, three additional built-in tools are injected:
169
+
170
+ | Tool | What it does |
171
+ |---|---|
172
+ | `get_recent_messages(limit)` | Return the N most recent messages in chronological order |
173
+ | `search_user_memory(query, limit, from_date, to_date)` | FTS5 keyword search over past user messages |
174
+ | `search_agent_memory(query, limit, from_date, to_date)` | FTS5 keyword search over past agent replies |
175
+
176
+ **FTS5 search tips** — the search is keyword-based, not semantic:
177
+
178
+ - Use short keywords, not sentences: `"goal project"` not `"what is the goal of this project"`
179
+ - Use `OR` for broader recall: `"goal OR objective OR purpose"`
180
+ - Stop words (`the`, `of`, `is`, `a`) are not indexed — omit them
181
+ - If a search returns nothing, retry with broader or alternative keywords
182
+ - Use `get_recent_messages` when you need recent context and don't know which keywords to search for
183
+
184
+ ### Orchestrator pattern
185
+
186
+ `examples/orchestra.mk` shows how to use the built-in tools to build a self-managing agent that creates and improves specialist agents at runtime:
187
+
188
+ ```bash
189
+ # Interactive session
190
+ make_agent -f examples/orchestra.mk
191
+
192
+ # Single prompt
193
+ make_agent -f examples/orchestra.mk --prompt "Summarise the git log for the last week"
194
+ ```
195
+
196
+ For every task the orchestrator:
197
+
198
+ 1. Calls `list_agent` to discover available specialists.
199
+ 2. Delegates to an existing specialist with `run_agent`, or designs and saves a new one with `create_agent` first.
200
+ 3. Improves any specialist by calling `create_agent` with the same name — it overwrites the previous version.
201
+
202
+ ### YAML spec for `create_agent`
203
+
204
+ ```yaml
205
+ system_prompt: "You are a specialist that searches source code for patterns."
206
+ tools:
207
+ - name: search-files
208
+ description: Search files for a text pattern and return matching lines.
209
+ params:
210
+ - name: PATTERN
211
+ type: string
212
+ description: The text pattern to search for
213
+ - name: DIR
214
+ type: string
215
+ description: The directory to search in
216
+ recipe:
217
+ - '@grep -rn "$(PATTERN)" "$(DIR)" || echo "No matches found"'
218
+ ```
219
+
220
+ `make-agent-create` converts this spec into a standard `make-agent` Makefile.
221
+
222
+ ## Example
223
+
224
+ `examples/orchestra.mk` is the orchestrator agent — it manages specialist agents using the built-in tools and also exposes three simple no-parameter tools for system information:
225
+
226
+ ```bash
227
+ make_agent -f examples/orchestra.mk
228
+ ```
229
+
230
+ | Tool | Recipe |
231
+ |---|---|
232
+ | `current-dir` | `pwd` |
233
+ | `os-info` | `uname -a` |
234
+ | `current-date` | `date` |
235
+
236
+ ## Running tests
237
+
238
+ ```
239
+ uv run pytest
240
+ ```
File without changes