brain-framework 21.2.0__tar.gz → 21.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.
Files changed (74) hide show
  1. brain_framework-21.2.0/README.md → brain_framework-21.4.0/PKG-INFO +75 -4
  2. brain_framework-21.2.0/PKG-INFO → brain_framework-21.4.0/README.md +41 -34
  3. {brain_framework-21.2.0 → brain_framework-21.4.0}/THIRD_PARTY_NOTICES.md +3 -3
  4. {brain_framework-21.2.0 → brain_framework-21.4.0}/pyproject.toml +11 -2
  5. {brain_framework-21.2.0 → brain_framework-21.4.0}/pyproject.toml.orig +11 -2
  6. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/__init__.py +1 -1
  7. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/assistants.py +88 -67
  8. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/channels.py +14 -24
  9. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/cli.py +51 -10
  10. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/collect.py +185 -50
  11. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/graph.py +2 -2
  12. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/health.py +58 -16
  13. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/history.py +6 -1
  14. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/index.py +187 -23
  15. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/mcp.py +2 -1
  16. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/models.py +164 -39
  17. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/pages.py +29 -14
  18. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/records.py +12 -8
  19. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/replies.py +267 -2
  20. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/retrieve.py +121 -41
  21. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/runtime.py +0 -12
  22. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/schemas.py +5 -7
  23. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/README.md +1 -1
  24. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-maintain/SKILL.md +1 -1
  25. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-maintain/references/integrations.md +5 -4
  26. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-maintain/references/operations.md +5 -3
  27. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-use/SKILL.md +4 -3
  28. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-use/references/evidence.md +2 -0
  29. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-use/references/learn.md +1 -1
  30. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-use/references/retrieval.md +3 -3
  31. brain_framework-21.4.0/src/bf/starter/AGENTS.md +23 -0
  32. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/starter/evals/retrieval.yaml +1 -0
  33. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/storage.py +8 -0
  34. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/update.py +18 -14
  35. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/validate.py +12 -9
  36. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/watch.py +31 -4
  37. brain_framework-21.2.0/src/bf/starter/AGENTS.md +0 -19
  38. {brain_framework-21.2.0 → brain_framework-21.4.0}/LICENSE +0 -0
  39. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/__main__.py +0 -0
  40. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/config.py +0 -0
  41. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/evaluate.py +0 -0
  42. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/install.py +0 -0
  43. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/links.py +0 -0
  44. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/markdown.py +0 -0
  45. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/messages.py +0 -0
  46. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/ontology.py +0 -0
  47. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/py.typed +0 -0
  48. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-action/SKILL.md +0 -0
  49. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-action/references/actions.md +0 -0
  50. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-action/references/context.md +0 -0
  51. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-action/references/handoff.md +0 -0
  52. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-action/scripts/check-handoff.py +0 -0
  53. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-action/scripts/new-action.py +0 -0
  54. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-action/templates/action.md +0 -0
  55. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-maintain/references/conflicts.md +0 -0
  56. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-setup/SKILL.md +0 -0
  57. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-setup/references/discovery.md +0 -0
  58. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-setup/references/import.md +0 -0
  59. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-setup/references/scan.md +0 -0
  60. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-setup/scripts/inventory.py +0 -0
  61. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-use/references/consolidate.md +0 -0
  62. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-use/references/decisions.md +0 -0
  63. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-use/references/links.md +0 -0
  64. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-use/references/review.md +0 -0
  65. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-use/references/share.md +0 -0
  66. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-use/scripts/evidence.py +0 -0
  67. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-use/scripts/guarded-write.py +0 -0
  68. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-use/templates/concept.md +0 -0
  69. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-use/templates/project.md +0 -0
  70. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/starter/concepts/index.md +0 -0
  71. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/starter/concepts/welcome.md +0 -0
  72. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/starter/gitignore +0 -0
  73. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/usage.py +0 -0
  74. {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/watch_settings.py +0 -0
@@ -1,3 +1,37 @@
1
+ Metadata-Version: 2.4
2
+ Name: brain-framework
3
+ Version: 21.4.0
4
+ Summary: Brain Framework is a local-first brain for you and your AI agents. It gathers evidence from your tools into plain files you own, connects it through an ontology you declare, lets any agent harness search it offline and can wake that harness when a gate you review finds an event.
5
+ Keywords: ai,ai-agents,agent-memory,agent-skills,agents-md,context-engineering,knowledge-graph,knowledge-management,local-first,mcp,model-context-protocol,ontology,personal-knowledge-management,python,second-brain
6
+ Author: Médéric Hurier
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ License-File: THIRD_PARTY_NOTICES.md
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Operating System :: MacOS
14
+ Classifier: Operating System :: POSIX :: Linux
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
18
+ Classifier: Topic :: Text Processing :: Indexing
19
+ Classifier: Typing :: Typed
20
+ Requires-Dist: markdown-it-py>=4.2.0,<5
21
+ Requires-Dist: pydantic>=2.13.5,<3
22
+ Requires-Dist: pyyaml>=6.0.3,<7
23
+ Requires-Dist: rich>=15.0.0,<16
24
+ Requires-Dist: typer>=0.27.2,<1
25
+ Requires-Dist: mcp>=2.1.1,<3 ; extra == 'mcp'
26
+ Requires-Python: >=3.14
27
+ Project-URL: Changelog, https://fmind.github.io/brain-framework/changelog/
28
+ Project-URL: Documentation, https://fmind.github.io/brain-framework/
29
+ Project-URL: Issues, https://github.com/fmind/brain-framework/issues
30
+ Project-URL: Repository, https://github.com/fmind/brain-framework
31
+ Project-URL: Security, https://github.com/fmind/brain-framework/security/policy
32
+ Provides-Extra: mcp
33
+ Description-Content-Type: text/markdown
34
+
1
35
  <p align="center">
2
36
  <img
3
37
  src="https://raw.githubusercontent.com/fmind/brain-framework/main/docs/assets/brain-framework.svg"
@@ -11,11 +45,15 @@
11
45
 
12
46
  **🧠 Brain Framework: from information to informed actions.**
13
47
 
14
- A second brain for you, your team and your AI agents, on your own computer. Gather what matters from every tool you work with, connect it into one knowledge graph and open your agent there, so it acts with everything you know instead of starting from scratch.
48
+ Brain Framework is a local-first brain for you and your AI agents. It gathers evidence from your tools into plain files you own, connects it through an ontology you declare, lets any agent harness search it offline and can wake that harness when a gate you review finds an event.
49
+
50
+ - **Files you own, open to any agent.** A brain is a folder of Markdown and JSON. Agents reach it through the `bf` CLI, [MCP](https://fmind.github.io/brain-framework/docs/mcp/), [Agent Skills](https://agentskills.io/specification) and `AGENTS.md`.
51
+ - **Connections you declare.** Fields and links are explicit, and each claim keeps its source record. When that record changes, `newer_evidence` flags the conclusion. Nothing is inferred.
52
+ - **You decide when your agent runs.** [Gate programs](https://github.com/fmind/brain-framework#let-your-agent-come-to-you) you review can decide when your harness starts, and the harness's own permissions decide what it may do.
15
53
 
16
54
  [![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
55
 
18
- [Try it](https://github.com/fmind/brain-framework#try-it) · [How it works](https://github.com/fmind/brain-framework#how-it-works) · [Agents](https://github.com/fmind/brain-framework#open-your-agent-in-your-brain) · [Your tools](https://github.com/fmind/brain-framework#bring-your-tools) · [Good to know](https://github.com/fmind/brain-framework#good-to-know) · [Documentation](https://fmind.github.io/brain-framework/)
56
+ [Try it](https://github.com/fmind/brain-framework#try-it) · [How it works](https://github.com/fmind/brain-framework#how-it-works) · [Agents](https://github.com/fmind/brain-framework#open-your-agent-in-your-brain) · [Your tools](https://github.com/fmind/brain-framework#bring-your-tools) · [Proactive agents](https://github.com/fmind/brain-framework#let-your-agent-come-to-you) · [Good to know](https://github.com/fmind/brain-framework#good-to-know) · [Documentation](https://fmind.github.io/brain-framework/)
19
57
 
20
58
  <a href="https://raw.githubusercontent.com/fmind/brain-framework/main/docs/assets/brain-loop.svg">
21
59
  <img
@@ -228,12 +266,45 @@ After reviewing your sensors, run `bf watch` to keep them refreshed and see fail
228
266
 
229
267
  The dashboard shows the [offline watch demo](https://github.com/fmind/brain-framework/tree/main/examples/watch), which needs no provider account.
230
268
 
269
+ ## Let your agent come to you
270
+
271
+ An [assistant](https://fmind.github.io/brain-framework/docs/prompts/) can watch what your sensors collect and speak first:
272
+
273
+ ```yaml
274
+ assistants:
275
+ triage:
276
+ prompt: prompts/triage.md
277
+ # Claude Code may run only bf read and bf search, plus what its settings allow: swap in your harness.
278
+ command:
279
+ [
280
+ claude,
281
+ --print,
282
+ --output-format,
283
+ json,
284
+ --json-schema,
285
+ "{{schema}}",
286
+ --tools,
287
+ "Read,Grep,Glob,Bash",
288
+ --allowedTools,
289
+ "Bash(bf read *),Bash(bf search *)",
290
+ --permission-mode,
291
+ dontAsk,
292
+ ]
293
+ reply: { path: /structured_output } # {say, wake}
294
+ post: desktop # a channel you declare
295
+ wake: { min: 600, max: 86400 }
296
+ schedules:
297
+ mail: { every: 600, gate: { command: [python3, routines/records-gate.py, mail] } }
298
+ ```
299
+
300
+ While `bf watch` runs, a [gate](https://github.com/fmind/brain-framework/blob/main/examples/routines/records-gate.py) you review checks the collected records every 10 minutes. Each check starts your harness only when the gate finds events. The harness speaks or stays silent and may ask for one follow-up wake. BF posts its answer to your channel and records each run. Mail text reaches your harness, so [limit its tools](https://fmind.github.io/brain-framework/docs/prompts/#keep-prompts-safe), or let a read-only assistant [propose and another act](https://fmind.github.io/brain-framework/docs/prompts/#propose-then-act).
301
+
231
302
  ## Good to know
232
303
 
233
304
  1. **Your data stays on your computer.** A brain is a folder on your disk. BF has no account, server or telemetry, and search and read work offline. Sensors collect while your machine is on.
234
305
  1. **Your agent does the reasoning.** BF never runs a model: it collects, validates, searches and connects, and its [assistants](https://fmind.github.io/brain-framework/docs/prompts/) launch your agent harness. What your agent reads reaches that harness's provider; see [privacy and security](https://fmind.github.io/brain-framework/docs/privacy/) for a fully local setup.
235
306
  1. **Git gives history and sharing.** Notes and programs are plain files: commit them for history, rollback and review. By default, collected records stay out of Git. A team brain is a private repository with one clone per teammate, and a personal brain can include it in its searches. See [team setup](https://fmind.github.io/brain-framework/docs/team/).
236
- 1. **It takes some setup.** Each source needs its access, such as `gh auth login` or `gcloud` authentication, then a sensor you review. Sensors, routines and the ontology are files you can read, edit or ask your agent to adapt.
307
+ 1. **It takes some setup.** Each source needs its access, such as `gh auth login` or `gcloud` authentication, then a sensor you review. Sensors, routines and the ontology are files you can read, edit or ask your agent to adapt. A major release lists its manual upgrade steps; see [versioning and stability](https://fmind.github.io/brain-framework/docs/upgrades/#versioning-and-stability).
237
308
  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. 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).
238
309
 
239
- [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)
310
+ [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) · [Governance](https://github.com/fmind/brain-framework/blob/main/GOVERNANCE.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,33 +1,3 @@
1
- Metadata-Version: 2.4
2
- Name: brain-framework
3
- Version: 21.2.0
4
- Summary: 🧠 Brain Framework: from information to informed actions.
5
- Keywords: ai,ai-agents,agent-memory,context-engineering,knowledge-management,local-first,mcp,model-context-protocol,python,second-brain
6
- Author: Médéric Hurier
7
- License-Expression: MIT
8
- License-File: LICENSE
9
- License-File: THIRD_PARTY_NOTICES.md
10
- Classifier: Development Status :: 5 - Production/Stable
11
- Classifier: Environment :: Console
12
- Classifier: Operating System :: MacOS
13
- Classifier: Operating System :: POSIX :: Linux
14
- Classifier: Programming Language :: Python :: 3
15
- Classifier: Programming Language :: Python :: 3.14
16
- Classifier: Typing :: Typed
17
- Requires-Dist: markdown-it-py>=4.2.0,<5
18
- Requires-Dist: pydantic>=2.13.5,<3
19
- Requires-Dist: pyyaml>=6.0.3,<7
20
- Requires-Dist: rich>=15.0.0,<16
21
- Requires-Dist: typer>=0.27.2,<1
22
- Requires-Dist: mcp>=2.1.1,<3 ; extra == 'mcp'
23
- Requires-Python: >=3.14
24
- Project-URL: Changelog, https://fmind.github.io/brain-framework/changelog/
25
- Project-URL: Documentation, https://fmind.github.io/brain-framework/
26
- Project-URL: Issues, https://github.com/fmind/brain-framework/issues
27
- Project-URL: Repository, https://github.com/fmind/brain-framework
28
- Provides-Extra: mcp
29
- Description-Content-Type: text/markdown
30
-
31
1
  <p align="center">
32
2
  <img
33
3
  src="https://raw.githubusercontent.com/fmind/brain-framework/main/docs/assets/brain-framework.svg"
@@ -41,11 +11,15 @@ Description-Content-Type: text/markdown
41
11
 
42
12
  **🧠 Brain Framework: from information to informed actions.**
43
13
 
44
- A second brain for you, your team and your AI agents, on your own computer. Gather what matters from every tool you work with, connect it into one knowledge graph and open your agent there, so it acts with everything you know instead of starting from scratch.
14
+ Brain Framework is a local-first brain for you and your AI agents. It gathers evidence from your tools into plain files you own, connects it through an ontology you declare, lets any agent harness search it offline and can wake that harness when a gate you review finds an event.
15
+
16
+ - **Files you own, open to any agent.** A brain is a folder of Markdown and JSON. Agents reach it through the `bf` CLI, [MCP](https://fmind.github.io/brain-framework/docs/mcp/), [Agent Skills](https://agentskills.io/specification) and `AGENTS.md`.
17
+ - **Connections you declare.** Fields and links are explicit, and each claim keeps its source record. When that record changes, `newer_evidence` flags the conclusion. Nothing is inferred.
18
+ - **You decide when your agent runs.** [Gate programs](https://github.com/fmind/brain-framework#let-your-agent-come-to-you) you review can decide when your harness starts, and the harness's own permissions decide what it may do.
45
19
 
46
20
  [![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)
47
21
 
48
- [Try it](https://github.com/fmind/brain-framework#try-it) · [How it works](https://github.com/fmind/brain-framework#how-it-works) · [Agents](https://github.com/fmind/brain-framework#open-your-agent-in-your-brain) · [Your tools](https://github.com/fmind/brain-framework#bring-your-tools) · [Good to know](https://github.com/fmind/brain-framework#good-to-know) · [Documentation](https://fmind.github.io/brain-framework/)
22
+ [Try it](https://github.com/fmind/brain-framework#try-it) · [How it works](https://github.com/fmind/brain-framework#how-it-works) · [Agents](https://github.com/fmind/brain-framework#open-your-agent-in-your-brain) · [Your tools](https://github.com/fmind/brain-framework#bring-your-tools) · [Proactive agents](https://github.com/fmind/brain-framework#let-your-agent-come-to-you) · [Good to know](https://github.com/fmind/brain-framework#good-to-know) · [Documentation](https://fmind.github.io/brain-framework/)
49
23
 
50
24
  <a href="https://raw.githubusercontent.com/fmind/brain-framework/main/docs/assets/brain-loop.svg">
51
25
  <img
@@ -258,12 +232,45 @@ After reviewing your sensors, run `bf watch` to keep them refreshed and see fail
258
232
 
259
233
  The dashboard shows the [offline watch demo](https://github.com/fmind/brain-framework/tree/main/examples/watch), which needs no provider account.
260
234
 
235
+ ## Let your agent come to you
236
+
237
+ An [assistant](https://fmind.github.io/brain-framework/docs/prompts/) can watch what your sensors collect and speak first:
238
+
239
+ ```yaml
240
+ assistants:
241
+ triage:
242
+ prompt: prompts/triage.md
243
+ # Claude Code may run only bf read and bf search, plus what its settings allow: swap in your harness.
244
+ command:
245
+ [
246
+ claude,
247
+ --print,
248
+ --output-format,
249
+ json,
250
+ --json-schema,
251
+ "{{schema}}",
252
+ --tools,
253
+ "Read,Grep,Glob,Bash",
254
+ --allowedTools,
255
+ "Bash(bf read *),Bash(bf search *)",
256
+ --permission-mode,
257
+ dontAsk,
258
+ ]
259
+ reply: { path: /structured_output } # {say, wake}
260
+ post: desktop # a channel you declare
261
+ wake: { min: 600, max: 86400 }
262
+ schedules:
263
+ mail: { every: 600, gate: { command: [python3, routines/records-gate.py, mail] } }
264
+ ```
265
+
266
+ While `bf watch` runs, a [gate](https://github.com/fmind/brain-framework/blob/main/examples/routines/records-gate.py) you review checks the collected records every 10 minutes. Each check starts your harness only when the gate finds events. The harness speaks or stays silent and may ask for one follow-up wake. BF posts its answer to your channel and records each run. Mail text reaches your harness, so [limit its tools](https://fmind.github.io/brain-framework/docs/prompts/#keep-prompts-safe), or let a read-only assistant [propose and another act](https://fmind.github.io/brain-framework/docs/prompts/#propose-then-act).
267
+
261
268
  ## Good to know
262
269
 
263
270
  1. **Your data stays on your computer.** A brain is a folder on your disk. BF has no account, server or telemetry, and search and read work offline. Sensors collect while your machine is on.
264
271
  1. **Your agent does the reasoning.** BF never runs a model: it collects, validates, searches and connects, and its [assistants](https://fmind.github.io/brain-framework/docs/prompts/) launch your agent harness. What your agent reads reaches that harness's provider; see [privacy and security](https://fmind.github.io/brain-framework/docs/privacy/) for a fully local setup.
265
272
  1. **Git gives history and sharing.** Notes and programs are plain files: commit them for history, rollback and review. By default, collected records stay out of Git. A team brain is a private repository with one clone per teammate, and a personal brain can include it in its searches. See [team setup](https://fmind.github.io/brain-framework/docs/team/).
266
- 1. **It takes some setup.** Each source needs its access, such as `gh auth login` or `gcloud` authentication, then a sensor you review. Sensors, routines and the ontology are files you can read, edit or ask your agent to adapt.
273
+ 1. **It takes some setup.** Each source needs its access, such as `gh auth login` or `gcloud` authentication, then a sensor you review. Sensors, routines and the ontology are files you can read, edit or ask your agent to adapt. A major release lists its manual upgrade steps; see [versioning and stability](https://fmind.github.io/brain-framework/docs/upgrades/#versioning-and-stability).
267
274
  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. 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).
268
275
 
269
- [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)
276
+ [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) · [Governance](https://github.com/fmind/brain-framework/blob/main/GOVERNANCE.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)
@@ -1635,15 +1635,15 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1635
1635
  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1636
1636
  ```
1637
1637
 
1638
- ## sse-starlette 3.6.0
1638
+ ## sse-starlette 3.7.0
1639
1639
 
1640
1640
  Source: <https://github.com/sysid/sse-starlette>
1641
1641
 
1642
1642
  License: `BSD-3-Clause`
1643
1643
 
1644
- Evidence: `sse_starlette-3.6.0.dist-info/licenses/LICENSE`
1644
+ Evidence: `sse_starlette-3.7.0.dist-info/licenses/LICENSE`
1645
1645
 
1646
- ### sse_starlette-3.6.0.dist-info/licenses/LICENSE
1646
+ ### sse_starlette-3.7.0.dist-info/licenses/LICENSE
1647
1647
 
1648
1648
  ```text
1649
1649
  Copyright © 2020, [sysid](https://sysid.github.io/).
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
  name = "brain-framework"
3
- version = "21.2.0"
4
- description = "🧠 Brain Framework: from information to informed actions."
3
+ version = "21.4.0"
4
+ description = "Brain Framework is a local-first brain for you and your AI agents. It gathers evidence from your tools into plain files you own, connects it through an ontology you declare, lets any agent harness search it offline and can wake that harness when a gate you review finds an event."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.14"
7
7
  license = "MIT"
@@ -13,21 +13,29 @@ keywords = [
13
13
  "ai",
14
14
  "ai-agents",
15
15
  "agent-memory",
16
+ "agent-skills",
17
+ "agents-md",
16
18
  "context-engineering",
19
+ "knowledge-graph",
17
20
  "knowledge-management",
18
21
  "local-first",
19
22
  "mcp",
20
23
  "model-context-protocol",
24
+ "ontology",
25
+ "personal-knowledge-management",
21
26
  "python",
22
27
  "second-brain",
23
28
  ]
24
29
  classifiers = [
25
30
  "Development Status :: 5 - Production/Stable",
26
31
  "Environment :: Console",
32
+ "Intended Audience :: Developers",
27
33
  "Operating System :: MacOS",
28
34
  "Operating System :: POSIX :: Linux",
29
35
  "Programming Language :: Python :: 3",
30
36
  "Programming Language :: Python :: 3.14",
37
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
38
+ "Topic :: Text Processing :: Indexing",
31
39
  "Typing :: Typed",
32
40
  ]
33
41
  dependencies = [
@@ -49,6 +57,7 @@ Changelog = "https://fmind.github.io/brain-framework/changelog/"
49
57
  Documentation = "https://fmind.github.io/brain-framework/"
50
58
  Issues = "https://github.com/fmind/brain-framework/issues"
51
59
  Repository = "https://github.com/fmind/brain-framework"
60
+ Security = "https://github.com/fmind/brain-framework/security/policy"
52
61
 
53
62
  [project.scripts]
54
63
  bf = "bf:main"
@@ -1,8 +1,8 @@
1
1
  # https://packaging.python.org/en/latest/specifications/pyproject-toml/
2
2
  [project]
3
3
  name = "brain-framework"
4
- version = "21.2.0"
5
- description = "🧠 Brain Framework: from information to informed actions."
4
+ version = "21.4.0"
5
+ description = "Brain Framework is a local-first brain for you and your AI agents. It gathers evidence from your tools into plain files you own, connects it through an ontology you declare, lets any agent harness search it offline and can wake that harness when a gate you review finds an event."
6
6
  readme = "README.md"
7
7
  requires-python = ">=3.14"
8
8
  license = "MIT"
@@ -12,21 +12,29 @@ keywords = [
12
12
  "ai",
13
13
  "ai-agents",
14
14
  "agent-memory",
15
+ "agent-skills",
16
+ "agents-md",
15
17
  "context-engineering",
18
+ "knowledge-graph",
16
19
  "knowledge-management",
17
20
  "local-first",
18
21
  "mcp",
19
22
  "model-context-protocol",
23
+ "ontology",
24
+ "personal-knowledge-management",
20
25
  "python",
21
26
  "second-brain",
22
27
  ]
23
28
  classifiers = [
24
29
  "Development Status :: 5 - Production/Stable",
25
30
  "Environment :: Console",
31
+ "Intended Audience :: Developers",
26
32
  "Operating System :: MacOS",
27
33
  "Operating System :: POSIX :: Linux",
28
34
  "Programming Language :: Python :: 3",
29
35
  "Programming Language :: Python :: 3.14",
36
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
37
+ "Topic :: Text Processing :: Indexing",
30
38
  "Typing :: Typed",
31
39
  ]
32
40
  dependencies = [
@@ -46,6 +54,7 @@ Changelog = "https://fmind.github.io/brain-framework/changelog/"
46
54
  Documentation = "https://fmind.github.io/brain-framework/"
47
55
  Issues = "https://github.com/fmind/brain-framework/issues"
48
56
  Repository = "https://github.com/fmind/brain-framework"
57
+ Security = "https://github.com/fmind/brain-framework/security/policy"
49
58
 
50
59
  [project.scripts]
51
60
  bf = "bf:main"
@@ -2,7 +2,7 @@
2
2
 
3
3
  import os
4
4
 
5
- __version__ = "21.2.0"
5
+ __version__ = "21.4.0"
6
6
 
7
7
 
8
8
  def main() -> None:
@@ -48,6 +48,7 @@ from bf.models import (
48
48
  decode,
49
49
  digest,
50
50
  encode,
51
+ reason,
51
52
  retried,
52
53
  timestamp,
53
54
  )
@@ -84,10 +85,6 @@ class StreamStoppedError(Error):
84
85
  """A stream worker ended outside shutdown: its input would silently stop being accepted, so watch stops."""
85
86
 
86
87
 
87
- def _reason(error: BaseException, fallback: str = "assistant files are inaccessible") -> str:
88
- return str(error) if isinstance(error, Error) else fallback
89
-
90
-
91
88
  def prepare(
92
89
  store: Store,
93
90
  name: str,
@@ -143,8 +140,8 @@ def prepare(
143
140
 
144
141
  def read_failure(channel: str, error: BaseException) -> str:
145
142
  """A failed read poll, worded alike by bf update and watch, naming the channel's read log."""
146
- reason = _reason(error, "its files are inaccessible").removeprefix(f"channel {channel}: ")
147
- return f"channel {channel}: read failed: {reason}; see {log_path(f'channel.{channel}.read')}"
143
+ cause = reason(error, "its files are inaccessible").removeprefix(f"channel {channel}: ")
144
+ return f"channel {channel}: read failed: {cause}; see {log_path(f'channel.{channel}.read')}"
148
145
 
149
146
 
150
147
  def _oversized(store: Store, work: Work) -> str:
@@ -291,11 +288,62 @@ def _exposed(work: Work) -> AbstractContextManager[None]:
291
288
  return exposing(BF_TRIGGER=work.kind, BF_SCHEDULE=_schedule(work), BF_START=work.start, BF_END=work.end)
292
289
 
293
290
 
291
+ def _recorded(
292
+ work: Work, reply: str, wake: Requested | None, metadata: dict[str, JsonValue]
293
+ ) -> tuple[Record, list[Outgoing]]:
294
+ """The record and deliveries an answer makes. The error never quotes the output."""
295
+ try:
296
+ record = Record(
297
+ id=datetime.fromisoformat(work.end).astimezone(UTC).strftime("%Y%m%dT%H%M%SZ") + "-" + work.id[-8:],
298
+ title=reply_title(work.assistant, reply),
299
+ text=reply,
300
+ time=work.end,
301
+ attributes={
302
+ "observed": work.end,
303
+ "trigger": work.kind,
304
+ "job": work.id,
305
+ "window": {"start": work.start, "end": work.end},
306
+ **({"input": work.text} if work.text else {}),
307
+ **({"output": metadata} if metadata else {}),
308
+ **({"wake": wake.model_dump()} if wake else {}),
309
+ **(
310
+ {
311
+ "channel": work.origin.channel,
312
+ "sender": work.origin.message.sender,
313
+ "conversation": work.origin.message.conversation,
314
+ }
315
+ if work.origin
316
+ else {}
317
+ ),
318
+ },
319
+ )
320
+ replies = (
321
+ [
322
+ Outgoing(
323
+ id=digest(f"{work.id}:{route.channel}:{route.conversation}".encode())[:32],
324
+ text=reply,
325
+ conversation=route.conversation,
326
+ reply_to=route.reply_to,
327
+ )
328
+ for route in work.routes
329
+ ]
330
+ if reply.strip()
331
+ else []
332
+ )
333
+ except ValidationError:
334
+ # Pydantic's message quotes the invalid input: report the cause, never the content.
335
+ raise Error(
336
+ "assistant output cannot become a record: it holds invalid Unicode or more than 2 MiB outside its "
337
+ f"message; see {log_path(work.assistant)}"
338
+ ) from None
339
+ return record, replies
340
+
341
+
294
342
  def _attempt(store: Store, work: Work, runner: Runner, argv: list[str], stdin: bytes) -> bytes:
295
- """Run the harness once, telling it why it runs; an answer that does not parse fails the attempt."""
343
+ """Run the harness once, telling it why it runs; an answer that cannot be parsed or recorded fails the attempt."""
296
344
  with _exposed(work):
297
345
  raw = runner(argv, work.settings, store, work.assistant, stdin)
298
- _answer(raw, work)
346
+ _recorded(work, *_answer(raw, work))
299
347
  return raw
300
348
 
301
349
 
@@ -318,8 +366,8 @@ def _gate(store: Store, work: Work, runner: Runner) -> list[JsonValue] | None:
318
366
  f"see {log_path(name)}"
319
367
  ) from None
320
368
  except (Error, OSError, UnicodeError) as error:
321
- reason = str(error) if isinstance(error, Error) else f"gate of schedule {schedule} failed; see {log_path(name)}"
322
- raise GateError(reason) from error
369
+ cause = reason(error, f"gate of schedule {schedule} failed; see {log_path(name)}")
370
+ raise GateError(cause) from error
323
371
  events: list[JsonValue] = [event.model_dump(exclude_defaults=True) for event in reply.events]
324
372
  if len(encode(events)) > GATE_EVENT_BYTES:
325
373
  # Saved events are reused on every retry: an oversized set would fail each prompt the same way.
@@ -401,7 +449,6 @@ def _execute(store: Store, key: str, runner: Runner) -> dict[str, object]:
401
449
  argv, stdin = expanded(store, work, queue)
402
450
  if not queue.claim(key):
403
451
  raise Error("assistant job is no longer pending; inspect bf queue")
404
- queue.lifecycle("assistant.started", work.assistant, {"job": key, "kind": work.kind})
405
452
  queue.answer(key, _attempt(store, work, runner, argv, stdin))
406
453
  row = queue.get(key)
407
454
  if row["state"] == "answered":
@@ -410,43 +457,7 @@ def _execute(store: Store, key: str, runner: Runner) -> dict[str, object]:
410
457
  raise Error("assistant returned no response to an incoming message; inspect the saved answer")
411
458
  if work.kind in {"schedule", "wake"} and not reply and not metadata:
412
459
  return _quiet(store, queue, work, key, wake)
413
- record = Record(
414
- id=datetime.fromisoformat(work.end).astimezone(UTC).strftime("%Y%m%dT%H%M%SZ") + "-" + work.id[-8:],
415
- title=reply_title(work.assistant, reply),
416
- text=reply,
417
- time=work.end,
418
- attributes={
419
- "observed": work.end,
420
- "trigger": work.kind,
421
- "job": key,
422
- "window": {"start": work.start, "end": work.end},
423
- **({"input": work.text} if work.text else {}),
424
- **({"output": metadata} if metadata else {}),
425
- **({"wake": wake.model_dump()} if wake else {}),
426
- **(
427
- {
428
- "channel": work.origin.channel,
429
- "sender": work.origin.message.sender,
430
- "conversation": work.origin.message.conversation,
431
- }
432
- if work.origin
433
- else {}
434
- ),
435
- },
436
- )
437
- replies = (
438
- [
439
- Outgoing(
440
- id=digest(f"{key}:{route.channel}:{route.conversation}".encode())[:32],
441
- text=reply,
442
- conversation=route.conversation,
443
- reply_to=route.reply_to,
444
- )
445
- for route in work.routes
446
- ]
447
- if reply.strip()
448
- else []
449
- )
460
+ record, replies = _recorded(work, reply, wake, metadata)
450
461
  queue.prepare(work, record, replies, wake)
451
462
  row = queue.get(key)
452
463
  saved = Prepared.model_validate_json(str(row["prepared"]))
@@ -553,16 +564,18 @@ def deliver(
553
564
  receipt = channels.send(store, name, command, message, runner=runner)
554
565
  queue.delivered(key, name, message, receipt)
555
566
  except (Error, OSError, UnicodeError) as error:
556
- reason = str(error) if isinstance(error, Error) else "channel send failed; inspect its local log"
567
+ cause = reason(error, "channel send failed; inspect its local log")
557
568
  attempts = int(str(delivery["attempts"])) + 1
558
- # A send command that never started sent nothing, so it retries like an idempotent one.
559
- outcome, reason, due = retry_policy(
560
- command.idempotent or isinstance(error, NotStartedError),
569
+ # A send command that never started sent nothing, so it retries like an idempotent one. A misrouted
570
+ # send may have posted elsewhere: it waits for inspection even on an idempotent channel.
571
+ outcome, cause, due = retry_policy(
572
+ (command.idempotent and not isinstance(error, channels.MisroutedError))
573
+ or isinstance(error, NotStartedError),
561
574
  delivery["job"] is not None,
562
575
  attempts,
563
- reason,
576
+ cause,
564
577
  )
565
- queue.delivery_failed(key, reason, outcome=outcome, due=due)
578
+ queue.delivery_failed(key, cause, outcome=outcome, due=due)
566
579
  except BaseException:
567
580
  # Ctrl-C or SIGTERM ends this process: record the send now, not at the next recovery pass.
568
581
  with suppress(Error, OSError):
@@ -636,9 +649,7 @@ def manual(
636
649
  raise Error("answer saved but delivery is unresolved; inspect bf queue before retrying")
637
650
  result["status"] = "ran"
638
651
  except (Error, OSError, UnicodeError) as error:
639
- result.update(
640
- status="failed", error=str(error) if isinstance(error, Error) else "assistant files are inaccessible"
641
- )
652
+ result.update(status="failed", error=reason(error, "assistant files are inaccessible"))
642
653
  return {"ok": result["status"] == "ran", "dry_run": dry_run, "assistants": [result]}
643
654
 
644
655
 
@@ -707,7 +718,7 @@ def schedule(
707
718
  "assistant": name,
708
719
  "schedule": slot.removeprefix("schedule:"),
709
720
  "status": "failed",
710
- "error": _reason(error),
721
+ "error": reason(error, "assistant files are inaccessible"),
711
722
  }
712
723
  )
713
724
  return keys, failures
@@ -828,7 +839,12 @@ def _cycle(store: Store, names: set[str], at: datetime, runner: Runner) -> list[
828
839
  )
829
840
  except (Error, OSError, UnicodeError, ValueError) as error:
830
841
  results.append(
831
- {"assistant": queue.get(key)["assistant"], "job": key, "status": "failed", "error": _reason(error)}
842
+ {
843
+ "assistant": queue.get(key)["assistant"],
844
+ "job": key,
845
+ "status": "failed",
846
+ "error": reason(error, "assistant files are inaccessible"),
847
+ }
832
848
  )
833
849
  failed: set[str] = set()
834
850
  while (delivery := queue.delivery(names=names, skip=tried)) is not None:
@@ -841,7 +857,12 @@ def _cycle(store: Store, names: set[str], at: datetime, runner: Runner) -> list[
841
857
  except (Error, OSError, UnicodeError, ValueError) as error:
842
858
  failed.add(key)
843
859
  results.append(
844
- {"assistant": delivery["assistant"], "delivery": key, "status": "failed", "error": _reason(error)}
860
+ {
861
+ "assistant": delivery["assistant"],
862
+ "delivery": key,
863
+ "status": "failed",
864
+ "error": reason(error, "assistant files are inaccessible"),
865
+ }
845
866
  )
846
867
  results.extend(
847
868
  {
@@ -893,8 +914,8 @@ def cycle(
893
914
  ]
894
915
  return _cycle(store, names, at, runner)
895
916
  except (Error, OSError, UnicodeError, ValueError) as error:
896
- reason = _reason(error, "the assistant queue or brain files are inaccessible")
897
- return [{"assistant": name, "status": "failed", "error": reason} for name in sorted(names)]
917
+ cause = reason(error, "the assistant queue or brain files are inaccessible")
918
+ return [{"assistant": name, "status": "failed", "error": cause} for name in sorted(names)]
898
919
 
899
920
 
900
921
  class Dispatcher:
@@ -1028,9 +1049,9 @@ class Dispatcher:
1028
1049
  connected=connected,
1029
1050
  )
1030
1051
  except (Error, OSError, UnicodeError) as error:
1031
- reason = str(error) if isinstance(error, Error) else "stream transport failed; inspect its local log"
1052
+ cause = reason(error, "stream transport failed; inspect its local log")
1032
1053
  with suppress(Error, OSError):
1033
- self.queue.set_progress(f"health:channel:{channel}", {"error": reason, "at": now()})
1054
+ self.queue.set_progress(f"health:channel:{channel}", {"error": cause, "at": now()})
1034
1055
  if self.stopped.wait(delay):
1035
1056
  break
1036
1057
  delay = min(delay * 2, 60)
@@ -1061,7 +1082,7 @@ class Dispatcher:
1061
1082
  config = load(self.store)
1062
1083
  except (Error, OSError, UnicodeError) as error:
1063
1084
  # Running work continues; nothing new starts until bf.yaml loads again.
1064
- self._record("dispatcher", _reason(error, "bf.yaml is inaccessible"))
1085
+ self._record("dispatcher", reason(error, "bf.yaml is inaccessible"))
1065
1086
  return
1066
1087
  errors = []
1067
1088
  # Each section fails on its own: a full queue refusing a schedule never keeps queued work from draining.
@@ -1069,7 +1090,7 @@ class Dispatcher:
1069
1090
  try:
1070
1091
  section()
1071
1092
  except (Error, OSError, UnicodeError, ValueError) as error:
1072
- errors.append(_reason(error, "assistant queue inaccessible"))
1093
+ errors.append(reason(error, "assistant queue inaccessible"))
1073
1094
  self._record("dispatcher", "; ".join(errors))
1074
1095
 
1075
1096
  def _harvest(self) -> None:
@@ -1094,7 +1115,7 @@ class Dispatcher:
1094
1115
  # Worded as bf update words it, so bf status reads the same whichever ran the poll.
1095
1116
  self._record(name, read_failure(name.split(":")[2], error))
1096
1117
  else:
1097
- self._record(name, _reason(error, "runtime worker failed"))
1118
+ self._record(name, reason(error, "runtime worker failed"))
1098
1119
 
1099
1120
  def _jobs(self) -> None:
1100
1121
  waiting = self._waiting()