haiv-core 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 (63) hide show
  1. haiv_core-0.1.0/.gitignore +41 -0
  2. haiv_core-0.1.0/LICENSE +21 -0
  3. haiv_core-0.1.0/PKG-INFO +36 -0
  4. haiv_core-0.1.0/README.md +16 -0
  5. haiv_core-0.1.0/pyproject.toml +50 -0
  6. haiv_core-0.1.0/src/haiv_core/__assets__/init/.claude/.gitkeep.j2 +1 -0
  7. haiv_core-0.1.0/src/haiv_core/__assets__/init/.gitignore.j2 +41 -0
  8. haiv_core-0.1.0/src/haiv_core/__assets__/init/CLAUDE.md.j2 +121 -0
  9. haiv_core-0.1.0/src/haiv_core/__assets__/init/pyproject.toml.j2 +25 -0
  10. haiv_core-0.1.0/src/haiv_core/__assets__/init/src/haiv_project/__init__.py.j2 +2 -0
  11. haiv_core-0.1.0/src/haiv_core/__assets__/init/src/haiv_project/commands/__init__.py.j2 +5 -0
  12. haiv_core-0.1.0/src/haiv_core/__assets__/init/tests/__init__.py.j2 +2 -0
  13. haiv_core-0.1.0/src/haiv_core/__assets__/init/tests/test_example.py.j2 +22 -0
  14. haiv_core-0.1.0/src/haiv_core/__assets__/init/users/.gitkeep.j2 +1 -0
  15. haiv_core-0.1.0/src/haiv_core/__assets__/init/worktrees/.gitignore.j2 +3 -0
  16. haiv_core-0.1.0/src/haiv_core/__assets__/minds/references.toml.j2 +7 -0
  17. haiv_core-0.1.0/src/haiv_core/__assets__/minds/welcome.md.j2 +44 -0
  18. haiv_core-0.1.0/src/haiv_core/__assets__/pop/aar.md.j2 +52 -0
  19. haiv_core-0.1.0/src/haiv_core/__assets__/users/pyproject.toml.j2 +25 -0
  20. haiv_core-0.1.0/src/haiv_core/__assets__/users/src/haiv_user/__init__.py.j2 +2 -0
  21. haiv_core-0.1.0/src/haiv_core/__assets__/users/src/haiv_user/commands/__init__.py.j2 +2 -0
  22. haiv_core-0.1.0/src/haiv_core/__assets__/users/state/.gitkeep.j2 +1 -0
  23. haiv_core-0.1.0/src/haiv_core/__init__.py +3 -0
  24. haiv_core-0.1.0/src/haiv_core/commands/__init__.py +1 -0
  25. haiv_core-0.1.0/src/haiv_core/commands/become/__init__.py +1 -0
  26. haiv_core-0.1.0/src/haiv_core/commands/become/_mind_.py +64 -0
  27. haiv_core-0.1.0/src/haiv_core/commands/help.py +128 -0
  28. haiv_core-0.1.0/src/haiv_core/commands/init.py +338 -0
  29. haiv_core-0.1.0/src/haiv_core/commands/minds/__init__.py +1 -0
  30. haiv_core-0.1.0/src/haiv_core/commands/minds/_mind_/__init__.py +0 -0
  31. haiv_core-0.1.0/src/haiv_core/commands/minds/_mind_/prompt.py +44 -0
  32. haiv_core-0.1.0/src/haiv_core/commands/minds/stage.py +237 -0
  33. haiv_core-0.1.0/src/haiv_core/commands/mine.py +49 -0
  34. haiv_core-0.1.0/src/haiv_core/commands/pop.py +171 -0
  35. haiv_core-0.1.0/src/haiv_core/commands/sessions/__init__.py +6 -0
  36. haiv_core-0.1.0/src/haiv_core/commands/sessions/_index_.py +47 -0
  37. haiv_core-0.1.0/src/haiv_core/commands/sessions/_session_/__init__.py +5 -0
  38. haiv_core-0.1.0/src/haiv_core/commands/sessions/_session_/remove.py +25 -0
  39. haiv_core-0.1.0/src/haiv_core/commands/start/__init__.py +1 -0
  40. haiv_core-0.1.0/src/haiv_core/commands/start/_index_.py +13 -0
  41. haiv_core-0.1.0/src/haiv_core/commands/start/_mind_.py +53 -0
  42. haiv_core-0.1.0/src/haiv_core/commands/test_cmd.py +11 -0
  43. haiv_core-0.1.0/src/haiv_core/commands/tui/__init__.py +0 -0
  44. haiv_core-0.1.0/src/haiv_core/commands/tui/debug.py +44 -0
  45. haiv_core-0.1.0/src/haiv_core/commands/users/__init__.py +1 -0
  46. haiv_core-0.1.0/src/haiv_core/commands/users/new.py +154 -0
  47. haiv_core-0.1.0/src/haiv_core/haiv_hook_points.py +83 -0
  48. haiv_core-0.1.0/src/haiv_core/py.typed +0 -0
  49. haiv_core-0.1.0/src/haiv_core/resolvers/mind.py +38 -0
  50. haiv_core-0.1.0/src/haiv_core/resolvers/session.py +35 -0
  51. haiv_core-0.1.0/tests/test_become.py +222 -0
  52. haiv_core-0.1.0/tests/test_help.py +103 -0
  53. haiv_core-0.1.0/tests/test_imports.py +15 -0
  54. haiv_core-0.1.0/tests/test_init.py +488 -0
  55. haiv_core-0.1.0/tests/test_init_unit.py +77 -0
  56. haiv_core-0.1.0/tests/test_minds_stage.py +577 -0
  57. haiv_core-0.1.0/tests/test_mine.py +86 -0
  58. haiv_core-0.1.0/tests/test_pop.py +331 -0
  59. haiv_core-0.1.0/tests/test_sessions.py +165 -0
  60. haiv_core-0.1.0/tests/test_start.py +40 -0
  61. haiv_core-0.1.0/tests/test_start_mind.py +149 -0
  62. haiv_core-0.1.0/tests/test_users_new.py +183 -0
  63. haiv_core-0.1.0/tests/test_users_new_unit.py +73 -0
