lbrain-coding-agents 0.1.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 (28) hide show
  1. lbrain_coding_agents-0.1.0/LICENSE +28 -0
  2. lbrain_coding_agents-0.1.0/PKG-INFO +103 -0
  3. lbrain_coding_agents-0.1.0/README.md +86 -0
  4. lbrain_coding_agents-0.1.0/lbrain_agents/__init__.py +3 -0
  5. lbrain_coding_agents-0.1.0/lbrain_agents/__main__.py +4 -0
  6. lbrain_coding_agents-0.1.0/lbrain_agents/cli.py +158 -0
  7. lbrain_coding_agents-0.1.0/lbrain_agents/installer.py +514 -0
  8. lbrain_coding_agents-0.1.0/lbrain_agents/share/agent-plugin/mcp.json +9 -0
  9. lbrain_coding_agents-0.1.0/lbrain_agents/share/agent-plugin/plugin.json +10 -0
  10. lbrain_coding_agents-0.1.0/lbrain_agents/share/agent-plugin/skills/lbrain-memory/SKILL.md +27 -0
  11. lbrain_coding_agents-0.1.0/lbrain_agents/share/cookbooks/01-abstain.md +50 -0
  12. lbrain_coding_agents-0.1.0/lbrain_agents/share/cookbooks/02-superseded.md +26 -0
  13. lbrain_coding_agents-0.1.0/lbrain_agents/share/cookbooks/03-model-swap.md +30 -0
  14. lbrain_coding_agents-0.1.0/lbrain_agents/share/cookbooks/toy-lair/deploy-runbook-2025-09-14.md +9 -0
  15. lbrain_coding_agents-0.1.0/lbrain_agents/share/cookbooks/toy-lair/deploy-runbook-2026-03-02.md +12 -0
  16. lbrain_coding_agents-0.1.0/lbrain_agents/share/cookbooks/toy-lair/metrics-exporter-2026-01-10.md +12 -0
  17. lbrain_coding_agents-0.1.0/lbrain_agents/share/docs/openclaw.md +26 -0
  18. lbrain_coding_agents-0.1.0/lbrain_agents/share/hooks/session-start.sh +13 -0
  19. lbrain_coding_agents-0.1.0/lbrain_agents/share/skills/lbrain-memory/SKILL.md +49 -0
  20. lbrain_coding_agents-0.1.0/lbrain_agents/wrap.py +114 -0
  21. lbrain_coding_agents-0.1.0/lbrain_coding_agents.egg-info/PKG-INFO +103 -0
  22. lbrain_coding_agents-0.1.0/lbrain_coding_agents.egg-info/SOURCES.txt +26 -0
  23. lbrain_coding_agents-0.1.0/lbrain_coding_agents.egg-info/dependency_links.txt +1 -0
  24. lbrain_coding_agents-0.1.0/lbrain_coding_agents.egg-info/entry_points.txt +2 -0
  25. lbrain_coding_agents-0.1.0/lbrain_coding_agents.egg-info/top_level.txt +1 -0
  26. lbrain_coding_agents-0.1.0/pyproject.toml +35 -0
  27. lbrain_coding_agents-0.1.0/setup.cfg +4 -0
  28. lbrain_coding_agents-0.1.0/tests/test_installer.py +92 -0
