brain-framework 18.3.0__tar.gz → 18.5.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 (92) hide show
  1. {brain_framework-18.3.0 → brain_framework-18.5.0}/PKG-INFO +14 -72
  2. {brain_framework-18.3.0 → brain_framework-18.5.0}/README.md +13 -71
  3. {brain_framework-18.3.0 → brain_framework-18.5.0}/pyproject.toml +1 -1
  4. {brain_framework-18.3.0 → brain_framework-18.5.0}/pyproject.toml.orig +1 -1
  5. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/__init__.py +1 -1
  6. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/cli.py +57 -15
  7. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/collect.py +312 -47
  8. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/graph.py +20 -16
  9. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/health.py +133 -18
  10. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/history.py +23 -14
  11. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/index.py +352 -153
  12. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/mcp.py +1 -1
  13. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/models.py +99 -7
  14. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/pages.py +138 -61
  15. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/records.py +25 -0
  16. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/replies.py +11 -1
  17. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/retrieve.py +18 -21
  18. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/schedule.py +4 -3
  19. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/skills/README.md +5 -5
  20. brain_framework-18.5.0/src/bf/skills/bf-action/SKILL.md +53 -0
  21. brain_framework-18.5.0/src/bf/skills/bf-action/references/actions.md +27 -0
  22. brain_framework-18.5.0/src/bf/skills/bf-action/references/context.md +21 -0
  23. brain_framework-18.5.0/src/bf/skills/bf-action/references/handoff.md +42 -0
  24. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/skills/bf-action/templates/action.md +1 -1
  25. brain_framework-18.5.0/src/bf/skills/bf-maintain/SKILL.md +55 -0
  26. brain_framework-18.5.0/src/bf/skills/bf-maintain/references/conflicts.md +14 -0
  27. brain_framework-18.5.0/src/bf/skills/bf-maintain/references/integrations.md +107 -0
  28. brain_framework-18.5.0/src/bf/skills/bf-maintain/references/operations.md +61 -0
  29. brain_framework-18.5.0/src/bf/skills/bf-setup/SKILL.md +64 -0
  30. brain_framework-18.5.0/src/bf/skills/bf-setup/references/discovery.md +32 -0
  31. brain_framework-18.5.0/src/bf/skills/bf-setup/references/import.md +36 -0
  32. brain_framework-18.5.0/src/bf/skills/bf-setup/references/scan.md +27 -0
  33. brain_framework-18.5.0/src/bf/skills/bf-use/SKILL.md +73 -0
  34. brain_framework-18.5.0/src/bf/skills/bf-use/references/consolidate.md +9 -0
  35. brain_framework-18.5.0/src/bf/skills/bf-use/references/decisions.md +31 -0
  36. brain_framework-18.5.0/src/bf/skills/bf-use/references/evidence.md +61 -0
  37. brain_framework-18.5.0/src/bf/skills/bf-use/references/learn.md +37 -0
  38. brain_framework-18.5.0/src/bf/skills/bf-use/references/links.md +59 -0
  39. brain_framework-18.5.0/src/bf/skills/bf-use/references/retrieval.md +39 -0
  40. brain_framework-18.5.0/src/bf/skills/bf-use/references/review.md +10 -0
  41. brain_framework-18.5.0/src/bf/skills/bf-use/references/share.md +12 -0
  42. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/skills/bf-use/scripts/evidence.py +10 -1
  43. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/skills/bf-use/scripts/guarded-write.py +112 -4
  44. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/starter/AGENTS.md +1 -1
  45. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/storage.py +19 -1
  46. brain_framework-18.5.0/src/bf/update.py +285 -0
  47. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/validate.py +21 -6
  48. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/watch.py +134 -29
  49. brain_framework-18.3.0/src/bf/skills/bf-action/SKILL.md +0 -57
  50. brain_framework-18.3.0/src/bf/skills/bf-action/references/actions.md +0 -38
  51. brain_framework-18.3.0/src/bf/skills/bf-action/references/context.md +0 -27
  52. brain_framework-18.3.0/src/bf/skills/bf-action/references/handoff.md +0 -48
  53. brain_framework-18.3.0/src/bf/skills/bf-maintain/SKILL.md +0 -61
  54. brain_framework-18.3.0/src/bf/skills/bf-maintain/references/conflicts.md +0 -14
  55. brain_framework-18.3.0/src/bf/skills/bf-maintain/references/integrations.md +0 -76
  56. brain_framework-18.3.0/src/bf/skills/bf-maintain/references/operations.md +0 -73
  57. brain_framework-18.3.0/src/bf/skills/bf-setup/SKILL.md +0 -67
  58. brain_framework-18.3.0/src/bf/skills/bf-setup/references/discovery.md +0 -38
  59. brain_framework-18.3.0/src/bf/skills/bf-setup/references/import.md +0 -40
  60. brain_framework-18.3.0/src/bf/skills/bf-setup/references/scan.md +0 -37
  61. brain_framework-18.3.0/src/bf/skills/bf-use/SKILL.md +0 -69
  62. brain_framework-18.3.0/src/bf/skills/bf-use/references/consolidate.md +0 -9
  63. brain_framework-18.3.0/src/bf/skills/bf-use/references/decisions.md +0 -33
  64. brain_framework-18.3.0/src/bf/skills/bf-use/references/evidence.md +0 -61
  65. brain_framework-18.3.0/src/bf/skills/bf-use/references/learn.md +0 -55
  66. brain_framework-18.3.0/src/bf/skills/bf-use/references/links.md +0 -56
  67. brain_framework-18.3.0/src/bf/skills/bf-use/references/retrieval.md +0 -48
  68. brain_framework-18.3.0/src/bf/skills/bf-use/references/review.md +0 -25
  69. brain_framework-18.3.0/src/bf/skills/bf-use/references/share.md +0 -12
  70. brain_framework-18.3.0/src/bf/update.py +0 -184
  71. {brain_framework-18.3.0 → brain_framework-18.5.0}/LICENSE +0 -0
  72. {brain_framework-18.3.0 → brain_framework-18.5.0}/THIRD_PARTY_NOTICES.md +0 -0
  73. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/__main__.py +0 -0
  74. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/config.py +0 -0
  75. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/evaluate.py +0 -0
  76. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/install.py +0 -0
  77. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/links.py +0 -0
  78. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/markdown.py +0 -0
  79. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/ontology.py +0 -0
  80. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/py.typed +0 -0
  81. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/schemas.py +0 -0
  82. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/skills/bf-action/scripts/check-handoff.py +0 -0
  83. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/skills/bf-action/scripts/new-action.py +0 -0
  84. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/skills/bf-setup/scripts/inventory.py +0 -0
  85. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/skills/bf-use/templates/concept.md +0 -0
  86. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/skills/bf-use/templates/project.md +0 -0
  87. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/starter/concepts/index.md +0 -0
  88. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/starter/concepts/welcome.md +0 -0
  89. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/starter/evals/retrieval.yaml +0 -0
  90. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/starter/gitignore +0 -0
  91. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/usage.py +0 -0
  92. {brain_framework-18.3.0 → brain_framework-18.5.0}/src/bf/watch_settings.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: brain-framework