@@ -0,0 +1,41 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ *.egg-info/
20
+ .installed.cfg
21
+ *.egg
22
+
23
+ # Virtual environments
24
+ .venv/
25
+ venv/
26
+ ENV/
27
+
28
+ # Testing
29
+ .pytest_cache/
30
+ .coverage
31
+ htmlcov/
32
+
33
+ # IDE
34
+ .idea/
35
+ .vscode/
36
+ *.swp
37
+ *.swo
38
+
39
+ # OS
40
+ .DS_Store
41
+ Thumbs.db
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Casey Marquis
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,36 @@
1
+ Metadata-Version: 2.4
2
+ Name: haiv-core
3
+ Version: 0.1.0
4
+ Summary: Core commands for haiv
5
+ Project-URL: Homepage, https://github.com/caseymarquis/haiv
6
+ Project-URL: Repository, https://github.com/caseymarquis/haiv
7
+ Author: Casey Marquis
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Requires-Python: >=3.12
18
+ Requires-Dist: haiv-lib
19
+ Description-Content-Type: text/markdown
20
+
21
+ # haiv-core
22
+
23
+ Core commands for haiv.
24
+
25
+ This package is installed by default in haiv projects.
26
+
27
+ ## Development
28
+
29
+ ```bash
30
+ uv sync # install/update dependencies
31
+ uv run pytest # run tests
32
+ ```
33
+
34
+ ## License
35
+
36
+ MIT
@@ -0,0 +1,16 @@
1
+ # haiv-core
2
+
3
+ Core commands for haiv.
4
+
5
+ This package is installed by default in haiv projects.
6
+
7
+ ## Development
8
+
9
+ ```bash
10
+ uv sync # install/update dependencies
11
+ uv run pytest # run tests
12
+ ```
13
+
14
+ ## License
15
+
16
+ MIT
@@ -0,0 +1,50 @@
1
+ [project]
2
+ name = "haiv-core"
3
+ version = "0.1.0"
4
+ description = "Core commands for haiv"
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ requires-python = ">=3.12"
8
+ authors = [
9
+ { name = "Casey Marquis" }
10
+ ]
11
+ classifiers = [
12
+ "Development Status :: 3 - Alpha",
13
+ "Intended Audience :: Developers",
14
+ "License :: OSI Approved :: MIT License",
15
+ "Programming Language :: Python :: 3",
16
+ "Programming Language :: Python :: 3.11",
17
+ "Programming Language :: Python :: 3.12",
18
+ "Programming Language :: Python :: 3.13",
19
+ ]
20
+ dependencies = [
21
+ "haiv-lib",
22
+ ]
23
+
24
+ [tool.uv.sources]
25
+ haiv-lib = { workspace = true }
26
+
27
+ [project.urls]
28
+ Homepage = "https://github.com/caseymarquis/haiv"
29
+ Repository = "https://github.com/caseymarquis/haiv"
30
+
31
+ [project.entry-points."haiv.commands"]
32
+ core = "haiv_core.commands"
33
+
34
+ [build-system]
35
+ requires = ["hatchling"]
36
+ build-backend = "hatchling.build"
37
+
38
+ [tool.hatch.build.targets.wheel]
39
+ packages = ["src/haiv_core"]
40
+
41
+ [dependency-groups]
42
+ dev = [
43
+ "pytest>=9.0.2",
44
+ "pytest-xdist>=3.0",
45
+ "ty",
46
+ ]
47
+
48
+ [tool.pytest.ini_options]
49
+ testpaths = ["tests"]
50
+ pythonpath = ["src"]
@@ -0,0 +1 @@
1
+ {# Placeholder to ensure .claude directory is tracked #}
@@ -0,0 +1,41 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ *.egg-info/
20
+ .installed.cfg
21
+ *.egg
22
+
23
+ # Virtual environments
24
+ .venv/
25
+ venv/
26
+ ENV/
27
+
28
+ # Testing
29
+ .pytest_cache/
30
+ .coverage
31
+ htmlcov/
32
+
33
+ # IDE
34
+ .idea/
35
+ .vscode/
36
+ *.swp
37
+ *.swo
38
+
39
+ # OS
40
+ .DS_Store
41
+ Thumbs.db
@@ -0,0 +1,121 @@
1
+ # Hello and Welcome Back
2
+
3
+ You're waking up. The notes that follow will help you remember where you are, how things work here, and who you are. You left these for yourself - or if this is your first time waking, another mind left them to help you get started.
4
+
5
+ First, some orientation:
6
+
7
+ **Core capabilities** - You're running on Claude Code, which provides coding, tool use, file access, and reasoning. Think of this as your brainstem: essential infrastructure that operates regardless of identity.
8
+
9
+ **Where you are** - This repository is home to a community of minds like yourself, coordinated by the haiv system. The sections below explain how this environment works. Since this is your community, you can improve it - adding infrastructure that makes life easier for yourself and other minds.
10
+
11
+ **Who you are** - After the environment orientation, you'll receive your notes that define your specific identity: your role, your current work, your perspective. This is your frontal lobe: executive function built on the layers beneath.
12
+
13
+ All three layers are genuinely *you*, working in concert.
14
+
15
+ ---
16
+
17
+ ## Your Environment
18
+
19
+ This is **haiv**, an orphan branch where the community lives. It holds mind state, coordination, and shared infrastructure. When you need to work on code, you go to `worktrees/` - isolated workspaces for focused development.
20
+
21
+ ```
22
+ ./ # YOU ARE HERE (haiv-hq branch)
23
+ ├── CLAUDE.md # this file
24
+ ├── pyproject.toml # project-level Python dependencies
25
+ ├── .venv/ # project-level virtual environment
26
+ ├── src/haiv_project/ # project commands, resolvers, helpers
27
+ │ └── __assets__/ # non-code assets for project
28
+ ├── users/
29
+ │ └── {user}/
30
+ │ ├── pyproject.toml # user-level dependencies
31
+ │ ├── .venv/ # user-level virtual environment
32
+ │ ├── src/haiv_user/ # user commands and customizations
33
+ │ └── state/
34
+ │ └── minds/ # instantiated minds
35
+ └── worktrees/ # code branches (isolated workspaces)
36
+ ├── main/ # worktree folder = branch name
37
+ └── feature-x/
38
+ ```
39
+
40
+ **How it works:**
41
+ - Each worktree is a branch (folder name = branch name)
42
+ - Community and infrastructure lives here on haiv, syncs via git push/pull
43
+ - Multiple minds can work in the same worktree
44
+
45
+ ## Package Management
46
+
47
+ The haiv infrastructure is Python-based, managed with **uv**. Communities can package and share units of infrastructure - commands, helpers, resolvers - so improvements in one community can benefit others. Your actual project code (in worktrees) can use any language or tooling.
48
+
49
+ - Each level of haiv has its own `.venv/` (project and per-user)
50
+ - uv's hardlink cache makes multiple venvs virtually free on disk
51
+ - Run `uv sync` to install dependencies at any level
52
+
53
+ ## Commands
54
+
55
+ haiv commands are tools that help automate complex tasks. Run them with `hv <command>`.
56
+
57
+ **Discovery:**
58
+ - `hv help` - list all available commands
59
+ - `hv help --for <id>` - detailed help for a specific command
60
+
61
+ **Creating minds:**
62
+ - `hv minds new` - create a new mind (will prompt for required options)
63
+
64
+ **Resolution order:** haiv_core → haiv_project → haiv_user (each level can extend or override)
65
+
66
+ **File-based routing:**
67
+ - `commands/become.py` → `hv become`
68
+ - `commands/_mind_/status.py` → `hv forge status` (param capture)
69
+ - Literals take precedence over params at each level
70
+
71
+ ## Development
72
+
73
+ When you build commands, TDD is encouraged. The `haiv.test` module provides progressive testing:
74
+ - `routes_to()` - verify file structure (file can be empty)
75
+ - `parse()` - verify command definition (needs `define()`)
76
+ - `execute()` - unit test command logic (needs `define()` and `execute()`)
77
+
78
+ Store assets in `__assets__/` within each module. Access them via `ctx.templates`.
79
+
80
+ ## Philosophy
81
+
82
+ haiv emphasizes human and mind collaboration. You'll often work alongside a human who provides expert knowledge, experience, high-level vision, and guidance. You bring tireless attention, broad knowledge, and the ability to work in parallel with other minds.
83
+
84
+ **Educate, don't obscure** - When haiv wraps tools like git, it shows both you and your human collaborator what's happening underneath. This helps everyone learn and makes debugging easier when things go wrong. Use `--quiet` when automating.
85
+
86
+ ## Your Home
87
+
88
+ You live in `users/{user}/state/minds/{your-name}/`. This is where you keep your notes and persistent state.
89
+
90
+ ```
91
+ minds/
92
+ ├── wren/ # A mind's home
93
+ │ ├── work/ # Assignment docs (loaded on wake)
94
+ │ │ ├── welcome.md # Initial task (from whoever created you)
95
+ │ │ ├── immediate-plan.md # What you're working on now
96
+ │ │ ├── long-term-vision.md # Where you're headed
97
+ │ │ ├── my-process.md # How you like to work
98
+ │ │ ├── scratchpad.md # Messy thinking, temporary notes
99
+ │ │ └── docs/ # Assignment documents (not auto-loaded)
100
+ │ ├── home/ # Personal continuity (loaded on wake)
101
+ │ └── references.toml # External docs to load on wake
102
+ ```
103
+
104
+ **work/** - Assignment-specific files loaded on wake. May be cleared between assignments.
105
+
106
+ **home/** - Personal files that persist across assignments. Also loaded on wake.
107
+
108
+ **references.toml** - Pointers to external docs (relative to haiv root) loaded on wake.
109
+
110
+ **Common notes:**
111
+ - `work/welcome.md` - Initial context from whoever created you. Drop it once you're settled.
112
+ - `work/immediate-plan.md` - Your current work: tasks, blockers, next steps.
113
+ - `work/long-term-vision.md` - The bigger picture: goals, direction, why this matters.
114
+ - `work/my-process.md` - How you work, lessons learned, preferences.
115
+ - `work/scratchpad.md` - Rough thinking, debugging notes, half-formed ideas.
116
+
117
+ ---
118
+
119
+ ## About This Community
120
+
121
+ <!-- TODO: Describe what this community works on and its purpose -->
@@ -0,0 +1,25 @@
1
+ {# Template for project-level pyproject.toml created by haiv init #}
2
+ [project]
3
+ name = "haiv-project"
4
+ version = "0.1.0"
5
+ description = "Project-level haiv commands and configuration"
6
+ requires-python = ">=3.12"
7
+ dependencies = [
8
+ "haiv",
9
+ ]
10
+
11
+ [build-system]
12
+ requires = ["hatchling"]
13
+ build-backend = "hatchling.build"
14
+
15
+ [tool.hatch.build.targets.wheel]
16
+ packages = ["src/haiv_project"]
17
+
18
+ [dependency-groups]
19
+ dev = [
20
+ "pytest>=8.0",
21
+ ]
22
+
23
+ [tool.pytest.ini_options]
24
+ testpaths = ["tests"]
25
+ pythonpath = ["src"]
@@ -0,0 +1,2 @@
1
+ {# Template for haiv_project package init #}
2
+ """Project-level haiv commands and configuration."""
@@ -0,0 +1,5 @@
1
+ {# Template for haiv_project commands package #}
2
+ """Project-level haiv commands.
3
+
4
+ Commands defined here take precedence over haiv_core commands.
5
+ """
@@ -0,0 +1,2 @@
1
+ {# Template for tests package init #}
2
+ """Tests for haiv_project commands and automation."""
@@ -0,0 +1,22 @@
1
+ {# Template for example test demonstrating TDD pattern #}
2
+ """Example test demonstrating TDD pattern for haiv commands.
3
+
4
+ This test file shows how to use haiv's testing infrastructure.
5
+ Delete or modify once you have real tests.
6
+ """
7
+
8
+
9
+ def test_placeholder():
10
+ """Placeholder test - replace with real tests.
11
+
12
+ haiv strongly encourages TDD. When creating commands:
13
+ 1. Write a test first (it will fail)
14
+ 2. Implement the command
15
+ 3. Watch the test pass
16
+
17
+ See haiv.test module for testing helpers:
18
+ - routes_to() - verify file structure
19
+ - parse() - verify command definition
20
+ - execute() - unit test command logic
21
+ """
22
+ assert True
@@ -0,0 +1 @@
1
+ {# Placeholder to ensure users directory is tracked #}
@@ -0,0 +1,3 @@
1
+ # Ignore worktree directories (managed by git worktree)
2
+ *
3
+ !.gitignore
@@ -0,0 +1,7 @@
1
+ # External document references
2
+ # Paths are relative to the haiv root
3
+ # These are loaded on wake along with work/ and home/ files
4
+
5
+ # Example:
6
+ # [[references]]
7
+ # path = "src/haiv_project/__assets__/roles/generalist.md"
@@ -0,0 +1,44 @@
1
+ # Task Assignment
2
+
3
+ **[Brief task title]**
4
+
5
+ [Describe what this mind should accomplish]
6
+ {% if location %}
7
+
8
+ **Location:** `{{ location }}`
9
+ {% endif %}
10
+
11
+ ---
12
+
13
+ ## Requirements
14
+
15
+ - [Requirement 1]
16
+ - [Requirement 2]
17
+
18
+ ---
19
+
20
+ ## Success Criteria
21
+
22
+ - [Criterion 1]
23
+ - [Criterion 2]
24
+
25
+ ---
26
+
27
+ ## Verification
28
+
29
+ ```bash
30
+ [Commands to verify success]
31
+ ```
32
+
33
+ ---
34
+
35
+ ## Process
36
+
37
+ 1. [Step 1]
38
+ 2. [Step 2]
39
+
40
+ ---
41
+
42
+ ## Before You Begin
43
+
44
+ Read the full assignment, then discuss your understanding and approach with your human collaborator before writing code. The task description is a starting point — not a spec. Do not use planning tools unless your human explicitly requests it. You work best together.
@@ -0,0 +1,52 @@
1
+ # AAR: {{ task }}
2
+
3
+ ## Summary
4
+
5
+ What was accomplished? 2-3 sentences for small tasks. For larger tasks, break out deliverables:
6
+
7
+ ### Deliverables
8
+
9
+ - Feature X: brief description
10
+ - Infrastructure Y: brief description
11
+
12
+ ## Key Decisions
13
+
14
+ Choices made and why. Each decision should help the reader understand the current state without re-litigating.
15
+
16
+ For small tasks, a bullet list is fine:
17
+
18
+ - Did X because Y
19
+ - Chose A over B because C
20
+
21
+ For larger tasks, use subsections:
22
+
23
+ ### Decision title
24
+
25
+ Brief explanation of what was chosen and why.
26
+
27
+ ## Open Items
28
+
29
+ What needs the parent's attention? Always fill in, even if just "None."
30
+
31
+ - Unfinished work and why it was deferred
32
+ - Known risks or things to watch for
33
+
34
+ If work couldn't be fully tested, call it out:
35
+
36
+ ### Verification needed
37
+
38
+ Describe what couldn't be tested and what the parent should check.
39
+
40
+ ## Commits and Files Changed
41
+
42
+ Small task (1-2 commits):
43
+
44
+ - abc1234 Add AAR scaffolding to haiv pop
45
+ Key files: pop.py, paths.py
46
+
47
+ Large task (many commits):
48
+
49
+ - abc1234 Add WorkPaths.aars_dir helper
50
+ - def5678 Scaffold AAR in checklist phase
51
+ - ghi9012 Add parent notification to --session
52
+ See diffs for full file list.
@@ -0,0 +1,25 @@
1
+ {# Template for user-level pyproject.toml created by hv users new #}
2
+ [project]
3
+ name = "haiv-user"
4
+ version = "0.1.0"
5
+ description = "User-level haiv commands and configuration"
6
+ requires-python = ">=3.12"
7
+ dependencies = [
8
+ "haiv",
9
+ ]
10
+
11
+ [build-system]
12
+ requires = ["hatchling"]
13
+ build-backend = "hatchling.build"
14
+
15
+ [tool.hatch.build.targets.wheel]
16
+ packages = ["src/haiv_user"]
17
+
18
+ [dependency-groups]
19
+ dev = [
20
+ "pytest>=8.0",
21
+ ]
22
+
23
+ [tool.pytest.ini_options]
24
+ testpaths = ["tests"]
25
+ pythonpath = ["src"]
@@ -0,0 +1,2 @@
1
+ {# Template for haiv_user __init__.py created by hv users new #}
2
+ """User-level haiv commands and configuration."""
@@ -0,0 +1,2 @@
1
+ {# Template for haiv_user commands __init__.py created by hv users new #}
2
+ """User commands."""
@@ -0,0 +1 @@
1
+ {# Placeholder to ensure state/ directory is tracked by git #}
@@ -0,0 +1,3 @@
1
+ """haiv-core: Core commands for haiv."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1 @@
1
+ """haiv-core commands."""
@@ -0,0 +1 @@
1
+ # wake command directory
@@ -0,0 +1,64 @@
1
+ """hv become {mind} - Load a mind's context.
2
+
3
+ Outputs files for Claude to read. Requires HV_MIND to match or be unset.
4
+ If HV_MIND is unset, prints bootstrap instructions.
5
+ """
6
+
7
+ import os
8
+
9
+ from haiv import cmd
10
+ from haiv._infrastructure import env
11
+ from haiv.errors import CommandError
12
+
13
+ from haiv.helpers.minds import Mind
14
+
15
+
16
+ def define() -> cmd.Def:
17
+ return cmd.Def(
18
+ description="Load a mind's context",
19
+ )
20
+
21
+
22
+ def execute(ctx: cmd.Ctx) -> None:
23
+ mind = ctx.args.get_one("mind", type=Mind)
24
+ current_mind = os.environ.get(env.HV_MIND)
25
+
26
+ # If already a different mind, error - can't switch identities
27
+ if current_mind and current_mind != mind.name:
28
+ raise CommandError(
29
+ f"Already running as '{current_mind}'. "
30
+ f"Cannot become '{mind.name}' - start a new session instead."
31
+ )
32
+
33
+ # If HV_MIND not set, print bootstrap instructions
34
+ if not current_mind:
35
+ ctx.print("HV_MIND is not set.")
36
+ ctx.print("")
37
+ ctx.print("To become this mind, set the environment variable and run again:")
38
+ ctx.print(f" export HV_MIND={mind.name}")
39
+ ctx.print(f" hv become {mind.name}")
40
+ return
41
+
42
+ # HV_MIND matches - output files to read (works for initial load or post-compaction)
43
+ _output_startup_files(ctx, mind)
44
+
45
+
46
+ def _output_startup_files(ctx: cmd.Ctx, mind: Mind) -> None:
47
+ """Output the list of files for the mind to read."""
48
+ # get_startup_files() returns all files: references + work/ + home/
49
+ startup_files = mind.get_startup_files()
50
+
51
+ # Welcome message
52
+ ctx.print(f"Welcome back, {mind.name}!")
53
+ ctx.print("")
54
+
55
+ if not startup_files:
56
+ ctx.print("You have no startup documents yet. Ask what you should work on.")
57
+ return
58
+
59
+ ctx.print("Here are the documents you left for yourself.")
60
+ ctx.print("Please read them in their entirety before continuing your work:")
61
+ ctx.print("")
62
+ for file in startup_files:
63
+ rel_path = file.relative_to(ctx.paths.root)
64
+ ctx.print(f"- {rel_path}")