brain-framework 18.3.0__tar.gz → 18.4.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.
- {brain_framework-18.3.0 → brain_framework-18.4.0}/PKG-INFO +7 -6
- {brain_framework-18.3.0 → brain_framework-18.4.0}/README.md +6 -5
- {brain_framework-18.3.0 → brain_framework-18.4.0}/pyproject.toml +1 -1
- {brain_framework-18.3.0 → brain_framework-18.4.0}/pyproject.toml.orig +1 -1
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/__init__.py +1 -1
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/cli.py +57 -15
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/collect.py +254 -41
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/health.py +64 -11
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/history.py +7 -3
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/index.py +8 -4
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/models.py +75 -7
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/pages.py +27 -8
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/replies.py +1 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/retrieve.py +2 -1
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/schedule.py +4 -3
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/skills/bf-maintain/SKILL.md +12 -12
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/skills/bf-maintain/references/integrations.md +1 -1
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/skills/bf-maintain/references/operations.md +3 -2
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/skills/bf-use/references/retrieval.md +2 -2
- brain_framework-18.4.0/src/bf/update.py +274 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/validate.py +14 -5
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/watch.py +103 -18
- brain_framework-18.3.0/src/bf/update.py +0 -184
- {brain_framework-18.3.0 → brain_framework-18.4.0}/LICENSE +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/THIRD_PARTY_NOTICES.md +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/__main__.py +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/config.py +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/evaluate.py +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/graph.py +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/install.py +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/links.py +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/markdown.py +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/mcp.py +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/ontology.py +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/py.typed +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/records.py +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/schemas.py +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/skills/README.md +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/skills/bf-action/SKILL.md +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/skills/bf-action/references/actions.md +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/skills/bf-action/references/context.md +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/skills/bf-action/references/handoff.md +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/skills/bf-action/scripts/check-handoff.py +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/skills/bf-action/scripts/new-action.py +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/skills/bf-action/templates/action.md +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/skills/bf-maintain/references/conflicts.md +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/skills/bf-setup/SKILL.md +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/skills/bf-setup/references/discovery.md +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/skills/bf-setup/references/import.md +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/skills/bf-setup/references/scan.md +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/skills/bf-setup/scripts/inventory.py +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/skills/bf-use/SKILL.md +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/skills/bf-use/references/consolidate.md +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/skills/bf-use/references/decisions.md +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/skills/bf-use/references/evidence.md +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/skills/bf-use/references/learn.md +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/skills/bf-use/references/links.md +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/skills/bf-use/references/review.md +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/skills/bf-use/references/share.md +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/skills/bf-use/scripts/evidence.py +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/skills/bf-use/scripts/guarded-write.py +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/skills/bf-use/templates/concept.md +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/skills/bf-use/templates/project.md +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/starter/AGENTS.md +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/starter/concepts/index.md +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/starter/concepts/welcome.md +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/starter/evals/retrieval.yaml +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/starter/gitignore +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/storage.py +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.0}/src/bf/usage.py +0 -0
- {brain_framework-18.3.0 → brain_framework-18.4.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
|
+
Version: 18.4.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
|
|
@@ -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
|
|
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,6 +122,7 @@ 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 on a schedule or on demand. | 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
128
|
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).
|
|
@@ -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
|
|
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
|
|
|
@@ -284,9 +285,9 @@ Each host reads its own folder: for Claude Code, use `~/.claude/skills` instead.
|
|
|
284
285
|
| `bf-use` | Find evidence, cite it, and keep projects and concepts current. |
|
|
285
286
|
| `bf-action` | Start, resume and hand off a tracked work session: `/bf-action website-review`. |
|
|
286
287
|
| `bf-setup` | Install BF, create a brain, connect the agent and choose sources worth adding. |
|
|
287
|
-
| `bf-maintain` | Run sensors and
|
|
288
|
+
| `bf-maintain` | Run sensors, routines and prompts, check the brain and upgrade it safely. |
|
|
288
289
|
|
|
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/).
|
|
290
|
+
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/).
|
|
290
291
|
|
|
291
292
|
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`.
|
|
292
293
|
|
|
@@ -323,7 +324,7 @@ A brain is a folder, so Git gives it history, rollback, review and conflict reso
|
|
|
323
324
|
|
|
324
325
|
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
326
|
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
|
|
327
|
+
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
328
|
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
329
|
|
|
329
330
|
[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)
|
|
@@ -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
|
|
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,6 +94,7 @@ 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 on a schedule or on demand. | 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
100
|
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).
|
|
@@ -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
|
|
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
|
|
|
@@ -256,9 +257,9 @@ Each host reads its own folder: for Claude Code, use `~/.claude/skills` instead.
|
|
|
256
257
|
| `bf-use` | Find evidence, cite it, and keep projects and concepts current. |
|
|
257
258
|
| `bf-action` | Start, resume and hand off a tracked work session: `/bf-action website-review`. |
|
|
258
259
|
| `bf-setup` | Install BF, create a brain, connect the agent and choose sources worth adding. |
|
|
259
|
-
| `bf-maintain` | Run sensors and
|
|
260
|
+
| `bf-maintain` | Run sensors, routines and prompts, check the brain and upgrade it safely. |
|
|
260
261
|
|
|
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/).
|
|
262
|
+
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/).
|
|
262
263
|
|
|
263
264
|
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`.
|
|
264
265
|
|
|
@@ -295,7 +296,7 @@ A brain is a folder, so Git gives it history, rollback, review and conflict reso
|
|
|
295
296
|
|
|
296
297
|
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
298
|
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
|
|
299
|
+
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
300
|
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
301
|
|
|
301
302
|
[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,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.
|
|
4
|
+
version = "18.4.0"
|
|
5
5
|
description = "🧠 Brain Framework: from information to informed actions."
|
|
6
6
|
readme = "README.md"
|
|
7
7
|
requires-python = ">=3.14"
|
|
@@ -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="[
|
|
514
|
-
help="A routine from bf.yaml, then arguments appended to its command; with --hook, only
|
|
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,
|
|
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
|
|
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="
|
|
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="
|
|
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(
|
|
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
|
|
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(
|
|
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
|
|
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",
|