brain-neural-core 1.0.1__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 (83) hide show
  1. brain_neural_core-1.0.1/LICENSE.md +105 -0
  2. brain_neural_core-1.0.1/MANIFEST.in +8 -0
  3. brain_neural_core-1.0.1/PKG-INFO +383 -0
  4. brain_neural_core-1.0.1/README.md +330 -0
  5. brain_neural_core-1.0.1/pyproject.toml +150 -0
  6. brain_neural_core-1.0.1/setup.cfg +4 -0
  7. brain_neural_core-1.0.1/src/brain_neural_core.egg-info/PKG-INFO +383 -0
  8. brain_neural_core-1.0.1/src/brain_neural_core.egg-info/SOURCES.txt +81 -0
  9. brain_neural_core-1.0.1/src/brain_neural_core.egg-info/dependency_links.txt +1 -0
  10. brain_neural_core-1.0.1/src/brain_neural_core.egg-info/entry_points.txt +3 -0
  11. brain_neural_core-1.0.1/src/brain_neural_core.egg-info/requires.txt +36 -0
  12. brain_neural_core-1.0.1/src/brain_neural_core.egg-info/top_level.txt +1 -0
  13. brain_neural_core-1.0.1/src/project_brain/__init__.py +13 -0
  14. brain_neural_core-1.0.1/src/project_brain/actionability.py +62 -0
  15. brain_neural_core-1.0.1/src/project_brain/ast_extract.py +189 -0
  16. brain_neural_core-1.0.1/src/project_brain/bm25.py +67 -0
  17. brain_neural_core-1.0.1/src/project_brain/capture_scope.py +49 -0
  18. brain_neural_core-1.0.1/src/project_brain/classify.py +57 -0
  19. brain_neural_core-1.0.1/src/project_brain/cli.py +781 -0
  20. brain_neural_core-1.0.1/src/project_brain/commands/__init__.py +0 -0
  21. brain_neural_core-1.0.1/src/project_brain/commands/add.py +92 -0
  22. brain_neural_core-1.0.1/src/project_brain/commands/bootstrap.py +1227 -0
  23. brain_neural_core-1.0.1/src/project_brain/commands/capture_merge.py +55 -0
  24. brain_neural_core-1.0.1/src/project_brain/commands/context.py +213 -0
  25. brain_neural_core-1.0.1/src/project_brain/commands/doctor.py +554 -0
  26. brain_neural_core-1.0.1/src/project_brain/commands/eval_cmd.py +46 -0
  27. brain_neural_core-1.0.1/src/project_brain/commands/eval_retrieval_cmd.py +133 -0
  28. brain_neural_core-1.0.1/src/project_brain/commands/export.py +292 -0
  29. brain_neural_core-1.0.1/src/project_brain/commands/forget.py +116 -0
  30. brain_neural_core-1.0.1/src/project_brain/commands/init.py +783 -0
  31. brain_neural_core-1.0.1/src/project_brain/commands/merge_driver.py +57 -0
  32. brain_neural_core-1.0.1/src/project_brain/commands/pending.py +63 -0
  33. brain_neural_core-1.0.1/src/project_brain/commands/push.py +516 -0
  34. brain_neural_core-1.0.1/src/project_brain/commands/review.py +117 -0
  35. brain_neural_core-1.0.1/src/project_brain/commands/search.py +99 -0
  36. brain_neural_core-1.0.1/src/project_brain/commands/session.py +359 -0
  37. brain_neural_core-1.0.1/src/project_brain/commands/setup.py +607 -0
  38. brain_neural_core-1.0.1/src/project_brain/commands/status.py +328 -0
  39. brain_neural_core-1.0.1/src/project_brain/commands/uninstall.py +217 -0
  40. brain_neural_core-1.0.1/src/project_brain/commands/value.py +114 -0
  41. brain_neural_core-1.0.1/src/project_brain/commands/verify.py +111 -0
  42. brain_neural_core-1.0.1/src/project_brain/commands/view_cmd.py +196 -0
  43. brain_neural_core-1.0.1/src/project_brain/comment_staleness.py +70 -0
  44. brain_neural_core-1.0.1/src/project_brain/commit_meta.py +149 -0
  45. brain_neural_core-1.0.1/src/project_brain/config_extract.py +420 -0
  46. brain_neural_core-1.0.1/src/project_brain/conflicts.py +94 -0
  47. brain_neural_core-1.0.1/src/project_brain/constants.py +402 -0
  48. brain_neural_core-1.0.1/src/project_brain/corroboration.py +72 -0
  49. brain_neural_core-1.0.1/src/project_brain/diagram_extract.py +137 -0
  50. brain_neural_core-1.0.1/src/project_brain/domains.py +105 -0
  51. brain_neural_core-1.0.1/src/project_brain/eval/__init__.py +18 -0
  52. brain_neural_core-1.0.1/src/project_brain/eval/gold.py +85 -0
  53. brain_neural_core-1.0.1/src/project_brain/eval/metrics.py +117 -0
  54. brain_neural_core-1.0.1/src/project_brain/eval/precision.py +217 -0
  55. brain_neural_core-1.0.1/src/project_brain/eval/retrieval_eval.py +107 -0
  56. brain_neural_core-1.0.1/src/project_brain/eval/runner.py +456 -0
  57. brain_neural_core-1.0.1/src/project_brain/git_meta.py +99 -0
  58. brain_neural_core-1.0.1/src/project_brain/git_utils.py +612 -0
  59. brain_neural_core-1.0.1/src/project_brain/github_ops.py +638 -0
  60. brain_neural_core-1.0.1/src/project_brain/imports.py +108 -0
  61. brain_neural_core-1.0.1/src/project_brain/index_db.py +430 -0
  62. brain_neural_core-1.0.1/src/project_brain/infra_extract.py +167 -0
  63. brain_neural_core-1.0.1/src/project_brain/llm_client.py +3317 -0
  64. brain_neural_core-1.0.1/src/project_brain/mcp_response.py +228 -0
  65. brain_neural_core-1.0.1/src/project_brain/mcp_server.py +1447 -0
  66. brain_neural_core-1.0.1/src/project_brain/notebook_extract.py +43 -0
  67. brain_neural_core-1.0.1/src/project_brain/policy_extract.py +145 -0
  68. brain_neural_core-1.0.1/src/project_brain/providers.py +136 -0
  69. brain_neural_core-1.0.1/src/project_brain/quality.py +190 -0
  70. brain_neural_core-1.0.1/src/project_brain/retrieval.py +266 -0
  71. brain_neural_core-1.0.1/src/project_brain/risk.py +83 -0
  72. brain_neural_core-1.0.1/src/project_brain/satd_extract.py +138 -0
  73. brain_neural_core-1.0.1/src/project_brain/schema_extract.py +623 -0
  74. brain_neural_core-1.0.1/src/project_brain/security/__init__.py +0 -0
  75. brain_neural_core-1.0.1/src/project_brain/security/scrubber.py +187 -0
  76. brain_neural_core-1.0.1/src/project_brain/semantic.py +69 -0
  77. brain_neural_core-1.0.1/src/project_brain/serving.py +146 -0
  78. brain_neural_core-1.0.1/src/project_brain/session_summary.py +113 -0
  79. brain_neural_core-1.0.1/src/project_brain/storage.py +1936 -0
  80. brain_neural_core-1.0.1/src/project_brain/szz.py +135 -0
  81. brain_neural_core-1.0.1/src/project_brain/txnlog.py +152 -0
  82. brain_neural_core-1.0.1/src/project_brain/ui.py +317 -0
  83. brain_neural_core-1.0.1/src/project_brain/views.py +181 -0