@@ -0,0 +1,28 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2026, Metavolve Labs, Inc.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,103 @@
1
+ Metadata-Version: 2.4
2
+ Name: lbrain-coding-agents
3
+ Version: 0.1.0
4
+ Summary: Install LBrain into coding agents: native MCP, companion skill, fail-closed session start.
5
+ Author: Metavolve Labs, Inc.
6
+ License: BSD-3-Clause
7
+ Project-URL: Homepage, https://lbrain.ai
8
+ Project-URL: Source, https://github.com/metavolve-labs/lbrain-coding-agents
9
+ Project-URL: Issues, https://github.com/metavolve-labs/lbrain-coding-agents/issues
10
+ Keywords: lbrain,mcp,agent-memory,claude-code,codex,grok
11
+ Classifier: License :: OSI Approved :: BSD License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Requires-Python: >=3.10
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Dynamic: license-file
17
+
18
+ # LBrain coding-agents
19
+
20
+ Install LBrain where the agent already lives.
21
+
22
+ Native MCP + companion skill + fail-closed session-start for Claude Code, Codex, Cursor, Copilot, Grok Build, Gemini CLI, Antigravity, and OpenClaw.
23
+
24
+ This package does **not** modify the LBrain engine. It wires hosts to `lbrain mcp`.
25
+
26
+ ## Install the engine first
27
+
28
+ ```bash
29
+ pip install "lbrain[local]"
30
+ lbrain init --source ~/notes
31
+ lbrain import && lbrain embed --stale
32
+ ```
33
+
34
+ ## Wire your coding agents
35
+
36
+ ```bash
37
+ pip install lbrain-coding-agents
38
+ python3 -m lbrain_agents status
39
+ python3 -m lbrain_agents install # lists detections, changes nothing
40
+ python3 -m lbrain_agents install all # every detected harness
41
+ python3 -m lbrain_agents install claude-code grok-build
42
+ python3 -m lbrain_agents install all --dry-run
43
+ ```
44
+
45
+ A bare `install` is a no-op. That is deliberate: wiring every agent on the machine never happens by accident.
46
+
47
+ ## Paste to a desktop AI (no terminal)
48
+
49
+ Some people never open a shell. They paste this into Claude, Cursor, Codex, Copilot, or Grok and the agent does the work:
50
+
51
+ ```
52
+ Install LBrain as my local memory.
53
+
54
+ pip install "lbrain[local]" lbrain-coding-agents
55
+ If python3 -m lbrain_agents works here, run: python3 -m lbrain_agents install all
56
+ Otherwise add an MCP server named lbrain: command lbrain, args ["mcp"], stdio.
57
+
58
+ Then call whoami. Prefer binds. Near-miss is not an answer. Abstain if nothing binds. SUPERSEDED must not govern. Leave LBRAIN_HOME alone if it is already set.
59
+
60
+ https://lbrain.ai/integrations.html
61
+ ```
62
+
63
+ Existing `lbrain` MCP entries are left untouched unless you pass `--force`. Skills are copied to each host's skills directory. Session-start injects `lbrain whoami` (Claude Code).
64
+
65
+ ## Two-line wrap
66
+
67
+ ```python
68
+ from openai import OpenAI
69
+ from lbrain_agents.wrap import wrap_openai
70
+
71
+ client = wrap_openai(OpenAI(), home="~/.lbrain")
72
+ ```
73
+
74
+ Recall first. If nothing binds, the model is told to abstain. Writes are opt-in (`remember=True`).
75
+
76
+ ## Agent Plugin
77
+
78
+ `lbrain_agents/share/agent-plugin/` is a portable bundle (`plugin.json` + `mcp.json` + skill) for hosts that speak the Agent Plugins spec.
79
+
80
+ ## Cookbooks
81
+
82
+ 1. Abstain when the record does not bind
83
+ 2. SUPERSEDED does not govern
84
+ 3. Model swap, same mind
85
+
86
+ See `lbrain_agents/share/cookbooks/`.
87
+
88
+ ## Safety
89
+
90
+ - Merges only the `lbrain` key. Other MCP servers stay.
91
+ - Backs up a config once as `*.lbrain-backup` before the first write.
92
+ - Does not set `LBRAIN_HOME` unless you pass `--home`. A working seat mount is not overwritten.
93
+ - HTTP MCP is **not** enabled by this installer. stdio only. The engine's HTTP transport has no auth; do not bind it to the world.
94
+
95
+ ## What this package is not
96
+
97
+ This is the free installer and the serve-boundary skill. It is not LBrain Connect, Managed LBrain, or LBrain Govern. It does not issue `gcx://` names, inscribe permanence, or ship study gold sets. The engine's resolver client is open; registrar issuance is not in this tree.
98
+
99
+ ## License
100
+
101
+ BSD-3-Clause. Metavolve Labs, Inc.
102
+
103
+ Patents pending. The licence covers the code; it does not grant patent rights.
@@ -0,0 +1,86 @@
1
+ # LBrain coding-agents
2
+
3
+ Install LBrain where the agent already lives.
4
+
5
+ Native MCP + companion skill + fail-closed session-start for Claude Code, Codex, Cursor, Copilot, Grok Build, Gemini CLI, Antigravity, and OpenClaw.
6
+
7
+ This package does **not** modify the LBrain engine. It wires hosts to `lbrain mcp`.
8
+
9
+ ## Install the engine first
10
+
11
+ ```bash
12
+ pip install "lbrain[local]"
13
+ lbrain init --source ~/notes
14
+ lbrain import && lbrain embed --stale
15
+ ```
16
+
17
+ ## Wire your coding agents
18
+
19
+ ```bash
20
+ pip install lbrain-coding-agents
21
+ python3 -m lbrain_agents status
22
+ python3 -m lbrain_agents install # lists detections, changes nothing
23
+ python3 -m lbrain_agents install all # every detected harness
24
+ python3 -m lbrain_agents install claude-code grok-build
25
+ python3 -m lbrain_agents install all --dry-run
26
+ ```
27
+
28
+ A bare `install` is a no-op. That is deliberate: wiring every agent on the machine never happens by accident.
29
+
30
+ ## Paste to a desktop AI (no terminal)
31
+
32
+ Some people never open a shell. They paste this into Claude, Cursor, Codex, Copilot, or Grok and the agent does the work:
33
+
34
+ ```
35
+ Install LBrain as my local memory.
36
+
37
+ pip install "lbrain[local]" lbrain-coding-agents
38
+ If python3 -m lbrain_agents works here, run: python3 -m lbrain_agents install all
39
+ Otherwise add an MCP server named lbrain: command lbrain, args ["mcp"], stdio.
40
+
41
+ Then call whoami. Prefer binds. Near-miss is not an answer. Abstain if nothing binds. SUPERSEDED must not govern. Leave LBRAIN_HOME alone if it is already set.
42
+
43
+ https://lbrain.ai/integrations.html
44
+ ```
45
+
46
+ Existing `lbrain` MCP entries are left untouched unless you pass `--force`. Skills are copied to each host's skills directory. Session-start injects `lbrain whoami` (Claude Code).
47
+
48
+ ## Two-line wrap
49
+
50
+ ```python
51
+ from openai import OpenAI
52
+ from lbrain_agents.wrap import wrap_openai
53
+
54
+ client = wrap_openai(OpenAI(), home="~/.lbrain")
55
+ ```
56
+
57
+ Recall first. If nothing binds, the model is told to abstain. Writes are opt-in (`remember=True`).
58
+
59
+ ## Agent Plugin
60
+
61
+ `lbrain_agents/share/agent-plugin/` is a portable bundle (`plugin.json` + `mcp.json` + skill) for hosts that speak the Agent Plugins spec.
62
+
63
+ ## Cookbooks
64
+
65
+ 1. Abstain when the record does not bind
66
+ 2. SUPERSEDED does not govern
67
+ 3. Model swap, same mind
68
+
69
+ See `lbrain_agents/share/cookbooks/`.
70
+
71
+ ## Safety
72
+
73
+ - Merges only the `lbrain` key. Other MCP servers stay.
74
+ - Backs up a config once as `*.lbrain-backup` before the first write.
75
+ - Does not set `LBRAIN_HOME` unless you pass `--home`. A working seat mount is not overwritten.
76
+ - HTTP MCP is **not** enabled by this installer. stdio only. The engine's HTTP transport has no auth; do not bind it to the world.
77
+
78
+ ## What this package is not
79
+
80
+ This is the free installer and the serve-boundary skill. It is not LBrain Connect, Managed LBrain, or LBrain Govern. It does not issue `gcx://` names, inscribe permanence, or ship study gold sets. The engine's resolver client is open; registrar issuance is not in this tree.
81
+
82
+ ## License
83
+
84
+ BSD-3-Clause. Metavolve Labs, Inc.
85
+
86
+ Patents pending. The licence covers the code; it does not grant patent rights.
@@ -0,0 +1,3 @@
1
+ """LBrain coding-agent installer. Does not import the LBrain engine."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,4 @@
1
+ from lbrain_agents.cli import main
2
+
3
+ if __name__ == "__main__":
4
+ raise SystemExit(main())
@@ -0,0 +1,158 @@
1
+ """CLI: lbrain-agents install|uninstall|status|wrap-help"""
2
+
3
+ from __future__ import annotations
4
+
5
+ import argparse
6
+ import sys
7
+ from typing import List, Optional
8
+
9
+ from lbrain_agents.installer import (
10
+ ALL_HARNESSES,
11
+ Action,
12
+ detected_harnesses,
13
+ install,
14
+ resolve_lbrain_bin,
15
+ runtime_dir,
16
+ )
17
+
18
+
19
+ def _print_actions(actions: List[Action]) -> int:
20
+ width = max((len(a.harness) for a in actions), default=8)
21
+ changed = 0
22
+ for a in actions:
23
+ mark = "CHANGE" if a.changed else "ok "
24
+ if a.kind == "error":
25
+ mark = "ERROR "
26
+ print(f" {mark} {a.harness.ljust(width)} {a.kind:6} {a.detail}")
27
+ if a.changed:
28
+ changed += 1
29
+ if a.kind == "error":
30
+ return 2
31
+ print(f"\n{changed} change(s). Runtime: {runtime_dir()}")
32
+ return 0
33
+
34
+
35
+ def cmd_status(_: argparse.Namespace) -> int:
36
+ binary = resolve_lbrain_bin()
37
+ missing = "NOT ON PATH (pip install lbrain[local])"
38
+ print("lbrain binary: " + (binary or missing))
39
+ print(f"runtime dir: {runtime_dir()}")
40
+ print("harnesses:")
41
+ present = detected_harnesses()
42
+ for name in ALL_HARNESSES:
43
+ print(f" {'yes' if present[name] else 'no ':3} {name}")
44
+ return 0 if binary else 1
45
+
46
+
47
+ def cmd_install(args: argparse.Namespace) -> int:
48
+ targets = list(args.harness or [])
49
+ if not targets:
50
+ print("No harness named. Detected on this machine:\n")
51
+ present = detected_harnesses()
52
+ for name in ALL_HARNESSES:
53
+ flag = "detected" if present[name] else "absent "
54
+ print(f" {flag} {name}")
55
+ print("\nInstall with: lbrain-agents install all")
56
+ print(" or: lbrain-agents install claude-code grok-build")
57
+ print("A bare install changes nothing.")
58
+ return 0
59
+ if targets == ["all"]:
60
+ targets = list(ALL_HARNESSES)
61
+ unknown = [t for t in targets if t not in ALL_HARNESSES]
62
+ if unknown:
63
+ print("Unknown harness:", ", ".join(unknown), file=sys.stderr)
64
+ print("Known:", ", ".join(ALL_HARNESSES), file=sys.stderr)
65
+ return 2
66
+ if not resolve_lbrain_bin():
67
+ print(
68
+ 'lbrain is not on PATH. Install the engine first:\n pip install "lbrain[local]"',
69
+ file=sys.stderr,
70
+ )
71
+ return 1
72
+ print("LBrain coding-agents" + (" (dry-run)" if args.dry_run else ""))
73
+ actions = install(
74
+ targets,
75
+ home=args.home,
76
+ persona=args.persona,
77
+ dry_run=args.dry_run,
78
+ force=args.force,
79
+ detected_only=not args.force_absent,
80
+ )
81
+ return _print_actions(actions)
82
+
83
+
84
+ def cmd_uninstall(args: argparse.Namespace) -> int:
85
+ print("Uninstall removes MCP entries named 'lbrain' that this installer wrote.")
86
+ print("It does not delete your brain (~/.lbrain or LBRAIN_HOME).")
87
+ print("Manual for now: restore *.lbrain-backup next to each config,")
88
+ print("or delete the lbrain key from mcpServers / [mcp_servers.lbrain].")
89
+ print(f"Staged runtime (safe to delete): {runtime_dir()}")
90
+ if args.harness:
91
+ print("Targeted uninstall of named harnesses is not implemented in 0.1.0.")
92
+ return 0
93
+
94
+
95
+ def cmd_wrap_help(_: argparse.Namespace) -> int:
96
+ print(
97
+ """Two-line wrap (OpenAI-compatible client):
98
+
99
+ from openai import OpenAI
100
+ from lbrain_agents.wrap import wrap_openai
101
+
102
+ client = wrap_openai(OpenAI(), home="~/.lbrain")
103
+ # Every chat.completions.create recalls LBrain first.
104
+ # If nothing binds, the model is told to abstain.
105
+
106
+ Requires `lbrain` on PATH. Does not write memory unless remember=True.
107
+ """
108
+ )
109
+ return 0
110
+
111
+
112
+ def build_parser() -> argparse.ArgumentParser:
113
+ p = argparse.ArgumentParser(
114
+ prog="lbrain-agents",
115
+ description="Install LBrain into coding agents (MCP + skill + session-start).",
116
+ )
117
+ sub = p.add_subparsers(dest="cmd", required=True)
118
+
119
+ st = sub.add_parser("status", help="Show detected harnesses and lbrain binary")
120
+ st.set_defaults(func=cmd_status)
121
+
122
+ ins = sub.add_parser("install", help="Wire LBrain into one or more harnesses")
123
+ ins.add_argument(
124
+ "harness",
125
+ nargs="*",
126
+ help="Harness names, or 'all'. Omit to list detections and do nothing.",
127
+ )
128
+ ins.add_argument("--home", help="LBRAIN_HOME to export into MCP env")
129
+ ins.add_argument("--persona", help="LBRAIN_PERSONA to export into MCP env")
130
+ ins.add_argument("--dry-run", action="store_true")
131
+ ins.add_argument(
132
+ "--force",
133
+ action="store_true",
134
+ help="Overwrite an existing lbrain MCP entry (does not overwrite other servers).",
135
+ )
136
+ ins.add_argument(
137
+ "--force-absent",
138
+ action="store_true",
139
+ help="Install even if the harness is not detected.",
140
+ )
141
+ ins.set_defaults(func=cmd_install)
142
+
143
+ un = sub.add_parser("uninstall", help="How to remove installer wiring")
144
+ un.add_argument("harness", nargs="*")
145
+ un.set_defaults(func=cmd_uninstall)
146
+
147
+ wh = sub.add_parser("wrap-help", help="Show the two-line OpenAI wrap")
148
+ wh.set_defaults(func=cmd_wrap_help)
149
+ return p
150
+
151
+
152
+ def main(argv: Optional[List[str]] = None) -> int:
153
+ args = build_parser().parse_args(argv)
154
+ return int(args.func(args))
155
+
156
+
157
+ if __name__ == "__main__":
158
+ raise SystemExit(main())