@mindmux/cli 0.0.0-stage → 0.1.1
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.
- package/LICENSE +201 -0
- package/README.md +58 -2
- package/bin/mindmux.mjs +3 -0
- package/bin/mmx.mjs +6 -0
- package/docs/README.md +14 -0
- package/docs/agents.md +61 -0
- package/docs/brain.md +54 -0
- package/docs/cloud.md +29 -0
- package/docs/development.md +24 -0
- package/docs/installation.md +86 -0
- package/docs/setup.md +116 -0
- package/package.json +40 -4
- package/src/brain-index.mjs +31 -0
- package/src/brain.mjs +117 -0
- package/src/clean.mjs +119 -0
- package/src/cli.mjs +254 -0
- package/src/cloud.mjs +164 -0
- package/src/codex-hooks.mjs +15 -0
- package/src/doctor.mjs +95 -0
- package/src/hooks.mjs +106 -0
- package/src/host-config.mjs +108 -0
- package/src/integrations.mjs +100 -0
- package/src/mcp-server.mjs +114 -0
- package/src/menu.mjs +49 -0
- package/src/prompts.mjs +31 -0
- package/src/recall.mjs +64 -0
- package/src/review.mjs +166 -0
- package/src/setup.mjs +297 -0
- package/src/status.mjs +65 -0
- package/src/storage.mjs +76 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,59 @@
|
|
|
1
|
-
#
|
|
1
|
+
# MindMux CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`mmx` gives your coding agent a project Brain: persistent knowledge it can read while working and update as decisions settle. Connect Claude Code or Codex to a Cloud or local Brain with one setup command.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
Requires **Node.js 22+** and **macOS or Linux**.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @mindmux/cli
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Or with pnpm:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm add -g @mindmux/cli
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
See [installation options](docs/installation.md) for source installation and troubleshooting.
|
|
20
|
+
|
|
21
|
+
## Get started
|
|
22
|
+
|
|
23
|
+
Inside the project you want to connect, run:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
cd /path/to/your/project
|
|
27
|
+
mmx setup
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Use the arrow keys and Enter to choose your agent, Workspace and Project, or create a new Project. Setup handles browser login, project MCP configuration, instructions and hooks, then checks the connection.
|
|
31
|
+
|
|
32
|
+
**Restart your agent and approve its trust prompts.** In Codex, also review the installed hooks with `/hooks`. You can then work as usual: the agent receives relevant Brain context and is guided to save confirmed decisions. You do not need to mention Brain in every request.
|
|
33
|
+
|
|
34
|
+
Want a local Brain without Cloud login? Run `mmx setup --local` instead.
|
|
35
|
+
|
|
36
|
+
## Everyday commands
|
|
37
|
+
|
|
38
|
+
| Command | Purpose |
|
|
39
|
+
| --- | --- |
|
|
40
|
+
| `mmx` | Open the interactive menu |
|
|
41
|
+
| `mmx status --online` | Check the connection |
|
|
42
|
+
| `mmx doctor --fix` | Diagnose and repair setup |
|
|
43
|
+
| `mmx switch` | Choose another Brain |
|
|
44
|
+
| `mmx --help` | Show command help |
|
|
45
|
+
|
|
46
|
+
To start setup again, `mmx clean` resets local integration, binding, local Brain data and CLI login after confirmation. **Cloud data is kept.** Use `mmx clean --keep-login` to stay signed in. See [cleanup details](docs/setup.md#reset-for-testing).
|
|
47
|
+
|
|
48
|
+
## Documentation
|
|
49
|
+
|
|
50
|
+
- [Installation](docs/installation.md) — npm, pnpm and requirements.
|
|
51
|
+
- [Setup and maintenance](docs/setup.md) — agent trust, upgrades, repair and cleanup.
|
|
52
|
+
- [Brain commands](docs/brain.md) — query, write and index operations.
|
|
53
|
+
- [Cloud login](docs/cloud.md) — authentication and binding.
|
|
54
|
+
- [Agent behavior](docs/agents.md) — hooks, memory reviews and limits.
|
|
55
|
+
- [Development](docs/development.md) — tests and verification.
|
|
56
|
+
|
|
57
|
+
## License
|
|
58
|
+
|
|
59
|
+
Apache-2.0. See [LICENSE](LICENSE).
|
package/bin/mindmux.mjs
ADDED
package/bin/mmx.mjs
ADDED
package/docs/README.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Documentation
|
|
2
|
+
|
|
3
|
+
[Back to README](../README.md)
|
|
4
|
+
|
|
5
|
+
Start with `mmx setup` in your project. Use these guides when you need more detail.
|
|
6
|
+
|
|
7
|
+
| Guide | What you will find |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| [Installation](installation.md) | Requirements, pnpm/npm source installation, path changes |
|
|
10
|
+
| [Setup and maintenance](setup.md) | Setup options, Codex trust, status, repair, switching, migration and reset |
|
|
11
|
+
| [Cloud login](cloud.md) | Authentication, Workspaces, Projects and explicit binding |
|
|
12
|
+
| [Brain commands](brain.md) | Reading, writing, indexing, concurrency and low-level MCP access |
|
|
13
|
+
| [Agent behavior](agents.md) | Retrieval, language, hooks, Codex reviews and known limits |
|
|
14
|
+
| [Development](development.md) | Automated checks, demos and opt-in Cloud verification |
|
package/docs/agents.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Agent behavior and limits
|
|
2
|
+
|
|
3
|
+
[Back to README](../README.md) · [Documentation](README.md)
|
|
4
|
+
|
|
5
|
+
| Agent | Session start | User request | End of turn |
|
|
6
|
+
| --- | --- | --- | --- |
|
|
7
|
+
| Claude Code | SessionStart context, including supported resume/compaction boundaries | UserPromptSubmit retrieval and injection | One Stop review, with recursion protection |
|
|
8
|
+
| Codex | SessionStart hook + AGENTS.md; restores active review after compaction | UserPromptSubmit recall and pre-answer review | Stop allows a registered review; otherwise requests one recovery |
|
|
9
|
+
| Cursor local agent | sessionStart base context | beforeSubmitPrompt retrieval; first preToolUse delivers relevant context | One stop follow-up, with `loop_limit=1` |
|
|
10
|
+
|
|
11
|
+
Unified `setup` supports Claude Code and Codex. To install Cursor rules and hooks separately, first bind or initialize a Brain, then run:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
mmx connect --agent cursor
|
|
15
|
+
mmx disconnect --agent cursor
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Cursor's beforeSubmitPrompt hook is used for retrieval, not context injection. Its sessionStart hook is fire-and-forget, and preToolUse may run after the first tool's arguments have already been constructed. A turn with no tool calls depends on startup context and persistent rules. Cloud agent VMs are outside the supported scope of this local integration.
|
|
19
|
+
|
|
20
|
+
Hooks and rules encourage relevant reads and confirmed writes; configuration alone does not prove that an agent has used the knowledge. Claude Code and Codex both use startup, prompt, and Stop hooks alongside project instructions. The CLI does not run an additional LLM, read conversation transcripts, or automatically turn discussion into facts. Claude Code and Cursor may add one end-of-turn model continuation. Codex reviews memory before the final answer and registers the result locally; normal registered turns do not require a Stop continuation. A missing or failed review may still add one visible recovery and repeat the final answer. No extra LLM is run by the CLI, and these mechanisms do not guarantee that every durable fact is captured.
|
|
21
|
+
|
|
22
|
+
Brain knowledge follows the user's working language: Chinese conversations produce Chinese Page titles, knowledge and human-authored timeline descriptions; English conversations produce English knowledge, unless the user requests otherwise. English CLI prompts and repository documentation do not set the knowledge language. IDs, commands, code, URLs and verbatim evidence are preserved.
|
|
23
|
+
|
|
24
|
+
Start each Page's current knowledge with one or two plain prose sentences stating what it records, the core conclusion and when to read it, before headings, dates, provenance or lists. Put the conclusion in the first sentence and keep it current when updating the body. The existing index extracts this opening; no summary field is added. This writing guidance is delivered through installed agent rules, hook recall context and the CLI MCP service. Existing installations receive updated hook context when running the new CLI; rerun `mmx connect --agent codex` or `mmx connect --agent claude-code` to refresh the installed rules, and restart the MCP service to refresh its instructions. CLI writes preserve submitted text and do not translate or rewrite it automatically.
|
|
25
|
+
|
|
26
|
+
Codex hooks supply a review token scoped to the project, bound Brain, session and turn. The agent passes `--review-token TOKEN` to `brain create`, `update`, `append`, `archive` and `update-root`, then registers the final review:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
mmx brain review --review-token TOKEN --outcome saved --reason "Saved and verified the confirmed decision"
|
|
30
|
+
mmx brain review --review-token TOKEN --outcome no-changes --reason "No new durable knowledge"
|
|
31
|
+
mmx brain review --review-token TOKEN --outcome already-covered --id PAGE_ID --reason "The existing Page covers this decision"
|
|
32
|
+
mmx brain review --review-token TOKEN --outcome deferred --reason "The Brain service is unavailable"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Use the actual token provided by the current hook. `saved` requires a successful mutation executed with that token and matching read-back versions of all recorded resources. Reading an arbitrary existing Page does not qualify as a saved write. `already-covered` checks that the referenced Page is readable; the agent remains responsible for assessing its relevance. `deferred` records a retryable failure and does not authorize Stop as a completed review. Later token-bearing writes invalidate a registered review. Direct Cloud tool calls and writes without a token cannot supply verified-write evidence; use the CLI or `mindmux_brain` facade for this workflow.
|
|
36
|
+
|
|
37
|
+
The MCP equivalent uses `mindmux_brain` with `reviewToken` on mutations, followed by `operation: "review"`, `reviewToken`, `outcome`, `reason`, and `id` for `already-covered`. Review records are local metadata, never Brain Pages. Even a no-changes turn normally needs one local tool call. The review proves workflow completion, not that the agent's knowledge judgment is complete.
|
|
38
|
+
|
|
39
|
+
Review tokens expire after 24 hours and are invalidated when the active turn or binding changes, on interruption, and when Stop closes the turn. Exact completed-review retries are idempotent until the next turn or expiry. Missing session/turn identifiers disable enforcement with `review-unavailable` diagnostics rather than reusing a default session. Compaction restores the active token and registration state. Session locks serialize state updates and write verification; a busy or abandoned lock fails with a diagnostic rather than being removed while another process may be using it. After confirming a crashed process is gone, remove its `.mindmux/cli/reviews/*.lock` directory to retry. Review state is ignored by Git and removed by `mmx clean`.
|
|
40
|
+
|
|
41
|
+
Upgrade existing Codex installations with `mmx connect --agent codex` or `mmx doctor --fix`, restart Codex and review `/hooks`. The managed installation also handles interruption to invalidate the active review. Claude Code and Cursor retain their existing Stop behavior.
|
|
42
|
+
|
|
43
|
+
`doctor` checks files, executable paths, and recent hook receipts:
|
|
44
|
+
|
|
45
|
+
- `retrieved`: retrieval completed, awaiting delivery.
|
|
46
|
+
- `emitted`: context returned through the hook protocol; adoption by the model is not established.
|
|
47
|
+
- `review-requested`: one recovery requested for an unregistered Codex review, or the regular end-of-turn review for other agents.
|
|
48
|
+
- `review-registered` / `review-completed`: a local review was registered / accepted by Stop.
|
|
49
|
+
- `review-failed` / `recovery-exhausted`: review or persistence failed; one recovery could not complete it. No claim of saved memory is made.
|
|
50
|
+
- `review-unavailable` / `review-expired` / `review-aborted`: enforcement lacks a valid active turn, the token expired, or the turn was interrupted.
|
|
51
|
+
- `error` / `timeout`: a failure or the eight-second hook budget was exceeded. The task continues without switching Brains.
|
|
52
|
+
|
|
53
|
+
Retrieval starts with the Brain index: Page IDs, titles, summaries, categories, lifecycle states and tags, plus root-page navigation. The hook receives a bounded preview of complete index rows, with an explicit `brain index` instruction when rows are omitted; there is no fixed 20-page cutoff. Keyword retrieval supplements this directory with up to three active Page bodies and two core roots within an 8 KiB UTF-8 budget. A zero-length `pageIds` means no Page body was selected, not that the index is empty. The agent should read relevant Pages identified from the index even when keyword matching returns nothing. Local and Cloud full-text matches remain candidates even when their short summaries do not repeat the query. Vector retrieval and semantic reranking are not implemented.
|
|
54
|
+
|
|
55
|
+
`brain index` returns a current active-page navigation view as `body`, structured `pages`, `rootPages`, and `count`. Local reads report whether the actual `brain/index.md` file is present. That canonical brain.md file may contain explicitly labeled draft/archived entries; its raw contents are not exposed through the active index API or hooks. Local `brain reindex` uses brain.md's generator to rebuild that file. Page writes continue to maintain the local index through brain.md.
|
|
56
|
+
|
|
57
|
+
Cloud reads use `read_brain_index`; `reindex_brain` regenerates and persists a derived Markdown snapshot. Reads expose saved snapshot cursor/staleness metadata, never obsolete snapshot text. The main `body` is generated from current source Pages so a saved snapshot never overrides current truth. Indexes are generated documents: edit source Pages, then regenerate rather than supplying arbitrary index text. The Cloud service needs migration `0028_brain_indexes.sql` and the updated MCP server before the new Cloud index tools are available. For an older Cloud server without `read_brain_index`, the CLI builds the same navigation view from Cloud `list_pages` and `list_root_pages`, retaining summaries and marking `source: page-list-compatibility`. A failed supported index read is propagated; no local Brain fallback occurs.
|
|
58
|
+
|
|
59
|
+
Raw user prompts are not persisted. Session retrieval caches under `.mindmux/cli/sessions/` contain Brain content and are ignored by Git, with mode `0600`. Pending Cursor delivery expires after ten minutes; changing a binding invalidates reuse. Historical cache cleanup is manual.
|
|
60
|
+
|
|
61
|
+
Managed instruction blocks and hook registration are idempotent. Disconnect removes owned entries while preserving user content, Brain data, other hooks, and skills. Malformed configuration or markers cause an error rather than being overwritten. `doctor` reports recognized duplicate brain.md integrations; use the original installer to remove older hooks or global skills when replacing them.
|
package/docs/brain.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Brain and MCP commands
|
|
2
|
+
|
|
3
|
+
[Back to README](../README.md) · [Documentation](README.md)
|
|
4
|
+
|
|
5
|
+
Brain commands return JSON by default.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
mmx brain status
|
|
9
|
+
mmx brain index # Read the generated active-page index and root navigation.
|
|
10
|
+
mmx brain reindex # Rebuild the derived index; requires write access.
|
|
11
|
+
mmx brain list
|
|
12
|
+
mmx brain search 'authentication'
|
|
13
|
+
mmx brain recall 'implement authentication'
|
|
14
|
+
mmx brain read auth-pkce
|
|
15
|
+
|
|
16
|
+
cat decision.md | mmx brain create \
|
|
17
|
+
--id auth-pkce --title 'Use OAuth PKCE for authentication' \
|
|
18
|
+
--category decision --source 'Confirmed in the design review'
|
|
19
|
+
|
|
20
|
+
cat revised.md | mmx brain update auth-pkce \
|
|
21
|
+
--expected-version <version-from-read> \
|
|
22
|
+
--summary 'Restrict the callback to loopback' --source 'Design review'
|
|
23
|
+
|
|
24
|
+
mmx brain append auth-pkce --kind evidence --summary 'Interoperability verified' --source 'Test report'
|
|
25
|
+
mmx brain archive auth-pkce
|
|
26
|
+
mmx brain roots
|
|
27
|
+
mmx brain read-root architecture
|
|
28
|
+
cat architecture.md | mmx brain update-root architecture --expected-version <version-from-read>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Read the current version before updating. Local versions are file SHA-256 hashes; Cloud versions are positive server-side integers. Conflicts are not overwritten or retried automatically. For a new root, pass `--expected-version new`; existing roots require their current version.
|
|
32
|
+
|
|
33
|
+
Local creation reuses brain.md's `create-page` and `update-truth` steps. An interruption between them may leave an empty page; read it and complete it with `update`. Atomic truth/timeline updates are provided by brain.md. The CLI's local write lock coordinates only this CLI, not other programs invoking `brain` directly.
|
|
34
|
+
|
|
35
|
+
Choose local mode explicitly:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
mmx init --local
|
|
39
|
+
mmx brain bind --local
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Low-level MCP access
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
mmx mcp tools
|
|
46
|
+
mmx mcp call TOOL --args '{"key":"value"}'
|
|
47
|
+
mmx mcp serve
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
`mcp call` exposes the full Cloud MCP tool surface, including destructive tools. Supply all arguments, including the correct Brain ID: this low-level command does not inject the project binding. Use `brain` commands for ordinary operations against the selected Brain.
|
|
51
|
+
|
|
52
|
+
`mcp serve` is a stdio service launched by the host, with no network listener. It shares CLI authentication and refresh locks. In Cloud mode it proxies the account's tools and results. Tools that accept `brainId` are pinned to the project binding and reject a different ID. Account-level tools such as Workspace discovery and Project creation retain their original arguments and server-side permissions; project binding is not an account permission sandbox.
|
|
53
|
+
|
|
54
|
+
The additional `mindmux_brain` tool supports local and Cloud status, index, reindex, list, search, recall, read, create, update, append, archive, roots, read-root, update-root, and review operations. Bodies pass through stdin without shell interpolation. Cloud `isError`, content, and structured content are preserved. Restart the MCP service after changing a binding.
|
package/docs/cloud.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Cloud login and binding
|
|
2
|
+
|
|
3
|
+
[Back to README](../README.md) · [Documentation](README.md)
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
mmx login
|
|
7
|
+
mmx workspace list
|
|
8
|
+
mmx project list
|
|
9
|
+
mmx brain discover
|
|
10
|
+
|
|
11
|
+
mmx brain bind --brain-id <brain-id>
|
|
12
|
+
mmx connect --agent claude-code
|
|
13
|
+
mmx doctor --online
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
To create a Project explicitly:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
mmx project create --workspace-id <workspace-id> --name 'My Project' --confirm
|
|
20
|
+
mmx brain bind --brain-id <returned-brain-id>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
New Projects are visible to all Workspace members and require the server's owner/admin permissions. The CLI never infers a Workspace or Brain from the directory name. Binding is saved only after access is verified.
|
|
24
|
+
|
|
25
|
+
Login uses OAuth discovery, dynamic client registration, a loopback callback, state validation, and PKCE. The default server is `https://mcp.mindmux.ai/mcp`. `--server URL` accepts HTTPS or loopback HTTP for test deployments.
|
|
26
|
+
|
|
27
|
+
The CLI maintains its own credentials rather than reading agent credentials. Credentials are isolated by server and stored in `~/.mindmux-cli/auth/` with mode `0600`. Set `MINDMUX_HOME` to use another directory. System keychain integration is not implemented. Calls and refreshes use a process lock; writes are not automatically replayed. Normal exits and SIGINT/SIGTERM release locks. After SIGKILL, an error identifies the lock directory that needs inspection.
|
|
28
|
+
|
|
29
|
+
`mmx logout` removes this CLI's local credentials for the selected server. It does not revoke other clients' authorization. Binding uses `.mindmux/preferences.json`; unknown preference fields are preserved. Cloud failures never silently switch writes to a local Brain.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Development and verification
|
|
2
|
+
|
|
3
|
+
[Back to README](../README.md) · [Documentation](README.md)
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm ci
|
|
7
|
+
npm run check
|
|
8
|
+
npm run demo
|
|
9
|
+
npm pack --dry-run
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
The automated suite uses temporary projects, real MCP SDK transports, and a mock OAuth server. It covers local lifecycle operations, optimistic concurrency, binding isolation, setup rollback, configuration preservation, hook schemas, caching, PKCE, process interruption, and the `mmx` compatibility entry point. Chinese fixture text intentionally tests multilingual retrieval and byte preservation.
|
|
13
|
+
|
|
14
|
+
The local demo writes `.demo/report.md` and `.demo/latest.json`. It simulates hook delivery without production access or launching an agent model.
|
|
15
|
+
|
|
16
|
+
An opt-in integration script is available after login:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
node scripts/verify-live.mjs --workspace-id <workspace-id> --confirm --output artifacts/live-run
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
This script writes to a dedicated test Project in the explicitly selected Workspace. It reuses a saved manifest, creates fresh test pages on each run, exercises Cloud operations and installed hook commands, and preserves reports and project data. A disposable page is deleted as part of the test. It does not launch a real agent model and never runs under `npm test`.
|
|
23
|
+
|
|
24
|
+
Production test reports, credentials, local project configuration, demo output, and generated artifacts are excluded from this repository. Hook protocol tests do not establish model adoption; assess that separately with actual agent sessions. Cursor model sessions and additional provider configurations remain future validation work.
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Installation
|
|
2
|
+
|
|
3
|
+
[Back to README](../README.md) · [Documentation](README.md)
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
- Node.js 22 or later.
|
|
8
|
+
- macOS or Linux. Generated hook commands use POSIX shell quoting; native Windows shells are not supported yet.
|
|
9
|
+
- A supported agent installed locally. Unified setup supports Claude Code and Codex. Cursor integration is available separately through `connect`.
|
|
10
|
+
|
|
11
|
+
## Install from npm
|
|
12
|
+
|
|
13
|
+
Install the published package globally to make `mmx` available in your terminal:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install -g @mindmux/cli
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Or with pnpm:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pnpm add -g @mindmux/cli
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
If pnpm reports a missing global bin directory, run `pnpm setup`, reopen your terminal, and retry.
|
|
26
|
+
|
|
27
|
+
If a registry mirror returns 404 for a newly published version, retry against the official npm registry:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install -g @mindmux/cli --registry=https://registry.npmjs.org
|
|
31
|
+
# Or:
|
|
32
|
+
pnpm add -g @mindmux/cli --registry=https://registry.npmjs.org
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Then run setup inside the project you want to connect:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
cd /path/to/your/project
|
|
39
|
+
mmx setup
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
`npm install @mindmux/cli` without `-g` installs a project dependency; it does not add a global `mmx` command. For the standard CLI workflow, use the global installation above.
|
|
43
|
+
|
|
44
|
+
## Update
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npm install -g @mindmux/cli@latest
|
|
48
|
+
# Or:
|
|
49
|
+
pnpm add -g @mindmux/cli@latest
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Rerun `mmx setup` in each connected project to refresh managed paths and integrations, then restart the agent and review any new trust prompts.
|
|
53
|
+
|
|
54
|
+
## Install from source
|
|
55
|
+
|
|
56
|
+
Source installation is available for development or testing unpublished changes. It is not required to use the CLI.
|
|
57
|
+
|
|
58
|
+
Use Node.js 22 or later. With pnpm:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
git clone https://github.com/mindmuxai/mindmux-cli.git
|
|
62
|
+
cd mindmux-cli
|
|
63
|
+
pnpm install
|
|
64
|
+
pnpm add -g "$PWD"
|
|
65
|
+
|
|
66
|
+
cd /path/to/your/project
|
|
67
|
+
mmx setup
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
If pnpm reports that its global bin directory is missing, run `pnpm setup`, reopen your terminal, and retry `pnpm add -g "$PWD"`. Keep the source directory available for the installed command.
|
|
71
|
+
|
|
72
|
+
With npm:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
git clone https://github.com/mindmuxai/mindmux-cli.git
|
|
76
|
+
cd mindmux-cli
|
|
77
|
+
npm ci
|
|
78
|
+
npm install -g .
|
|
79
|
+
|
|
80
|
+
cd /path/to/your/project
|
|
81
|
+
mmx setup
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
`npm ci` installs dependencies but does not install the global command. Keep the CLI installation and Node executable available: generated integrations use absolute paths. After moving the CLI, moving a project, or changing Node, rerun `mmx setup` to refresh those paths. Set up each new worktree separately.
|
|
85
|
+
|
|
86
|
+
The old `bin/mindmux.mjs` script remains as a compatibility entry point for existing integrations. New installations use `bin/mmx.mjs`.
|