3
- Version: 18.3.0
3
+ Version: 18.5.0
4
4
  Summary: 🧠 Brain Framework: from information to informed actions.
5
5
  Keywords: ai,ai-agents,agent-memory,context-engineering,knowledge-management,local-first,mcp,model-context-protocol,python,second-brain
6
6
  Author: Médéric Hurier
@@ -43,7 +43,7 @@ A second brain for you, your team and your AI agents, on your own computer. Gath
43
43
 
44
44
  [![CI](https://github.com/fmind/brain-framework/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/fmind/brain-framework/actions/workflows/ci.yml) [![PyPI](https://img.shields.io/pypi/v/brain-framework?color=174EA6)](https://pypi.org/project/brain-framework/) [![Python](https://img.shields.io/pypi/pyversions/brain-framework)](https://pypi.org/project/brain-framework/) [![License: MIT](https://img.shields.io/badge/license-MIT-174EA6)](https://github.com/fmind/brain-framework/blob/main/LICENSE)
45
45
 
46
- [Why](https://github.com/fmind/brain-framework#why-a-second-brain) · [How it works](https://github.com/fmind/brain-framework#how-it-works) · [Try it](https://github.com/fmind/brain-framework#try-it) · [Agents](https://github.com/fmind/brain-framework#open-your-agent-in-your-brain) · [Good to know](https://github.com/fmind/brain-framework#good-to-know) · [Four-tool demo](https://fmind.github.io/brain-framework/docs/context-hub/) · [Documentation](https://fmind.github.io/brain-framework/)
46
+ [Why](https://github.com/fmind/brain-framework#why-a-second-brain) · [How it works](https://github.com/fmind/brain-framework#how-it-works) · [Try it](https://github.com/fmind/brain-framework#try-it) · [Agents](https://github.com/fmind/brain-framework#open-your-agent-in-your-brain) · [Good to know](https://github.com/fmind/brain-framework#good-to-know) · [Four-tool walkthrough](https://fmind.github.io/brain-framework/docs/context-hub/) · [Documentation](https://fmind.github.io/brain-framework/)
47
47
 
48
48
  <a href="https://raw.githubusercontent.com/fmind/brain-framework/main/docs/assets/brain-loop.svg">
49
49
  <img
@@ -84,7 +84,7 @@ Questions that once took a tour of your tools become one prompt, once you write
84
84
  - **Every source, even the ones no product connects.** Mail, calendar, documents, chat, issues and pull requests, of course. But also the release notes and security advisories of the tools you depend on, model retirement dates, provider incidents, mentions of your projects on Hacker News or Bluesky, your domains' certificates and mail security, repository traffic that GitHub forgets after 14 days and your past agent sessions. If you can script it, you can collect it.
85
85
  - **Unlimited integrations, both ways.** A sensor is a small program that prints JSON: wrap a CLI such as `gh`, `gws` or `gcloud`, call an API, drive a browser, query a database or parse an export. The same CLIs, APIs and MCP servers then let your agent act on what it learned: draft the issue, answer the thread, fix the alert.
86
86
  - **One vocabulary, one knowledge graph.** Each tool names things its own way. You declare a small ontology in `bf.yaml` and sensors map provider fields into it at collection, so the same project, person or repository connects across every tool. BF turns those explicit links into a graph you navigate in one read, each claim pointing back to its evidence.
87
- - **Private by design.** Your brain is a folder on your disk. BF has no account, server or telemetry and runs no AI model; search and read work offline.
87
+ - **Private by design.** Your brain is a folder on your disk. BF has no account, server or telemetry and never runs a model itself: [prompts](https://fmind.github.io/brain-framework/docs/prompts/) launch your agent harness. Search and read work offline.
88
88
  - **Portable and versioned.** Markdown notes, JSON records and scripts: open them in any editor, grep them, copy them to another machine. Keep the brain in a private Git repository for history, rollback, review and conflict resolution.
89
89
  - **For you or your whole team.** A personal brain stays on your laptop. A team brain is a private Git repository with one clone per teammate, so decisions, reviewed evidence and next steps are shared by everyone and their agents. Your personal brain can include the team's in its searches.
90
90
  - **Any agent, guided by skills.** Claude Code, Codex, GitHub Copilot, Antigravity or your own agent reach the same brain through the `bf` command, packaged skills or MCP. The skills teach them to find evidence, keep notes current, connect sources and maintain the brain.
@@ -122,9 +122,10 @@ A brain gives your work the structure of a detective's case file, in plain files
122
122
  | `concepts/` | Knowledge you will reuse elsewhere, with its evidence and limits. | “Explain the product before asking for signup.” |
123
123
  | `actions/` | One work session: objective, inputs, outputs, outcome and next step. | `actions/2026-09-27_website-review/ACTION.md`, resumed the next day. |
124
124
  | `routines/` | Deterministic programs you review, run on demand, on a schedule or from Git. | A weekly review that drafts an action listing projects to revisit. |
125
+ | `prompts/` | Markdown prompts your agent harness runs; each run's reply is a record. | An assistant that reviews new mail and chat every half hour. |
125
126
  | `evals/` | Saved questions with the evidence that search or read must return. | “Why one page?” must return the project's Decision section. |
126
127
 
127
- Notes are Markdown with YAML metadata, records are JSON, and `bf validate` checks both. The SQLite search cache in `.bf/` is disposable and rebuilds itself from the files. See the [file conventions](https://fmind.github.io/brain-framework/docs/brain/#directory-reference).
128
+ Notes are Markdown with YAML metadata, records are JSON, and `bf validate` checks both. `bf init --full` creates `sensors/` and `routines/`; create `prompts/` when you add a [prompt](https://fmind.github.io/brain-framework/docs/prompts/). A prompt's records hold model output, so search weighs them at half, like a low-priority source. The SQLite search cache in `.bf/` is disposable and rebuilds itself from the files. See the [file conventions](https://fmind.github.io/brain-framework/docs/brain/#directory-reference).
128
129
 
129
130
  ### `bf.yaml`, the coordination hub
130
131
 
@@ -157,7 +158,7 @@ watch: # keep sources fresh and alert on failure
157
158
  notifications: failure
158
159
  ```
159
160
 
160
- BF runs each program with its configured arguments and no shell, bounds its time and output, validates what it prints and keeps its stderr in `logs/`. A failed run never changes your evidence. `bf watch` keeps due sensors and routines fresh in a terminal dashboard, and `bf schedule` generates native systemd, launchd or cron jobs for you to install. See [sensors](https://fmind.github.io/brain-framework/docs/sensors/), [routines](https://fmind.github.io/brain-framework/docs/routines/) and [watch and schedule](https://fmind.github.io/brain-framework/docs/schedule/).
161
+ BF runs each program with its configured arguments and no shell, bounds its time and output, validates what it prints and keeps its stderr in `logs/`. A failed run never changes your evidence. `bf watch` keeps due sensors, routines and prompts fresh in a terminal dashboard, and `bf schedule` generates native systemd, launchd or cron jobs for you to install. See [sensors](https://fmind.github.io/brain-framework/docs/sensors/), [routines](https://fmind.github.io/brain-framework/docs/routines/) and [watch and schedule](https://fmind.github.io/brain-framework/docs/schedule/).
161
162
 
162
163
  ### One vocabulary, set at collection
163
164
 
@@ -181,22 +182,7 @@ Reading files gives you one document at a time, and grep finds words, not connec
181
182
  bf read project:new-website
182
183
  ```
183
184
 
184
- The reply holds the project note and its backlinks, grouped by relation: four records from four tools, side by side, in the shared vocabulary (trimmed here to refs, kinds and statuses):
185
-
186
- ```json
187
- {
188
- "relation": "project",
189
- "total": 4,
190
- "items": [
191
- { "ref": "gcloud:deployment", "fields": { "kind": "deployment", "status": "healthy" } },
192
- { "ref": "github:implementation", "fields": { "kind": "pull-request", "status": "merged" } },
193
- { "ref": "jira:review", "fields": { "kind": "issue", "status": "In review" } },
194
- { "ref": "workspace:brief", "fields": { "kind": "brief", "status": "approved" } }
195
- ]
196
- }
197
- ```
198
-
199
- From there, follow typed [relations](https://fmind.github.io/brain-framework/docs/links/#name-a-relation) such as `author`, `owner`, `depends-on` or your own. Each claim keeps the note section or record that asserted it, so an answer can always cite its evidence. `bf export` prints the whole graph as JSON Lines for DuckDB or networkx.
185
+ The reply holds the project note and its backlinks, grouped by relation: under `project`, four records from four tools side by side in the shared vocabulary, the Jira review `In review`, the GitHub pull request `merged`, the Gcloud deployment `healthy` and the Workspace brief `approved`. The [four-tool walkthrough](https://fmind.github.io/brain-framework/docs/context-hub/#collect-four-tools) shows the reply. From there, follow typed [relations](https://fmind.github.io/brain-framework/docs/links/#name-a-relation) such as `author`, `owner`, `depends-on` or your own. Each claim keeps the note section or record that asserted it, so an answer can always cite its evidence. `bf export` prints the whole graph as JSON Lines for DuckDB or networkx.
200
186
 
201
187
  ### Act, then learn
202
188
 
@@ -210,64 +196,22 @@ Retrieval assembles the context; people and agents do the work, through the CLIs
210
196
  >
211
197
  </a>
212
198
 
213
- The graph keeps conclusions current. Each project knows the evidence it links to: when a linked record changes after the note's last edit, `bf read` flags the project for review and names the record to read first, so a decision does not silently outlive its linked evidence. Try it in the [four-tool demo](https://fmind.github.io/brain-framework/docs/context-hub/#follow-a-change). [Routines](https://fmind.github.io/brain-framework/docs/routines/) run deterministic reviews and checks, such as a weekly review action or `bf validate` before each Git commit, and retrieval cases in `evals/` confirm that the questions you rely on still find their evidence as the brain grows.
199
+ The graph keeps conclusions current. Each project knows the evidence it links to: when a linked record changes after the note's last edit, `bf read` flags the project for review and names the record to read first, so a decision does not silently outlive its linked evidence. Try it in the [four-tool walkthrough](https://fmind.github.io/brain-framework/docs/context-hub/#follow-a-change). [Routines](https://fmind.github.io/brain-framework/docs/routines/) run deterministic reviews and checks, such as a weekly review action or `bf validate` before each Git commit, and retrieval cases in `evals/` confirm that the questions you rely on still find their evidence as the brain grows.
214
200
 
215
201
  ## Try it
216
202
 
217
- Start with one decision you can find again. You need Linux or macOS and [uv](https://docs.astral.sh/uv/getting-started/installation/), which installs the tested Python 3.14 if needed ([install details](https://fmind.github.io/brain-framework/docs/upgrades/#install)). No model or provider account is required.
203
+ You need Linux or macOS and [uv](https://docs.astral.sh/uv/getting-started/installation/), which installs the tested Python 3.14 if needed ([install details](https://fmind.github.io/brain-framework/docs/upgrades/#install)). No model or provider account is required.
218
204
 
219
205
  ```bash
220
206
  uv tool install --python 3.14 brain-framework
221
207
  bf --version
222
208
  ```
223
209
 
224
- If your shell cannot find `bf`, run `uv tool update-shell` and open a new shell. Then create your brain:
225
-
226
- ```bash
227
- bf init ~/brain
228
- cd ~/brain
229
- ```
230
-
231
- Create `projects/new-website.md` in your editor, or ask your agent to save this fictional decision. Use today's date for `updated`:
232
-
233
- ```markdown
234
- ---
235
- type: project
236
- status: draft
237
- updated: 2026-09-27
238
- summary: Launch a product website that helps visitors understand the product.
239
- ---
240
-
241
- # New website
242
-
243
- ## Decision
244
-
245
- Start with a single product page because visitors need a clear explanation before signing up.
246
-
247
- ## Next actions
248
-
249
- - [ ] Draft the product page.
250
- ```
251
-
252
- Find the reason, read its source and check the brain:
253
-
254
- ```bash
255
- bf search "visitors clear explanation"
256
- bf read projects/new-website.md#decision
257
- bf validate
258
- ```
259
-
260
- Search returns this match in `items` (other fields omitted):
261
-
262
- ```json
263
- { "ref": "projects/new-website.md#decision", "title": "New website — Decision" }
264
- ```
265
-
266
- `read` returns the original Decision section with its note's status and date, and validation reports `"valid":true`. Edit the note and search again: BF notices changes on its own. The [getting-started guide](https://fmind.github.io/brain-framework/docs/getting-started/) continues with a first collected source and a link from the decision to its evidence, and the [four-tool demo](https://fmind.github.io/brain-framework/docs/context-hub/) runs the whole loop offline on fictional Workspace, Jira, GitHub and Gcloud records.
210
+ Then follow [Getting started](https://fmind.github.io/brain-framework/docs/getting-started/): create a brain, save a decision, find its reason and link it to a first collected source. The [four-tool walkthrough](https://fmind.github.io/brain-framework/docs/context-hub/) then runs the whole loop offline on fictional Workspace, Jira, GitHub and Gcloud records.
267
211
 
268
212
  ## Open your agent in your brain
269
213
 
270
- Use the same brain with [Claude Code](https://code.claude.com/docs/en/overview), [Codex](https://openai.com/codex/), [GitHub Copilot](https://github.com/features/copilot) or any agent host that can run a command. Start your terminal agent in `~/brain` and give it this prompt:
214
+ Use the same brain with [Claude Code](https://code.claude.com/docs/en/overview), [Codex](https://openai.com/codex/), [GitHub Copilot](https://github.com/features/copilot) or any agent host that can run a command. After Getting started, start your terminal agent in `~/brain` and give it this prompt:
271
215
 
272
216
  > Use the bf CLI. Find why we chose a single product page. Read the source, cite its ref and tell me the project's next action.
273
217
 
@@ -284,11 +228,9 @@ Each host reads its own folder: for Claude Code, use `~/.claude/skills` instead.
284
228
  | `bf-use` | Find evidence, cite it, and keep projects and concepts current. |
285
229
  | `bf-action` | Start, resume and hand off a tracked work session: `/bf-action website-review`. |
286
230
  | `bf-setup` | Install BF, create a brain, connect the agent and choose sources worth adding. |
287
- | `bf-maintain` | Run sensors and routines, check the brain and upgrade it safely. |
288
-
289
- Working in a code repository instead? The [example session hook](https://github.com/fmind/brain-framework/tree/main/examples/hooks) prints the project that declares the repository, its next task and linked evidence when the session starts. Hosts that prefer tools can call `search` and `read` through [MCP](https://fmind.github.io/brain-framework/docs/mcp/). See the [agent guide](https://fmind.github.io/brain-framework/docs/agents/).
231
+ | `bf-maintain` | Run sensors, routines and prompts, check the brain and upgrade it safely. |
290
232
 
291
- Agents can read this documentation as Markdown: [llms.txt](https://fmind.github.io/brain-framework/llms.txt) indexes every guide with a summary, [llms-full.txt](https://fmind.github.io/brain-framework/llms-full.txt) holds their full text, and each guide's Markdown sits at its URL followed by `index.md`.
233
+ Working in a code repository instead? The [example session hook](https://github.com/fmind/brain-framework/tree/main/examples/hooks) prints the project that declares the repository, its next task and linked evidence when the session starts. During collection, a usable cached reply carries an “Index refreshing” note. Hosts that prefer tools can call `search` and `read` through [MCP](https://fmind.github.io/brain-framework/docs/mcp/). See the [agent guide](https://fmind.github.io/brain-framework/docs/agents/), which also points agents to this documentation as Markdown.
292
234
 
293
235
  ## Bring your tools
294
236
 
@@ -323,7 +265,7 @@ A brain is a folder, so Git gives it history, rollback, review and conflict reso
323
265
 
324
266
  1. **It runs on your computer, not in someone else's cloud.** That is a feature: your agent works where you can watch it, interrupt it and inspect every file it reads or writes, instead of a black box on a remote server. Sensors collect while your machine is on, through `bf watch` or a native schedule.
325
267
  1. **It takes some setup.** Each source needs its access: an API key, `gh auth login`, `gws` or `gcloud` authentication, then a sensor you review. Providers ship better CLIs and MCP servers every month, so this keeps getting easier, and the `bf-setup` skill walks your agent through it.
326
- 1. **It needs an agent harness for the reasoning.** BF runs no model: it collects, validates, searches and connects. Claude Code, Codex, Copilot, Antigravity or another harness does the thinking, so the privacy of what your agent reads depends on that harness's data terms. BF sends no telemetry or personal data to us; see [privacy and security](https://fmind.github.io/brain-framework/docs/privacy/) for a fully local setup.
268
+ 1. **It needs an agent harness for the reasoning.** BF never runs a model itself: it collects, validates, searches and connects, and its [prompts](https://fmind.github.io/brain-framework/docs/prompts/) launch your harness. Claude Code, Codex, Copilot, Antigravity or another harness does the thinking, so the privacy of what your agent reads depends on that harness's data terms. BF sends no telemetry or personal data to us; see [privacy and security](https://fmind.github.io/brain-framework/docs/privacy/) for a fully local setup.
327
269
  1. **It finds what was said and linked, not what was meant.** Search matches words and explicit identities, without embeddings, and incomplete results say so. Search and read never contact providers: collect again when you need newer evidence. See [what BF does not do](https://fmind.github.io/brain-framework/docs/concepts/#what-bf-does-not-do).
328
270
 
329
271
  [Browse the commands](https://fmind.github.io/brain-framework/docs/commands/) · [Report an issue](https://github.com/fmind/brain-framework/issues) · [Contribute](https://github.com/fmind/brain-framework/blob/main/CONTRIBUTING.md) · [MIT licensed](https://github.com/fmind/brain-framework/blob/main/LICENSE) · [Third-party notices](https://github.com/fmind/brain-framework/blob/main/THIRD_PARTY_NOTICES.md)
@@ -15,7 +15,7 @@ A second brain for you, your team and your AI agents, on your own computer. Gath
15
15
 
16
16
  [![CI](https://github.com/fmind/brain-framework/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/fmind/brain-framework/actions/workflows/ci.yml) [![PyPI](https://img.shields.io/pypi/v/brain-framework?color=174EA6)](https://pypi.org/project/brain-framework/) [![Python](https://img.shields.io/pypi/pyversions/brain-framework)](https://pypi.org/project/brain-framework/) [![License: MIT](https://img.shields.io/badge/license-MIT-174EA6)](https://github.com/fmind/brain-framework/blob/main/LICENSE)
17
17
 
18
- [Why](https://github.com/fmind/brain-framework#why-a-second-brain) · [How it works](https://github.com/fmind/brain-framework#how-it-works) · [Try it](https://github.com/fmind/brain-framework#try-it) · [Agents](https://github.com/fmind/brain-framework#open-your-agent-in-your-brain) · [Good to know](https://github.com/fmind/brain-framework#good-to-know) · [Four-tool demo](https://fmind.github.io/brain-framework/docs/context-hub/) · [Documentation](https://fmind.github.io/brain-framework/)
18
+ [Why](https://github.com/fmind/brain-framework#why-a-second-brain) · [How it works](https://github.com/fmind/brain-framework#how-it-works) · [Try it](https://github.com/fmind/brain-framework#try-it) · [Agents](https://github.com/fmind/brain-framework#open-your-agent-in-your-brain) · [Good to know](https://github.com/fmind/brain-framework#good-to-know) · [Four-tool walkthrough](https://fmind.github.io/brain-framework/docs/context-hub/) · [Documentation](https://fmind.github.io/brain-framework/)
19
19
 
20
20
  <a href="https://raw.githubusercontent.com/fmind/brain-framework/main/docs/assets/brain-loop.svg">
21
21
  <img
@@ -56,7 +56,7 @@ Questions that once took a tour of your tools become one prompt, once you write
56
56
  - **Every source, even the ones no product connects.** Mail, calendar, documents, chat, issues and pull requests, of course. But also the release notes and security advisories of the tools you depend on, model retirement dates, provider incidents, mentions of your projects on Hacker News or Bluesky, your domains' certificates and mail security, repository traffic that GitHub forgets after 14 days and your past agent sessions. If you can script it, you can collect it.
57
57
  - **Unlimited integrations, both ways.** A sensor is a small program that prints JSON: wrap a CLI such as `gh`, `gws` or `gcloud`, call an API, drive a browser, query a database or parse an export. The same CLIs, APIs and MCP servers then let your agent act on what it learned: draft the issue, answer the thread, fix the alert.
58
58
  - **One vocabulary, one knowledge graph.** Each tool names things its own way. You declare a small ontology in `bf.yaml` and sensors map provider fields into it at collection, so the same project, person or repository connects across every tool. BF turns those explicit links into a graph you navigate in one read, each claim pointing back to its evidence.
59
- - **Private by design.** Your brain is a folder on your disk. BF has no account, server or telemetry and runs no AI model; search and read work offline.
59
+ - **Private by design.** Your brain is a folder on your disk. BF has no account, server or telemetry and never runs a model itself: [prompts](https://fmind.github.io/brain-framework/docs/prompts/) launch your agent harness. Search and read work offline.
60
60
  - **Portable and versioned.** Markdown notes, JSON records and scripts: open them in any editor, grep them, copy them to another machine. Keep the brain in a private Git repository for history, rollback, review and conflict resolution.
61
61
  - **For you or your whole team.** A personal brain stays on your laptop. A team brain is a private Git repository with one clone per teammate, so decisions, reviewed evidence and next steps are shared by everyone and their agents. Your personal brain can include the team's in its searches.
62
62
  - **Any agent, guided by skills.** Claude Code, Codex, GitHub Copilot, Antigravity or your own agent reach the same brain through the `bf` command, packaged skills or MCP. The skills teach them to find evidence, keep notes current, connect sources and maintain the brain.
@@ -94,9 +94,10 @@ A brain gives your work the structure of a detective's case file, in plain files
94
94
  | `concepts/` | Knowledge you will reuse elsewhere, with its evidence and limits. | “Explain the product before asking for signup.” |
95
95
  | `actions/` | One work session: objective, inputs, outputs, outcome and next step. | `actions/2026-09-27_website-review/ACTION.md`, resumed the next day. |
96
96
  | `routines/` | Deterministic programs you review, run on demand, on a schedule or from Git. | A weekly review that drafts an action listing projects to revisit. |
97
+ | `prompts/` | Markdown prompts your agent harness runs; each run's reply is a record. | An assistant that reviews new mail and chat every half hour. |
97
98
  | `evals/` | Saved questions with the evidence that search or read must return. | “Why one page?” must return the project's Decision section. |
98
99
 
99
- Notes are Markdown with YAML metadata, records are JSON, and `bf validate` checks both. The SQLite search cache in `.bf/` is disposable and rebuilds itself from the files. See the [file conventions](https://fmind.github.io/brain-framework/docs/brain/#directory-reference).
100
+ Notes are Markdown with YAML metadata, records are JSON, and `bf validate` checks both. `bf init --full` creates `sensors/` and `routines/`; create `prompts/` when you add a [prompt](https://fmind.github.io/brain-framework/docs/prompts/). A prompt's records hold model output, so search weighs them at half, like a low-priority source. The SQLite search cache in `.bf/` is disposable and rebuilds itself from the files. See the [file conventions](https://fmind.github.io/brain-framework/docs/brain/#directory-reference).
100
101
 
101
102
  ### `bf.yaml`, the coordination hub
102
103
 
@@ -129,7 +130,7 @@ watch: # keep sources fresh and alert on failure
129
130
  notifications: failure
130
131
  ```
131
132
 
132
- BF runs each program with its configured arguments and no shell, bounds its time and output, validates what it prints and keeps its stderr in `logs/`. A failed run never changes your evidence. `bf watch` keeps due sensors and routines fresh in a terminal dashboard, and `bf schedule` generates native systemd, launchd or cron jobs for you to install. See [sensors](https://fmind.github.io/brain-framework/docs/sensors/), [routines](https://fmind.github.io/brain-framework/docs/routines/) and [watch and schedule](https://fmind.github.io/brain-framework/docs/schedule/).
133
+ BF runs each program with its configured arguments and no shell, bounds its time and output, validates what it prints and keeps its stderr in `logs/`. A failed run never changes your evidence. `bf watch` keeps due sensors, routines and prompts fresh in a terminal dashboard, and `bf schedule` generates native systemd, launchd or cron jobs for you to install. See [sensors](https://fmind.github.io/brain-framework/docs/sensors/), [routines](https://fmind.github.io/brain-framework/docs/routines/) and [watch and schedule](https://fmind.github.io/brain-framework/docs/schedule/).
133
134
 
134
135
  ### One vocabulary, set at collection
135
136
 
@@ -153,22 +154,7 @@ Reading files gives you one document at a time, and grep finds words, not connec
153
154
  bf read project:new-website
154
155
  ```
155
156
 
156
- The reply holds the project note and its backlinks, grouped by relation: four records from four tools, side by side, in the shared vocabulary (trimmed here to refs, kinds and statuses):
157
-
158
- ```json
159
- {
160
- "relation": "project",
161
- "total": 4,
162
- "items": [
163
- { "ref": "gcloud:deployment", "fields": { "kind": "deployment", "status": "healthy" } },
164
- { "ref": "github:implementation", "fields": { "kind": "pull-request", "status": "merged" } },
165
- { "ref": "jira:review", "fields": { "kind": "issue", "status": "In review" } },
166
- { "ref": "workspace:brief", "fields": { "kind": "brief", "status": "approved" } }
167
- ]
168
- }
169
- ```
170
-
171
- From there, follow typed [relations](https://fmind.github.io/brain-framework/docs/links/#name-a-relation) such as `author`, `owner`, `depends-on` or your own. Each claim keeps the note section or record that asserted it, so an answer can always cite its evidence. `bf export` prints the whole graph as JSON Lines for DuckDB or networkx.
157
+ The reply holds the project note and its backlinks, grouped by relation: under `project`, four records from four tools side by side in the shared vocabulary, the Jira review `In review`, the GitHub pull request `merged`, the Gcloud deployment `healthy` and the Workspace brief `approved`. The [four-tool walkthrough](https://fmind.github.io/brain-framework/docs/context-hub/#collect-four-tools) shows the reply. From there, follow typed [relations](https://fmind.github.io/brain-framework/docs/links/#name-a-relation) such as `author`, `owner`, `depends-on` or your own. Each claim keeps the note section or record that asserted it, so an answer can always cite its evidence. `bf export` prints the whole graph as JSON Lines for DuckDB or networkx.
172
158
 
173
159
  ### Act, then learn
174
160
 
@@ -182,64 +168,22 @@ Retrieval assembles the context; people and agents do the work, through the CLIs
182
168
  >
183
169
  </a>
184
170
 
185
- The graph keeps conclusions current. Each project knows the evidence it links to: when a linked record changes after the note's last edit, `bf read` flags the project for review and names the record to read first, so a decision does not silently outlive its linked evidence. Try it in the [four-tool demo](https://fmind.github.io/brain-framework/docs/context-hub/#follow-a-change). [Routines](https://fmind.github.io/brain-framework/docs/routines/) run deterministic reviews and checks, such as a weekly review action or `bf validate` before each Git commit, and retrieval cases in `evals/` confirm that the questions you rely on still find their evidence as the brain grows.
171
+ The graph keeps conclusions current. Each project knows the evidence it links to: when a linked record changes after the note's last edit, `bf read` flags the project for review and names the record to read first, so a decision does not silently outlive its linked evidence. Try it in the [four-tool walkthrough](https://fmind.github.io/brain-framework/docs/context-hub/#follow-a-change). [Routines](https://fmind.github.io/brain-framework/docs/routines/) run deterministic reviews and checks, such as a weekly review action or `bf validate` before each Git commit, and retrieval cases in `evals/` confirm that the questions you rely on still find their evidence as the brain grows.
186
172
 
187
173
  ## Try it
188
174
 
189
- Start with one decision you can find again. You need Linux or macOS and [uv](https://docs.astral.sh/uv/getting-started/installation/), which installs the tested Python 3.14 if needed ([install details](https://fmind.github.io/brain-framework/docs/upgrades/#install)). No model or provider account is required.
175
+ You need Linux or macOS and [uv](https://docs.astral.sh/uv/getting-started/installation/), which installs the tested Python 3.14 if needed ([install details](https://fmind.github.io/brain-framework/docs/upgrades/#install)). No model or provider account is required.
190
176
 
191
177
  ```bash
192
178
  uv tool install --python 3.14 brain-framework
193
179
  bf --version
194
180
  ```
195
181
 
196
- If your shell cannot find `bf`, run `uv tool update-shell` and open a new shell. Then create your brain:
197
-
198
- ```bash
199
- bf init ~/brain
200
- cd ~/brain
201
- ```
202
-
203
- Create `projects/new-website.md` in your editor, or ask your agent to save this fictional decision. Use today's date for `updated`:
204
-
205
- ```markdown
206
- ---
207
- type: project
208
- status: draft
209
- updated: 2026-09-27
210
- summary: Launch a product website that helps visitors understand the product.
211
- ---
212
-
213
- # New website
214
-
215
- ## Decision
216
-
217
- Start with a single product page because visitors need a clear explanation before signing up.
218
-
219
- ## Next actions
220
-
221
- - [ ] Draft the product page.
222
- ```
223
-
224
- Find the reason, read its source and check the brain:
225
-
226
- ```bash
227
- bf search "visitors clear explanation"
228
- bf read projects/new-website.md#decision
229
- bf validate
230
- ```
231
-
232
- Search returns this match in `items` (other fields omitted):
233
-
234
- ```json
235
- { "ref": "projects/new-website.md#decision", "title": "New website — Decision" }
236
- ```
237
-
238
- `read` returns the original Decision section with its note's status and date, and validation reports `"valid":true`. Edit the note and search again: BF notices changes on its own. The [getting-started guide](https://fmind.github.io/brain-framework/docs/getting-started/) continues with a first collected source and a link from the decision to its evidence, and the [four-tool demo](https://fmind.github.io/brain-framework/docs/context-hub/) runs the whole loop offline on fictional Workspace, Jira, GitHub and Gcloud records.
182
+ Then follow [Getting started](https://fmind.github.io/brain-framework/docs/getting-started/): create a brain, save a decision, find its reason and link it to a first collected source. The [four-tool walkthrough](https://fmind.github.io/brain-framework/docs/context-hub/) then runs the whole loop offline on fictional Workspace, Jira, GitHub and Gcloud records.
239
183
 
240
184
  ## Open your agent in your brain
241
185
 
242
- Use the same brain with [Claude Code](https://code.claude.com/docs/en/overview), [Codex](https://openai.com/codex/), [GitHub Copilot](https://github.com/features/copilot) or any agent host that can run a command. Start your terminal agent in `~/brain` and give it this prompt:
186
+ Use the same brain with [Claude Code](https://code.claude.com/docs/en/overview), [Codex](https://openai.com/codex/), [GitHub Copilot](https://github.com/features/copilot) or any agent host that can run a command. After Getting started, start your terminal agent in `~/brain` and give it this prompt:
243
187
 
244
188
  > Use the bf CLI. Find why we chose a single product page. Read the source, cite its ref and tell me the project's next action.
245
189
 
@@ -256,11 +200,9 @@ Each host reads its own folder: for Claude Code, use `~/.claude/skills` instead.
256
200
  | `bf-use` | Find evidence, cite it, and keep projects and concepts current. |
257
201
  | `bf-action` | Start, resume and hand off a tracked work session: `/bf-action website-review`. |
258
202
  | `bf-setup` | Install BF, create a brain, connect the agent and choose sources worth adding. |
259
- | `bf-maintain` | Run sensors and routines, check the brain and upgrade it safely. |
260
-
261
- Working in a code repository instead? The [example session hook](https://github.com/fmind/brain-framework/tree/main/examples/hooks) prints the project that declares the repository, its next task and linked evidence when the session starts. Hosts that prefer tools can call `search` and `read` through [MCP](https://fmind.github.io/brain-framework/docs/mcp/). See the [agent guide](https://fmind.github.io/brain-framework/docs/agents/).
203
+ | `bf-maintain` | Run sensors, routines and prompts, check the brain and upgrade it safely. |
262
204
 
263
- Agents can read this documentation as Markdown: [llms.txt](https://fmind.github.io/brain-framework/llms.txt) indexes every guide with a summary, [llms-full.txt](https://fmind.github.io/brain-framework/llms-full.txt) holds their full text, and each guide's Markdown sits at its URL followed by `index.md`.
205
+ Working in a code repository instead? The [example session hook](https://github.com/fmind/brain-framework/tree/main/examples/hooks) prints the project that declares the repository, its next task and linked evidence when the session starts. During collection, a usable cached reply carries an “Index refreshing” note. Hosts that prefer tools can call `search` and `read` through [MCP](https://fmind.github.io/brain-framework/docs/mcp/). See the [agent guide](https://fmind.github.io/brain-framework/docs/agents/), which also points agents to this documentation as Markdown.
264
206
 
265
207
  ## Bring your tools
266
208
 
@@ -295,7 +237,7 @@ A brain is a folder, so Git gives it history, rollback, review and conflict reso
295
237
 
296
238
  1. **It runs on your computer, not in someone else's cloud.** That is a feature: your agent works where you can watch it, interrupt it and inspect every file it reads or writes, instead of a black box on a remote server. Sensors collect while your machine is on, through `bf watch` or a native schedule.
297
239
  1. **It takes some setup.** Each source needs its access: an API key, `gh auth login`, `gws` or `gcloud` authentication, then a sensor you review. Providers ship better CLIs and MCP servers every month, so this keeps getting easier, and the `bf-setup` skill walks your agent through it.
298
- 1. **It needs an agent harness for the reasoning.** BF runs no model: it collects, validates, searches and connects. Claude Code, Codex, Copilot, Antigravity or another harness does the thinking, so the privacy of what your agent reads depends on that harness's data terms. BF sends no telemetry or personal data to us; see [privacy and security](https://fmind.github.io/brain-framework/docs/privacy/) for a fully local setup.
240
+ 1. **It needs an agent harness for the reasoning.** BF never runs a model itself: it collects, validates, searches and connects, and its [prompts](https://fmind.github.io/brain-framework/docs/prompts/) launch your harness. Claude Code, Codex, Copilot, Antigravity or another harness does the thinking, so the privacy of what your agent reads depends on that harness's data terms. BF sends no telemetry or personal data to us; see [privacy and security](https://fmind.github.io/brain-framework/docs/privacy/) for a fully local setup.
299
241
  1. **It finds what was said and linked, not what was meant.** Search matches words and explicit identities, without embeddings, and incomplete results say so. Search and read never contact providers: collect again when you need newer evidence. See [what BF does not do](https://fmind.github.io/brain-framework/docs/concepts/#what-bf-does-not-do).
300
242
 
301
243
  [Browse the commands](https://fmind.github.io/brain-framework/docs/commands/) · [Report an issue](https://github.com/fmind/brain-framework/issues) · [Contribute](https://github.com/fmind/brain-framework/blob/main/CONTRIBUTING.md) · [MIT licensed](https://github.com/fmind/brain-framework/blob/main/LICENSE) · [Third-party notices](https://github.com/fmind/brain-framework/blob/main/THIRD_PARTY_NOTICES.md)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "brain-framework"
3
- version = "18.3.0"
3
+ version = "18.5.0"
4
4
  description = "🧠 Brain Framework: from information to informed actions."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.14"
@@ -1,7 +1,7 @@
1
1
  # https://packaging.python.org/en/latest/specifications/pyproject-toml/
2
2
  [project]
3
3
  name = "brain-framework"
4
- version = "18.3.0"
4
+ version = "18.5.0"
5
5
  description = "🧠 Brain Framework: from information to informed actions."
6
6
  readme = "README.md"
7
7
  requires-python = ">=3.14"
@@ -2,7 +2,7 @@
2
2
 
3
3
  import os
4
4
 
5
- __version__ = "18.3.0"
5
+ __version__ = "18.5.0"
6
6
 
7
7
 
8
8
  def main() -> None:
@@ -51,7 +51,7 @@ from bf.models import (
51
51
  from bf.retrieve import edges, identities, read, search
52
52
  from bf.schemas import Kind, document
53
53
  from bf.storage import Store, expand, relative, writer
54
- from bf.update import run_routines, update
54
+ from bf.update import KINDS, ProgramKind, run_prompt, run_routines, update
55
55
  from bf.validate import validate
56
56
 
57
57
 
@@ -160,6 +160,7 @@ SensorOption = Annotated[
160
160
  RoutineOption = Annotated[
161
161
  list[str] | None, typer.Option("--routine", help="Select a routine; repeat to select several.")
162
162
  ]
163
+ PromptOption = Annotated[list[str] | None, typer.Option("--prompt", help="Select a prompt; repeat to select several.")]
163
164
  # Every brain starts with knowledge and verification; the other folders are created as needed or with --full.
164
165
  FOLDERS = ("projects", "actions")
165
166
  OPTIONAL = ("memories", "assets", "sensors", "routines", "skills")
@@ -510,9 +511,9 @@ def perform(
510
511
  # A mistyped option, such as --dryrun, is invalid input instead of an argument to a routine that then runs
511
512
  # for real: routine arguments that start with a dash follow `--`.
512
513
  typer.Argument(
513
- metavar="[ROUTINE] [ARGS]...",
514
- help="A routine from bf.yaml, then arguments appended to its command; with --hook, only arguments. "
515
- "Put -- before arguments that start with a dash.",
514
+ metavar="[PROGRAM] [ARGS]...",
515
+ help="A routine from bf.yaml, then arguments appended to its command, or a prompt; with --hook, only "
516
+ "arguments. Put -- before arguments that start with a dash.",
516
517
  ),
517
518
  ] = None,
518
519
  hook: Annotated[
@@ -521,32 +522,49 @@ def perform(
521
522
  ] = "",
522
523
  brain: RunOption = "",
523
524
  dry_run: Annotated[
524
- bool, typer.Option(help="Run the routines, but write no action and record no run; logs still grow.")
525
+ bool,
526
+ typer.Option(
527
+ help="Run the routines or the prompt, but write no action or record and record no run; logs still grow."
528
+ ),
525
529
  ] = False,
526
530
  forward: Annotated[
527
531
  bool,
528
532
  typer.Option(
529
533
  "--stdin",
530
- help="Pass piped input to the routine. A hook passes what Git pipes to the routines it runs; otherwise "
531
- "none.",
534
+ help="Pass piped input to the routine, or as a prompt's {{input}}. A hook passes what Git pipes to the "
535
+ "routines it runs; otherwise none.",
532
536
  ),
533
537
  ] = False,
534
538
  ) -> None:
535
- """Run one routine, or every routine of a hook, now; a hook's piped input reaches each routine."""
539
+ """Run one routine or prompt, or every routine of a hook, now; a hook's piped input reaches each routine."""
536
540
  values = tuple(arguments or ())
537
541
  if hook:
538
542
  _option("--hook", _slug, hook)
539
543
  names, args = (), values
540
544
  elif values and not values[0].strip():
541
- raise typer.BadParameter("give a routine name; an empty value names none", param_hint="ROUTINE")
545
+ raise typer.BadParameter("give a routine or prompt name; an empty value names none", param_hint="PROGRAM")
542
546
  elif values:
543
547
  names, args = values[:1], values[1:]
544
548
  else:
545
- raise typer.BadParameter("name a routine, or pass --hook EVENT", param_hint="ROUTINE")
549
+ raise typer.BadParameter("name a routine or prompt, or pass --hook EVENT", param_hint="PROGRAM")
546
550
  store = execution(brain)
551
+ config = load(store)
552
+ if names and names[0] in config.prompts:
553
+ if args:
554
+ raise typer.BadParameter("a prompt takes no arguments; pipe its input with --stdin", param_hint="ARGS")
555
+ stdin = _input() if forward else b""
556
+ try:
557
+ text = stdin.decode("utf-8")
558
+ except UnicodeError as error:
559
+ raise Error("prompt input must be UTF-8 text") from error
560
+ result = run_prompt(store, names[0], text=text, dry_run=dry_run)
561
+ emit(result)
562
+ if not result["ok"]:
563
+ raise typer.Exit(1)
564
+ return
547
565
  # Git closes a hook's input; an agent's shell can hold its own open, so a direct run reads it only on request,
548
566
  # and a hook only for the routines it runs: a hook that no routine lists succeeds at once.
549
- stdin = _input() if forward or (hook and hooked(load(store), hook)) else b""
567
+ stdin = _input() if forward or (hook and hooked(config, hook)) else b""
550
568
  result = run_routines(store, names=names, hook=hook, args=args, stdin=stdin, dry_run=dry_run)
551
569
  emit(result)
552
570
  if not result["ok"]:
@@ -558,22 +576,42 @@ def refresh(
558
576
  brain: RunOption = "",
559
577
  sensor: SensorOption = None,
560
578
  routine: RoutineOption = None,
579
+ prompt: PromptOption = None,
580
+ kind: Annotated[
581
+ list[str] | None,
582
+ typer.Option(help="Run only this kind of program: sensor, routine or prompt; repeat for several."),
583
+ ] = None,
561
584
  dry_run: Annotated[
562
- bool, typer.Option(help="List due sensors and routines with their windows; run nothing.")
585
+ bool, typer.Option(help="List due sensors, routines and prompts with their windows; run nothing.")
563
586
  ] = False,
564
587
  ) -> None:
565
- """Run due sensors, then due routines, of one brain, then refresh its search cache."""
566
- result = update(execution(brain), dry_run=dry_run, sensors=tuple(sensor or ()), routines=tuple(routine or ()))
588
+ """Run due sensors, then due routines, then due prompts, of one brain, then refresh its search cache."""
589
+ result = update(
590
+ execution(brain),
591
+ dry_run=dry_run,
592
+ sensors=tuple(sensor or ()),
593
+ routines=tuple(routine or ()),
594
+ prompts=tuple(prompt or ()),
595
+ kinds=_kinds(kind or []),
596
+ )
567
597
  emit(result)
568
598
  if not result["ok"]:
569
599
  raise typer.Exit(1)
570
600
 
571
601
 
602
+ def _kinds(values: list[str]) -> frozenset[ProgramKind]:
603
+ """The program kinds an update runs; none given runs every kind."""
604
+ if unknown := sorted(set(values) - KINDS):
605
+ raise typer.BadParameter(f"{unknown[0]} is not sensor, routine or prompt", param_hint="--kind")
606
+ return cast("frozenset[ProgramKind]", frozenset(values)) if values else KINDS
607
+
608
+
572
609
  @app.command("watch", rich_help_panel="Collect and automate")
573
610
  def monitor(
574
611
  brain: RunOption = "",
575
612
  sensor: SensorOption = None,
576
613
  routine: RoutineOption = None,
614
+ prompt: PromptOption = None,
577
615
  interval: Annotated[
578
616
  int | None,
579
617
  typer.Option(min=5, max=86400, help="Seconds between cycles; overrides bf.yaml watch.interval (default 60)."),
@@ -605,6 +643,7 @@ def monitor(
605
643
  execution(brain),
606
644
  sensors=tuple(sensor or ()),
607
645
  routines=tuple(routine or ()),
646
+ prompts=tuple(prompt or ()),
608
647
  interval=interval,
609
648
  poll_interval=poll_interval,
610
649
  notifications=notify,
@@ -617,6 +656,7 @@ def scheduling(
617
656
  brain: RunOption = "",
618
657
  sensor: SensorOption = None,
619
658
  routine: RoutineOption = None,
659
+ prompt: PromptOption = None,
620
660
  backend: Annotated[
621
661
  Literal["auto", "systemd", "launchd", "cron"],
622
662
  typer.Option(help="Scheduler format; auto detects available platform tools."),
@@ -656,6 +696,7 @@ def scheduling(
656
696
  executable=executable,
657
697
  sensors=tuple(sensor or ()),
658
698
  routines=tuple(routine or ()),
699
+ prompts=tuple(prompt or ()),
659
700
  )
660
701
  )
661
702
 
@@ -677,7 +718,7 @@ def report(
677
718
  ),
678
719
  ] = False,
679
720
  ) -> None:
680
- """Show each brain's cache, notes, records, sensor and routine freshness, errors, logs and usage."""
721
+ """Show each brain's cache, notes, records, sensor, routine and prompt freshness, errors, logs and usage."""
681
722
  if watch:
682
723
  if check:
683
724
  raise typer.BadParameter("cannot be combined with --check", param_hint="--watch")
@@ -809,6 +850,7 @@ def _input() -> bytes:
809
850
  _GIVEN = {
810
851
  "--brain": "give a brain name or path; an empty value would select another brain",
811
852
  "--hook": "give an event name; an empty value would run the first argument as a routine",
853
+ "--prompt": "give a prompt name; an empty value names none",
812
854
  "--output": "give a directory; an empty value would name the brain's root",
813
855
  "--reproject": "give a sensor name; an empty value would rebuild the cache instead",
814
856
  "--routine": "give a routine name; an empty value names none",