@@ -0,0 +1,105 @@
1
+ # Functional Source License, Version 1.1, Apache 2.0 Future License
2
+
3
+ ## Abbreviation
4
+
5
+ FSL-1.1-Apache-2.0
6
+
7
+ ## Notice
8
+
9
+ Copyright 2026 brainledger-solutions
10
+
11
+ ## Terms and Conditions
12
+
13
+ ### Licensor ("We")
14
+
15
+ The party offering the Software under these Terms and Conditions.
16
+
17
+ ### The Software
18
+
19
+ The "Software" is each version of the software that we make available under
20
+ these Terms and Conditions, as indicated by our inclusion of these Terms and
21
+ Conditions with the Software.
22
+
23
+ ### License Grant
24
+
25
+ Subject to your compliance with this License Grant and the Patents,
26
+ Redistribution and Trademark clauses below, we hereby grant you the right to
27
+ use, copy, modify, create derivative works, publicly perform, publicly display
28
+ and redistribute the Software for any Permitted Purpose identified below.
29
+
30
+ ### Permitted Purpose
31
+
32
+ A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
33
+ means making the Software available to others in a commercial product or
34
+ service that:
35
+
36
+ 1. substitutes for the Software;
37
+
38
+ 2. substitutes for any other product or service we offer using the Software
39
+ that exists as of the date we make the Software available; or
40
+
41
+ 3. offers the same or substantially similar functionality as the Software.
42
+
43
+ Permitted Purposes specifically include using the Software:
44
+
45
+ 1. for your internal use and access;
46
+
47
+ 2. for non-commercial education;
48
+
49
+ 3. for non-commercial research; and
50
+
51
+ 4. in connection with professional services that you provide to a licensee
52
+ using the Software in accordance with these Terms and Conditions.
53
+
54
+ ### Patents
55
+
56
+ To the extent your use for a Permitted Purpose would necessarily infringe our
57
+ patents, the license grant above includes a license under our patents. If you
58
+ make a claim against any party that the Software infringes or contributes to
59
+ the infringement of any patent, then your patent license to the Software ends
60
+ immediately.
61
+
62
+ ### Redistribution
63
+
64
+ The Terms and Conditions apply to all copies, modifications and derivatives of
65
+ the Software.
66
+
67
+ If you redistribute any copies, modifications or derivatives of the Software,
68
+ you must include a copy of or a link to these Terms and Conditions and not
69
+ remove any copyright notices provided in or with the Software.
70
+
71
+ ### Disclaimer
72
+
73
+ THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
74
+ IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
75
+ PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
76
+
77
+ IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
78
+ SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
79
+ EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
80
+
81
+ ### Trademarks
82
+
83
+ Except for displaying the License Details and identifying us as the origin of
84
+ the Software, you have no right under these Terms and Conditions to use our
85
+ trademarks, trade names, service marks or product names.
86
+
87
+ ## Grant of Future License
88
+
89
+ We hereby irrevocably grant you an additional license to use the Software under
90
+ the Apache License, Version 2.0 that is effective on the second anniversary of
91
+ the date we make the Software available. On or after that date, you may use the
92
+ Software under the Apache License, Version 2.0, in which case the following
93
+ will apply:
94
+
95
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
96
+ this file except in compliance with the License.
97
+
98
+ You may obtain a copy of the License at
99
+
100
+ http://www.apache.org/licenses/LICENSE-2.0
101
+
102
+ Unless required by applicable law or agreed to in writing, software distributed
103
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
104
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
105
+ specific language governing permissions and limitations under the License.
@@ -0,0 +1,8 @@
1
+ # Keep the source distribution as lean as the wheel: the package + essential
2
+ # metadata ONLY (README, LICENSE, pyproject). setuptools already limits the sdist
3
+ # to the package plus metadata; the one extra it pulls in is the top-level tests/
4
+ # tree, which end users don't need — so drop it. Nothing internal (design, strategy,
5
+ # deploy, .brain) is ever included by the default file finder.
6
+ prune tests
7
+ global-exclude *.py[cod]
8
+ global-exclude .DS_Store
@@ -0,0 +1,383 @@
1
+ Metadata-Version: 2.4
2
+ Name: brain-neural-core
3
+ Version: 1.0.1
4
+ Summary: Project Brain — Engineering memory for AI-assisted teams
5
+ Author-email: BrainLedger Solutions <brainledger.solutions@gmail.com>
6
+ License-Expression: FSL-1.1-ALv2
7
+ Project-URL: Homepage, https://brainledger.solutions
8
+ Project-URL: Playground, https://try.brainledger.solutions/
9
+ Keywords: ai,agents,engineering-memory,mcp,llm,code-context,git,developer-tools,knowledge-base
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Environment :: Console
19
+ Classifier: Topic :: Software Development :: Version Control :: Git
20
+ Classifier: Topic :: Software Development :: Documentation
21
+ Requires-Python: >=3.10
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE.md
24
+ Requires-Dist: GitPython>=3.1.43
25
+ Requires-Dist: python-dotenv>=1.0.1
26
+ Requires-Dist: click>=8.1.7
27
+ Requires-Dist: rich>=13.7.1
28
+ Requires-Dist: mcp<2,>=1.29
29
+ Provides-Extra: openai
30
+ Requires-Dist: openai>=1.35.0; extra == "openai"
31
+ Provides-Extra: anthropic
32
+ Requires-Dist: anthropic>=0.28.0; extra == "anthropic"
33
+ Provides-Extra: google
34
+ Requires-Dist: google-generativeai>=0.7.0; extra == "google"
35
+ Provides-Extra: groq
36
+ Requires-Dist: openai>=1.35.0; extra == "groq"
37
+ Provides-Extra: dev
38
+ Requires-Dist: pytest>=8.0; extra == "dev"
39
+ Provides-Extra: all-cloud
40
+ Requires-Dist: openai>=1.35.0; extra == "all-cloud"
41
+ Requires-Dist: anthropic>=0.28.0; extra == "all-cloud"
42
+ Requires-Dist: google-generativeai>=0.7.0; extra == "all-cloud"
43
+ Provides-Extra: docs
44
+ Requires-Dist: python-docx>=1.1.0; extra == "docs"
45
+ Requires-Dist: pypdf>=4.0.0; extra == "docs"
46
+ Provides-Extra: all
47
+ Requires-Dist: openai>=1.35.0; extra == "all"
48
+ Requires-Dist: anthropic>=0.28.0; extra == "all"
49
+ Requires-Dist: google-generativeai>=0.7.0; extra == "all"
50
+ Requires-Dist: python-docx>=1.1.0; extra == "all"
51
+ Requires-Dist: pypdf>=4.0.0; extra == "all"
52
+ Dynamic: license-file
53
+
54
+ # Project Brain
55
+
56
+ ![License: FSL-1.1-Apache-2.0](https://img.shields.io/badge/license-FSL--1.1--Apache--2.0-blue.svg)
57
+ ![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)
58
+ ![Status: Beta](https://img.shields.io/badge/status-beta-orange.svg)
59
+ ![Local-first](https://img.shields.io/badge/architecture-local--first-2ea44f.svg)
60
+ ![MCP server](https://img.shields.io/badge/MCP-server-8A2BE2.svg)
61
+
62
+ **Engineering memory for AI-assisted teams.** Project Brain captures the decisions,
63
+ constraints, and hard-won lessons in your codebase — automatically, on every push — keeps
64
+ them in version control alongside your code, and serves them to your AI coding agents so a
65
+ session starts with what your team already decided instead of guessing at it.
66
+
67
+ It is **deterministic by default** (no LLM, API key, or network required) and
68
+ **conflict-aware**: when new work contradicts a settled decision, Brain flags it and records
69
+ how you resolved it.
70
+
71
+ ---
72
+
73
+ **Try it without installing:** [try.brainledger.solutions](https://try.brainledger.solutions/)
74
+
75
+ ## Setup
76
+
77
+ **Prerequisites:** Python 3.10+ and Git must be on your PATH.
78
+
79
+ ### Quick path — one command after install
80
+
81
+ ```bash
82
+ # 1. install
83
+ pip install brain-neural-core
84
+
85
+ # 2. wire repos, seed memory, and verify in one go
86
+ brain setup
87
+ ```
88
+
89
+ `brain setup` walks you through each repo interactively, runs `brain init` and
90
+ `brain bootstrap` for each one, then performs the step-6 `brain doctor` check.
91
+ Steps 3 and 4 below (editor restart and approval) are still yours.
92
+
93
+ ### Manual steps — if you prefer to run each piece yourself
94
+
95
+ Six steps, once per repository. Run them in this order.
96
+
97
+ ```bash
98
+ # 1. install
99
+ pip install brain-neural-core
100
+
101
+ # 2. wire this repo — git hooks + MCP config for your editor
102
+ cd your-repo
103
+ brain init
104
+
105
+ # 3. seed memory from the history you already have
106
+ brain bootstrap
107
+ ```
108
+
109
+ **4. Restart VS Code** (or whichever editor you use — quit and reopen it).
110
+
111
+ An MCP server is only discovered when a session starts, so Brain is invisible to any editor
112
+ window that was already open. **This is the most common reason an agent reports no Brain tools.**
113
+
114
+ **5. Approve the server when your editor asks.** An editor will not launch a local program just
115
+ because a config file says so. In Claude Code, accept the *trust this project* prompt; in Cursor,
116
+ Windsurf or Cline, enable `project-brain` in the MCP settings if it shows as disabled.
117
+
118
+ ```bash
119
+ # 6. verify — this performs a real MCP handshake, it does not just check for files
120
+ brain doctor
121
+ ```
122
+
123
+ Expect `MCP handshake 10 tool(s), 2 prompt(s)`. If you see that, setup is done.
124
+
125
+ From here, keep using Git as before: `git push` captures new memory, `git pull` captures rationale
126
+ from merged pull requests, and your agent is served the relevant memory before it edits a file.
127
+
128
+ *Optional extras, not needed for the above:* `pip install "brain-neural-core[openai]"` — or
129
+ `[anthropic]`, `[google]`, `[groq]` — enables the optional LLM enrichment pass (`brain init --llm`).
130
+ `[docs]` reads `.docx` / `.pdf`, which are picked up by capture on push, not by `brain bootstrap`.
131
+
132
+ ## How it works
133
+
134
+ 1. **Capture.** On every push/merge, Brain reads your commits and code and records structured
135
+ engineering memory across seven kinds:
136
+
137
+ | Kind | What it captures |
138
+ |---|---|
139
+ | **Decision** | why it was built this way |
140
+ | **Constraint** | a limit or invariant the code must hold |
141
+ | **Business rule** | a domain rule the code must reflect |
142
+ | **Historical failure** | something that broke before — so it isn't repeated |
143
+ | **Trade-off** | what was exchanged for what |
144
+ | **Intent** | what a feature is meant to do |
145
+ | **Technical debt** | a `TODO`/`FIXME` the team acknowledged and deferred |
146
+
147
+ The first six are **rules**: they go into `AGENTS.md` and are served to your agent before it
148
+ edits a file. Technical debt is recorded, exported and counted, but deliberately kept out of
149
+ both — it is acknowledged-but-deferred work, not a rule to obey.
150
+
151
+ It runs locally and deterministically — nothing leaves your machine.
152
+
153
+ 2. **Store.** Memory lives in version control (`AGENTS.md` + a `.brain/` folder), so it travels
154
+ with the repository and merges cleanly across your team.
155
+
156
+ 3. **Serve.** Brain ships an **MCP server** that hands the relevant memory to your AI agent
157
+ *before* it edits a file — so the agent respects your prior decisions instead of relitigating
158
+ them.
159
+
160
+ 4. **Stay conflict-aware.** When a newly-captured decision contradicts a settled one, Brain
161
+ surfaces it — in your agent's chat and in `brain review`. Accepting the new one **supersedes**
162
+ the old: the resolution is recorded (what replaced what, when, and by whom), and the retired
163
+ decision is kept as history but no longer served.
164
+
165
+ **Deterministic by default.** Capture, conflict detection, and serving all run with no LLM, key,
166
+ or network. An **optional** enrichment pass (bring your own key — local via
167
+ [Ollama](https://ollama.com), or a cloud provider) adds deeper, inferred memory; enable it with
168
+ `brain init --llm`.
169
+
170
+ ## Commands
171
+
172
+ | Command | What it does |
173
+ |---|---|
174
+ | `brain init` | Set up Brain in the current repo (capture + AI-tool config). One-time. |
175
+ | `brain setup` | Check the machine, wire one or more repos, and verify an agent can reach Brain. |
176
+ | `brain bootstrap` | Seed memory from your existing history. One-time deep scan. |
177
+ | `brain status` | What Brain knows about this repo, at a glance. |
178
+ | `brain review` | Review proposed memory — accept (and supersede conflicts) or reject. |
179
+ | `brain search <words>` | Search your memory by keyword — the claim, its rationale, its file. |
180
+ | `brain value` | Whether Brain has actually changed anything for you, and where it hasn't. |
181
+ | `brain context --file <path>` | Show the memory relevant to a file (what your agent receives). |
182
+ | `brain view` | Project the memory into a risk & knowledge report, a one-page brief, or a team-adoption rollup. |
183
+ | `brain pending` | Show memory queued for the next push, before it is shared. |
184
+ | `brain add` | Manually record a decision, rule, or constraint. |
185
+ | `brain forget <text-or-id>` | Remove a captured item that is wrong, and stop it coming back. |
186
+ | `brain export` | Export captured memory to a shareable text file. |
187
+ | `brain verify` | Retire memory whose source file is gone, report stale items, and rebuild `AGENTS.md` if it has drifted from `.brain/memory/`. |
188
+ | `brain doctor` | Verify the setup and diagnose issues. |
189
+ | `brain uninstall` | Remove Brain's wiring from a repo (memory is kept unless you ask). |
190
+
191
+ Capture on `git push` / `git pull` is automatic after `brain init` — you rarely run it by hand.
192
+ Run `brain --help` for the full list.
193
+
194
+ ## Connect your AI tool (MCP)
195
+
196
+ `brain init` writes the config for **Cursor, Claude Code, Windsurf and Cline** (step 2 above);
197
+ any MCP-capable client can point at the bundled `brain-mcp-server`. Steps 4 and 5 of *Setup* —
198
+ restart the editor, approve the server — are the parts that cannot be automated from here.
199
+
200
+ Per-editor detail for step 5:
201
+
202
+ - **Claude Code** — reads `.mcp.json` at the repo root and prompts you to **trust the project**
203
+ the first time you open it. Accept it, then run `/mcp`; `project-brain` should be listed. If it
204
+ is never offered, register it at user scope instead:
205
+
206
+ ```bash
207
+ claude mcp add project-brain brain-mcp-server -e "BRAIN_REPO_ROOT=/path/to/your-repo"
208
+ claude mcp list # project-brain should appear
209
+ ```
210
+
211
+ - **Cursor / Windsurf / Cline** — open the MCP settings and enable `project-brain` if it shows as
212
+ disabled or pending. `brain init` wrote `.cursor/mcp.json`, `.windsurf/mcp.json` or
213
+ `.cline/mcp_settings.json`.
214
+
215
+ ### Two commands you can run inside the chat
216
+
217
+ Once the server is connected, your editor lists Brain's prompts alongside its own — in Claude
218
+ Code they appear as `/mcp__project-brain__…`:
219
+
220
+ | prompt | what it does |
221
+ |---|---|
222
+ | **`value`** | Reports what Brain has actually changed in this repo, in the chat. Same figures as `brain value`. |
223
+ | **`why`** (`file`) | Explains why a file is the way it is, using **only** recorded memory — and says so plainly where nothing was recorded, rather than inferring a rationale from the code. |
224
+
225
+ Like tools, prompts are fixed when a session starts, so they appear after the next restart.
226
+
227
+ ### After a reboot, or an OS update
228
+
229
+ **Nothing to restart.** The MCP server is not a background service — your IDE launches
230
+ `brain-mcp-server` on demand over stdio and it exits with the session. A reboot leaves no
231
+ state to recover, and the first agent session afterwards starts it fresh.
232
+
233
+ What *does* break the link is anything that **moves the executable**, because the config
234
+ records its absolute path: `pipx reinstall`, a Python minor upgrade, switching between pip and
235
+ pipx, or recreating a venv. Symptom: the agent has no Brain tools, and `brain doctor` reports
236
+ the handshake failing.
237
+
238
+ ```bash
239
+ brain init # re-stamps the paths in this repo
240
+ brain doctor # confirm the handshake passes again
241
+ ```
242
+
243
+ Git hooks are stamped the same way, so re-running `brain init` after any environment change
244
+ fixes capture and MCP together.
245
+
246
+ ## Is Brain actually capturing?
247
+
248
+ A hook file existing is not a hook running, so Brain records a heartbeat each time capture
249
+ runs and reports it plainly:
250
+
251
+ ```bash
252
+ brain doctor # per repo, with the reason
253
+ brain status # push count and last capture date
254
+ ```
255
+
256
+ | what you see | what it means |
257
+ |---|---|
258
+ | `capture is running` | the hook ran at the current commit — working |
259
+ | `capture is STALE` | it ran before, but commits have landed since without capture |
260
+ | `capture never ran here` | no heartbeat at all — expected in a fresh clone, since **git hooks are never cloned** |
261
+
262
+ `brain status` also reports the other half — whether anything has actually *read* the memory:
263
+
264
+ ```
265
+ Served to agents
266
+ Retrievals (7 days): 24
267
+ Last retrieval: 2026-08-05 09:12 UTC
268
+ Most used: get_context x18, search_memory x4
269
+ ```
270
+
271
+ `none recorded on this machine` means either no agent has queried Brain yet, or MCP isn't
272
+ reachable — `brain doctor` performs a real handshake and tells you which. This reads the
273
+ local, per-developer log, so it reflects *your* machine, not the team's.
274
+
275
+ That last one is the case people miss: cloning a Brain-enabled repo brings the memory but not
276
+ the hooks. Run `brain init` in the clone, make a commit and push, and the state moves to
277
+ `capture is running`.
278
+
279
+ For a repo where capture must not silently stop, `brain setup --ci` installs a GitHub Actions
280
+ workflow that reports when memory has not been updated alongside a change.
281
+
282
+ ## Is it worth keeping?
283
+
284
+ ```bash
285
+ brain value
286
+ ```
287
+
288
+ Counts the times Brain **changed an outcome** — a rule that blocks, an approach already
289
+ rejected in this repo, a contradiction caught before it landed — and keeps those apart from
290
+ raw retrieval counts, which only prove a tool ran.
291
+
292
+ ```
293
+ Did it change anything?
294
+ ✓ Changed the outcome 9 time(s)
295
+ Blocking rules supplied: 14
296
+ Rejected approaches raised: 3
297
+ Contradictions caught: 2
298
+
299
+ Activity · context, not value
300
+ Agent retrievals (30d): 12
301
+ ...
302
+
303
+ Memory
304
+ Items: 58
305
+ Carrying a rationale: 6 of 58 (10%) - the WHY an agent cannot re-derive
306
+ ```
307
+
308
+ That last figure is usually low, and this sample is not flattering it: across our 58-repository
309
+ corpus only about **2%** of captured items carry a rationale. Most memory records *what* a rule is,
310
+ not why it exists — which is a real limitation, and one `brain value` is designed to show you
311
+ rather than hide.
312
+
313
+ It will also tell you when the answer is unflattering. **`Read, but not steering`** means your
314
+ agent is pulling memory but none of it was consequential — usually because the captured items
315
+ restate the code instead of recording a *why*. **`No evidence yet`** means nothing has queried
316
+ Brain at all, which is most often MCP not being authorised in your editor; `brain doctor`
317
+ performs a real handshake and tells you which.
318
+
319
+ ## Working as a team
320
+
321
+ Captured **memory collates by itself** — `AGENTS.md` and `.brain/memory/` are committed, so
322
+ everyone on the repo shares it through normal `git pull` / `git push`, and `brain init`
323
+ registers merge drivers that union concurrent capture instead of conflicting.
324
+
325
+ **Each teammate still runs the whole of *Setup* once per clone** — all six steps, including the
326
+ editor restart. Git does not clone hooks, and MCP config is per-machine, so a fresh clone captures
327
+ nothing and serves nothing until they do. They can skip step 3 (`brain bootstrap`); the memory is
328
+ already committed.
329
+
330
+ To see whether it is actually being used:
331
+
332
+ ```bash
333
+ brain view --lens team
334
+ ```
335
+
336
+ ```
337
+ Team totals
338
+ Developers reporting: 4
339
+ Memory contributed: 82
340
+ Conflicts caught: 4
341
+ Agent retrievals: 267
342
+
343
+ By developer
344
+ developer contributed conflicts retrievals last active
345
+ Arjun Sharma 58 3 142 2026-08-05
346
+ Priya Nair 9 0 0 2026-07-30
347
+ ! not retrieving 1 developer(s) contribute memory but never read it
348
+ ```
349
+
350
+ Each developer's machine writes one shard to `.brain/metrics/<name>.json` on push. One file
351
+ per person means shards never merge-conflict. They hold **counts and a date only** — never
352
+ your queries, file paths, or per-call times — and a developer showing contributions but zero
353
+ retrievals almost always has MCP unauthorised in their editor, which `brain doctor` on that
354
+ machine will confirm.
355
+
356
+ ## Status
357
+
358
+ **Beta.** The deterministic capture path, MCP serving and conflict handling are in daily use and
359
+ covered by over 1,300 tests, run on Windows and Linux.
360
+
361
+ Every release is regression-tested against a 58-repository corpus, and extraction quality is
362
+ checked by hand-labelling what Brain captured from repositories held out from development. On the
363
+ most recent of those, **86–90% of captured items were judged correct** by a reviewer who did not
364
+ write the extraction rules. That is a small sample, so treat it as indicative rather than precise;
365
+ how much of a repository's memory Brain *finds* is not something we have measured.
366
+
367
+ Extraction is not perfect — expect to prune the occasional item with `brain review` /
368
+ `brain forget`, and please report anything that looks wrong.
369
+
370
+ Brain is built for working codebases. Pointed at a tutorial or textbook repository, it will mine
371
+ the subject matter being taught as though it were the project's own decisions.
372
+
373
+ **In progress:** richer rationale on captured items, and better handling of plain configuration
374
+ values. Memory is plain JSON in your repo, so nothing is ever locked in.
375
+
376
+ ## License
377
+
378
+ Source-available under **FSL-1.1-Apache-2.0** — free for internal and most uses. The full text
379
+ ships as `LICENSE.md` inside the package.
380
+
381
+ *(PyPI and `pip show` display this licence as `FSL-1.1-ALv2`. Same licence, two registries: the
382
+ Functional Source License names itself `FSL-1.1-Apache-2.0`, while `FSL-1.1-ALv2` is its SPDX
383
+ identifier, and Python package metadata must use SPDX.)*