horus-harness 0.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.
@@ -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 2026 Rafael M. J. Figueiredo
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.
@@ -0,0 +1,5 @@
1
+ Horus (horus-harness)
2
+ Copyright 2026 Rafael M. J. Figueiredo
3
+
4
+ This product is licensed under the Apache License, Version 2.0.
5
+ See the LICENSE file for the full license text.
@@ -0,0 +1,83 @@
1
+ Metadata-Version: 2.4
2
+ Name: horus-harness
3
+ Version: 0.0.1
4
+ Summary: Project-centric continuity and control panel for official coding-agent CLIs
5
+ Author: Rafael M. J. Figueiredo
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/rafaelmjf/horus-harness
8
+ Project-URL: Repository, https://github.com/rafaelmjf/horus-harness
9
+ Project-URL: Issues, https://github.com/rafaelmjf/horus-harness/issues
10
+ Keywords: claude-code,codex,coding-agents,continuity,cli,dashboard
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Software Development
20
+ Classifier: Topic :: Utilities
21
+ Requires-Python: >=3.11
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ License-File: NOTICE
25
+ Dynamic: license-file
26
+
27
+ # Horus
28
+
29
+ > Project-centric continuity and control panel for official coding-agent CLIs.
30
+
31
+ Horus keeps a project understandable over time — across agents (Claude Code, Codex),
32
+ accounts, environments, and days. It does not reimplement an agent loop and does not
33
+ use model API keys; it wraps the official CLIs and keeps durable project state in
34
+ repo-local `.horus/` files that native tools can read even when Horus is not running.
35
+
36
+ **Status:** early (alpha). MVP0/MVP1 shipped: continuity scaffolding, health checks,
37
+ a read-only dashboard, session/closure commands, and instruction-block sync. Agent
38
+ execution is intentionally deferred.
39
+
40
+ ## Install
41
+
42
+ With [uv](https://docs.astral.sh/uv/):
43
+
44
+ ```sh
45
+ uv tool install horus-harness # installs the `horus` command
46
+ # or run without installing:
47
+ uvx --from horus-harness horus --help
48
+ ```
49
+
50
+ With pip:
51
+
52
+ ```sh
53
+ pip install horus-harness
54
+ ```
55
+
56
+ ## Commands
57
+
58
+ ```sh
59
+ horus init [path] # scaffold .horus/ + managed AGENTS.md/CLAUDE.md blocks
60
+ horus doctor [project|instructions|all] # continuity + instruction-drift health checks
61
+ horus dashboard # local, read-only multi-project web view (127.0.0.1:8765)
62
+ horus session new "<title>" # create a dated session summary from the template
63
+ horus close # verify continuity and print the closure ritual
64
+ horus reconcile instructions # deterministic AGENTS.md <-> CLAUDE.md managed-block sync
65
+ horus forget <path> | horus prune # manage the dashboard's project registry
66
+ ```
67
+
68
+ ## Repo-local continuity
69
+
70
+ ```text
71
+ .horus/
72
+ project.md # purpose, current focus, shape (committed)
73
+ roadmap.md # roadmap + current focus (committed)
74
+ decisions.md # durable decisions + reasoning (committed)
75
+ sessions/ # local session summaries (gitignored by default)
76
+ ```
77
+
78
+ `AGENTS.md` and `CLAUDE.md` stay native; Horus only syncs the marked
79
+ `<!-- HORUS:BEGIN shared-instructions -->` block and detects drift elsewhere.
80
+
81
+ ## License
82
+
83
+ Apache-2.0
@@ -0,0 +1,57 @@
1
+ # Horus
2
+
3
+ > Project-centric continuity and control panel for official coding-agent CLIs.
4
+
5
+ Horus keeps a project understandable over time — across agents (Claude Code, Codex),
6
+ accounts, environments, and days. It does not reimplement an agent loop and does not
7
+ use model API keys; it wraps the official CLIs and keeps durable project state in
8
+ repo-local `.horus/` files that native tools can read even when Horus is not running.
9
+
10
+ **Status:** early (alpha). MVP0/MVP1 shipped: continuity scaffolding, health checks,
11
+ a read-only dashboard, session/closure commands, and instruction-block sync. Agent
12
+ execution is intentionally deferred.
13
+
14
+ ## Install
15
+
16
+ With [uv](https://docs.astral.sh/uv/):
17
+
18
+ ```sh
19
+ uv tool install horus-harness # installs the `horus` command
20
+ # or run without installing:
21
+ uvx --from horus-harness horus --help
22
+ ```
23
+
24
+ With pip:
25
+
26
+ ```sh
27
+ pip install horus-harness
28
+ ```
29
+
30
+ ## Commands
31
+
32
+ ```sh
33
+ horus init [path] # scaffold .horus/ + managed AGENTS.md/CLAUDE.md blocks
34
+ horus doctor [project|instructions|all] # continuity + instruction-drift health checks
35
+ horus dashboard # local, read-only multi-project web view (127.0.0.1:8765)
36
+ horus session new "<title>" # create a dated session summary from the template
37
+ horus close # verify continuity and print the closure ritual
38
+ horus reconcile instructions # deterministic AGENTS.md <-> CLAUDE.md managed-block sync
39
+ horus forget <path> | horus prune # manage the dashboard's project registry
40
+ ```
41
+
42
+ ## Repo-local continuity
43
+
44
+ ```text
45
+ .horus/
46
+ project.md # purpose, current focus, shape (committed)
47
+ roadmap.md # roadmap + current focus (committed)
48
+ decisions.md # durable decisions + reasoning (committed)
49
+ sessions/ # local session summaries (gitignored by default)
50
+ ```
51
+
52
+ `AGENTS.md` and `CLAUDE.md` stay native; Horus only syncs the marked
53
+ `<!-- HORUS:BEGIN shared-instructions -->` block and detects drift elsewhere.
54
+
55
+ ## License
56
+
57
+ Apache-2.0
@@ -0,0 +1,3 @@
1
+ """Horus - project-centric continuity and control panel for official coding-agent CLIs."""
2
+
3
+ __version__ = "0.0.1"
@@ -0,0 +1,6 @@
1
+ """Enable `python -m horus`."""
2
+
3
+ from horus.cli import main
4
+
5
+ if __name__ == "__main__":
6
+ raise SystemExit(main())
@@ -0,0 +1,236 @@
1
+ """Horus command-line entry point."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import argparse
6
+ import re
7
+ from datetime import date
8
+ from pathlib import Path
9
+
10
+ from horus import __version__, config, dashboard, initialize, templates
11
+ from horus.continuity import HORUS_DIR, SESSIONS_DIR, check_project
12
+ from horus.instructions import check_drift, reconcile
13
+
14
+ _LEVEL_TAG = {"ok": "[ ok ]", "warn": "[warn]", "fail": "[fail]"}
15
+
16
+
17
+ def _print_findings(findings) -> bool:
18
+ """Print findings; return True if all good (no warn/fail)."""
19
+ healthy = True
20
+ for f in findings:
21
+ print(f" {_LEVEL_TAG.get(f.level, '[????]')} {f.message}")
22
+ if f.level in ("warn", "fail"):
23
+ healthy = False
24
+ return healthy
25
+
26
+
27
+ def cmd_init(args: argparse.Namespace) -> int:
28
+ root = Path(args.path).resolve()
29
+ print(f"Initializing Horus continuity in {root}")
30
+ actions = initialize.init_project(
31
+ root, assume_yes=args.yes, no_input=args.no_input
32
+ )
33
+ for a in actions:
34
+ print(f" [{a.status}] {a.message}")
35
+ skipped = [a for a in actions if a.status == "skipped"]
36
+ if skipped:
37
+ print(f"\n{len(skipped)} item(s) skipped. Rerun with --yes to apply.")
38
+ print("\nDone.")
39
+ return 0
40
+
41
+
42
+ def cmd_doctor(args: argparse.Namespace) -> int:
43
+ root = Path(args.path).resolve()
44
+ rc = 0
45
+
46
+ if args.target in ("project", "all"):
47
+ print(f"doctor project: {root}")
48
+ if not _print_findings(check_project(root)):
49
+ rc = 1
50
+ print()
51
+
52
+ if args.target in ("instructions", "all"):
53
+ print(f"doctor instructions: {root}")
54
+ agents, claude = root / "AGENTS.md", root / "CLAUDE.md"
55
+ if not agents.exists() or not claude.exists():
56
+ missing = [p.name for p in (agents, claude) if not p.exists()]
57
+ print(f" {_LEVEL_TAG['fail']} missing file(s): {', '.join(missing)}")
58
+ rc = 1
59
+ else:
60
+ report = check_drift(
61
+ agents.read_text(encoding="utf-8"), "AGENTS.md",
62
+ claude.read_text(encoding="utf-8"), "CLAUDE.md",
63
+ )
64
+ if report.status == "aligned":
65
+ print(f" {_LEVEL_TAG['ok']} {report.detail}")
66
+ elif report.status == "missing":
67
+ print(f" {_LEVEL_TAG['fail']} {report.detail}")
68
+ rc = 1
69
+ else:
70
+ print(f" {_LEVEL_TAG['warn']} managed blocks drifted:")
71
+ for line in report.detail.splitlines():
72
+ print(f" {line}")
73
+ rc = 1
74
+ print()
75
+
76
+ return rc
77
+
78
+
79
+ def cmd_dashboard(args: argparse.Namespace) -> int:
80
+ dashboard.serve(host=args.host, port=args.port)
81
+ return 0
82
+
83
+
84
+ def cmd_forget(args: argparse.Namespace) -> int:
85
+ root = Path(args.path).resolve()
86
+ if config.unregister_project(root):
87
+ print(f"Removed from registry: {root}")
88
+ return 0
89
+ print(f"Not in registry: {root}")
90
+ return 1
91
+
92
+
93
+ def cmd_prune(args: argparse.Namespace) -> int:
94
+ removed = config.prune_projects()
95
+ if not removed:
96
+ print("Nothing to prune; all registered projects still have a .horus/ directory.")
97
+ return 0
98
+ print(f"Pruned {len(removed)} stale project(s):")
99
+ for p in removed:
100
+ print(f" - {p}")
101
+ return 0
102
+
103
+
104
+ def _slugify(text: str) -> str:
105
+ slug = re.sub(r"[^a-z0-9]+", "-", text.lower()).strip("-")
106
+ return slug or "session"
107
+
108
+
109
+ def cmd_session(args: argparse.Namespace) -> int:
110
+ root = Path(args.path).resolve()
111
+ sessions = root / HORUS_DIR / SESSIONS_DIR
112
+ if not (root / HORUS_DIR).is_dir():
113
+ print(f"No {HORUS_DIR}/ here (run `horus init` first).")
114
+ return 1
115
+ sessions.mkdir(parents=True, exist_ok=True)
116
+
117
+ today = date.today().isoformat()
118
+ path = sessions / f"{today}-{_slugify(args.title)}.md"
119
+ if path.exists():
120
+ print(f"Already exists: {path}")
121
+ return 1
122
+ path.write_text(
123
+ templates.session_summary(
124
+ title=args.title,
125
+ date=today,
126
+ project=root.name,
127
+ agent=args.agent,
128
+ account=args.account,
129
+ environment=args.environment,
130
+ ),
131
+ encoding="utf-8",
132
+ )
133
+ print(f"Created {path}")
134
+ return 0
135
+
136
+
137
+ def cmd_close(args: argparse.Namespace) -> int:
138
+ root = Path(args.path).resolve()
139
+ print(f"Closure check: {root}")
140
+ healthy = _print_findings(check_project(root))
141
+ print("\n" + templates.CLOSURE_PROMPT)
142
+ return 0 if healthy else 1
143
+
144
+
145
+ def cmd_reconcile(args: argparse.Namespace) -> int:
146
+ root = Path(args.path).resolve()
147
+ agents, claude = root / "AGENTS.md", root / "CLAUDE.md"
148
+ if not agents.exists() or not claude.exists():
149
+ missing = [p.name for p in (agents, claude) if not p.exists()]
150
+ print(f"Cannot reconcile; missing file(s): {', '.join(missing)}")
151
+ return 1
152
+
153
+ if args.source == "claude":
154
+ src, src_name, tgt, tgt_name = claude, "CLAUDE.md", agents, "AGENTS.md"
155
+ else:
156
+ src, src_name, tgt, tgt_name = agents, "AGENTS.md", claude, "CLAUDE.md"
157
+
158
+ result = reconcile(
159
+ src.read_text(encoding="utf-8"), src_name,
160
+ tgt.read_text(encoding="utf-8"), tgt_name,
161
+ )
162
+ if result.status == "no-source-block":
163
+ print(f"{src_name} has no managed block to project from.")
164
+ return 1
165
+ if result.status == "already-aligned":
166
+ print(f"Already aligned: {tgt_name} matches {src_name}.")
167
+ return 0
168
+ tgt.write_text(result.new_target_text, encoding="utf-8")
169
+ print(f"Synced {src_name} -> {tgt_name}.")
170
+ return 0
171
+
172
+
173
+ def build_parser() -> argparse.ArgumentParser:
174
+ parser = argparse.ArgumentParser(prog="horus", description=__doc__)
175
+ parser.add_argument("--version", action="version", version=f"horus {__version__}")
176
+ sub = parser.add_subparsers(dest="command", required=True)
177
+
178
+ p_init = sub.add_parser("init", help="scaffold .horus/ and managed instruction blocks")
179
+ p_init.add_argument("path", nargs="?", default=".", help="project root (default: cwd)")
180
+ p_init.add_argument("--yes", "-y", action="store_true", help="auto-confirm block injection")
181
+ p_init.add_argument("--no-input", action="store_true", help="never prompt; skip injection")
182
+ p_init.set_defaults(func=cmd_init)
183
+
184
+ p_doctor = sub.add_parser("doctor", help="check continuity and instruction health")
185
+ p_doctor.add_argument(
186
+ "target",
187
+ nargs="?",
188
+ choices=("project", "instructions", "all"),
189
+ default="all",
190
+ help="what to check (default: all)",
191
+ )
192
+ p_doctor.add_argument("--path", default=".", help="project root (default: cwd)")
193
+ p_doctor.set_defaults(func=cmd_doctor)
194
+
195
+ p_dash = sub.add_parser("dashboard", help="serve the read-only multi-project dashboard")
196
+ p_dash.add_argument("--host", default="127.0.0.1", help="bind host (default: 127.0.0.1)")
197
+ p_dash.add_argument("--port", type=int, default=8765, help="bind port (default: 8765)")
198
+ p_dash.set_defaults(func=cmd_dashboard)
199
+
200
+ p_forget = sub.add_parser("forget", help="remove a project from the dashboard registry")
201
+ p_forget.add_argument("path", nargs="?", default=".", help="project root (default: cwd)")
202
+ p_forget.set_defaults(func=cmd_forget)
203
+
204
+ p_prune = sub.add_parser("prune", help="drop registered projects whose .horus/ is gone")
205
+ p_prune.set_defaults(func=cmd_prune)
206
+
207
+ p_session = sub.add_parser("session", help="create a new session summary from the template")
208
+ session_sub = p_session.add_subparsers(dest="session_cmd", required=True)
209
+ p_session_new = session_sub.add_parser("new", help="create a new session summary")
210
+ p_session_new.add_argument("title", help="short session title")
211
+ p_session_new.add_argument("--path", default=".", help="project root (default: cwd)")
212
+ p_session_new.add_argument("--agent", default="claude")
213
+ p_session_new.add_argument("--account", default="personal")
214
+ p_session_new.add_argument("--environment", default="host")
215
+ p_session_new.set_defaults(func=cmd_session)
216
+
217
+ p_close = sub.add_parser("close", help="verify continuity and print the closure ritual")
218
+ p_close.add_argument("--path", default=".", help="project root (default: cwd)")
219
+ p_close.set_defaults(func=cmd_close)
220
+
221
+ p_recon = sub.add_parser("reconcile", help="sync the managed instruction block across files")
222
+ p_recon.add_argument("target", nargs="?", choices=("instructions",), default="instructions")
223
+ p_recon.add_argument("--path", default=".", help="project root (default: cwd)")
224
+ p_recon.add_argument(
225
+ "--from", dest="source", choices=("agents", "claude"), default="agents",
226
+ help="canonical source file (default: agents)",
227
+ )
228
+ p_recon.set_defaults(func=cmd_reconcile)
229
+
230
+ return parser
231
+
232
+
233
+ def main(argv: list[str] | None = None) -> int:
234
+ parser = build_parser()
235
+ args = parser.parse_args(argv)
236
+ return args.func(args)
@@ -0,0 +1,80 @@
1
+ """User-level Horus config: the list of project paths the dashboard knows about.
2
+
3
+ Stored at ``~/.horus/config.toml``. Read with stdlib ``tomllib``; written with a
4
+ tiny hand-rolled serializer (paths only) to stay dependency-free. Paths are
5
+ stored with forward slashes so they need no TOML escaping and work on Windows.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ import tomllib
11
+ from pathlib import Path
12
+
13
+
14
+ def config_dir() -> Path:
15
+ return Path.home() / ".horus"
16
+
17
+
18
+ def config_path() -> Path:
19
+ return config_dir() / "config.toml"
20
+
21
+
22
+ def load_projects() -> list[str]:
23
+ path = config_path()
24
+ if not path.exists():
25
+ return []
26
+ data = tomllib.loads(path.read_text(encoding="utf-8"))
27
+ projects = data.get("projects", [])
28
+ if not isinstance(projects, list):
29
+ return []
30
+ return [str(p) for p in projects]
31
+
32
+
33
+ def _as_key(path: Path) -> str:
34
+ return path.resolve().as_posix()
35
+
36
+
37
+ def _write_projects(projects: list[str]) -> None:
38
+ config_dir().mkdir(parents=True, exist_ok=True)
39
+ lines = ["# Horus user config", "projects = ["]
40
+ lines += [f' "{p}",' for p in projects]
41
+ lines.append("]")
42
+ config_path().write_text("\n".join(lines) + "\n", encoding="utf-8")
43
+
44
+
45
+ def register_project(project_path: Path) -> bool:
46
+ """Add ``project_path`` to the user config. Returns True if newly added."""
47
+ key = _as_key(project_path)
48
+ existing = load_projects()
49
+ if key in existing:
50
+ return False
51
+ existing.append(key)
52
+ _write_projects(existing)
53
+ return True
54
+
55
+
56
+ def unregister_project(project_path: Path) -> bool:
57
+ """Remove ``project_path`` from the user config. Returns True if it was present."""
58
+ key = _as_key(project_path)
59
+ existing = load_projects()
60
+ if key not in existing:
61
+ return False
62
+ _write_projects([p for p in existing if p != key])
63
+ return True
64
+
65
+
66
+ def prune_projects() -> list[str]:
67
+ """Drop registered projects whose path is gone or lacks a `.horus/` dir.
68
+
69
+ Returns the list of removed paths.
70
+ """
71
+ existing = load_projects()
72
+ kept, removed = [], []
73
+ for p in existing:
74
+ if (Path(p) / ".horus").is_dir():
75
+ kept.append(p)
76
+ else:
77
+ removed.append(p)
78
+ if removed:
79
+ _write_projects(kept)
80
+ return removed