@h1v35/hivex 0.1.0

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 H1V35
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.
package/README.md ADDED
@@ -0,0 +1,213 @@
1
+ # Hivex
2
+
3
+ Project decisions, dependencies and exceptions for the agent responsible for implementation and
4
+ review. Markdown remains authority; Hivex supplies context so agents can act autonomously without
5
+ reopening settled decisions.
6
+
7
+ Hivex is a TypeScript/Bun CLI. The current knowledge profile is Luna/max through native Codex and the
8
+ user's ChatGPT subscription, without silent fallback. The implementing agent may use another model.
9
+ Model invocation is localized for future configuration; multiple providers are not yet validated.
10
+
11
+ ## Current delivery
12
+
13
+ This release-in-development supplies initial updates and task consultation (#47), plus automatic
14
+ incremental maintenance and interpretation repair (#48), and task/diff review assistance (#19).
15
+ Publication (#21) prepares early use; introduction in Compi is a separate step. It is not complete Compi adoption or legacy retirement.
16
+
17
+ No installed command approves an implementation. The principal reviewer verifies findings, tests and
18
+ the actual source evidence. See the [approved product decision](docs/adr/0010-practical-knowledge-assistance.md).
19
+
20
+ ## Install the CLI and skill
21
+
22
+ Requires Bun 1.4.2. Once the release is available from npm:
23
+
24
+ ```sh
25
+ bun add --dev --exact @h1v35/hivex@0.1.0
26
+ bun hivex --help
27
+ ```
28
+
29
+ Copy `node_modules/@h1v35/hivex/skills/hivex` into the skill directory used by your agent. For an
30
+ agent that discovers project skills in `.agents/skills`, use `.agents/skills/hivex`. Keep the CLI and
31
+ skill at the same release; upgrade the copied skill when upgrading the package. The skill and its
32
+ Markdown guide are portable and do not require Compi's private tools or other installed skills.
33
+
34
+ The current knowledge profile needs an authenticated Codex CLI session with the selected Luna/max
35
+ model available. Native invocation checks that profile and stops rather than silently falling back.
36
+ Document discovery and version checks work without a model. See the CLI help for bounded model work.
37
+
38
+ ## Run
39
+
40
+ Use Bun 1.4.2. In this checkout:
41
+
42
+ ```sh
43
+ bun install
44
+ bun hivex --help
45
+ bun hivex sources --root /path/to/project
46
+ bun hivex update --root /path/to/project --max-calls 0
47
+ ```
48
+
49
+ The scoped package name is `@h1v35/hivex`, with command `hivex` and MIT license. Publication and registry
50
+ installation are tracked separately; do not fetch the unrelated unscoped npm package.
51
+
52
+ Documents need no Git repository or commit. They can live at monorepo, package or module level and
53
+ use their project's own Markdown format. An optional `hivex.json` selects relative globs:
54
+
55
+ ```json
56
+ {
57
+ "include": ["docs/**/*.md", "packages/**/*.md", "src/**/decisions/*.md"],
58
+ "exclude": ["docs/archive/**"]
59
+ }
60
+ ```
61
+
62
+ Without configuration, Hivex selects Markdown files under the project. It skips dependencies,
63
+ its own cache, Git metadata and private dot directories; explicitly named documentation directories
64
+ can be selected. Symlinks are not followed. The previous experimental `collections` configuration
65
+ is rejected with a migration message rather than silently reinterpreted.
66
+
67
+ ## Recover context
68
+
69
+ ```sh
70
+ bun hivex sources --root /path/to/project --limit 20
71
+ bun hivex read docs/policy.md --root /path/to/project
72
+ bun hivex search "cache access revocation" --root /path/to/project
73
+ bun hivex neighbors <decision-id> --root /path/to/project --limit 24
74
+ bun hivex ask "How should private cached data behave when access is revoked?" --root /path/to/project
75
+ ```
76
+
77
+ `sources` returns document metadata without their full text and a snapshot-bound continuation when
78
+ more records remain. Resume with `--cursor`. `read` returns original text, its version and line ranges;
79
+ use `--from`, `--to` and `--max-bytes` for a bounded passage. Continuation and omitted content remain
80
+ explicit. A working version is not evidence of approval.
81
+
82
+ Search covers both extracted decisions and original Markdown, so terminology omitted from a summary
83
+ remains discoverable. When needed, select a known document with `--source` in a consultation rather
84
+ than reopening a settled question with the owner.
85
+
86
+ Search and neighbor traversal are deterministic and make no model calls. Neighbor traversal includes
87
+ indirect connections within `--limit` and lists decisions it could not expand. Stale knowledge is not
88
+ presented as current evidence. `status` reports available knowledge and documents requiring attention.
89
+
90
+ `ask` first detects added, changed and removed Markdown. It updates at most one bounded batch,
91
+ prioritizing matching fragments, relevant documents and their known dependencies, then asks Luna/max over
92
+ the available decisions and original Markdown. Its default budget is three calls for the complete
93
+ update/check/answer operation. If the budget ends before the answer, repeat the same task with an
94
+ authorized higher total: the work, progress and consumption are retained. An unchanged task reuses
95
+ its answer. Use explicit `update` to advance remaining corpus batches; pending coverage stays visible.
96
+
97
+ Changed sources bring their known incoming and outgoing neighbors into comparison, including
98
+ relationships supported by a third document. Deleted sources are removed from pending ingestion;
99
+ `unavailableDocuments` identifies dependencies that can no longer be verified. Source-local check
100
+ findings remain scoped, so unrelated consultations can use their valid knowledge.
101
+ It explains applicability and uncertainty. The evidence text in the result is read from the cited
102
+ source ranges, not copied from a model-generated quotation. Large sources are supplied as relevant units within the context limit; `omittedUnits` reports
103
+ unread portions so a partial answer is not mistaken for complete coverage. Identical retained consultations are
104
+ reused. A partial result remains useful within its declared limits.
105
+
106
+ ## Update and repair knowledge
107
+
108
+ ```sh
109
+ bun hivex update --root /path/to/project --max-calls 2
110
+ ```
111
+
112
+ An update splits large Markdown into line-preserving units of at most 8 KiB, preferring Markdown
113
+ boundaries. Each round selects at most four units and 16 KiB of target text, with up to 8 KiB of
114
+ relevant existing evidence, then performs one additional check. Original document IDs and line
115
+ numbers survive splitting. Earlier rounds remain queryable while `pendingUnits` and `pendingDocuments`
116
+ show unfinished coverage. Sources up to 32 MiB can be split, within a 64 MiB loaded-corpus limit;
117
+ narrow the selected paths if that limit is reached. A line too large to fit is explicitly reported as unread, never silently cut.
118
+
119
+ Each extraction and check is checkpointed. Resuming continues the same work and never repeats its
120
+ completed rounds. Successful structured model results are cached in the same store by the complete
121
+ request, schema and model profile; an identical request can be reused without a call, even when
122
+ reconstructing earlier knowledge. Changed context invalidates that cache entry. Context discovery considers authored links, lexical
123
+ matches and recent decisions; `relationshipCoverage` states that this is bounded, not exhaustive. Cache hits are
124
+ reported separately from calls and tokens; this is an optimization, not documentary authority.
125
+
126
+ To correct derived knowledge against unchanged Markdown, use:
127
+
128
+ ```sh
129
+ bun hivex update --root /path/to/project --repair docs/cache.md --reason "The source specifies seven days, not indefinite retention."
130
+ ```
131
+
132
+ Repair replaces the affected unit's interpretations and revisits its relationships without editing
133
+ Markdown. Its reason guides comparison with the source; it does not create new authority. Repeating
134
+ the same completed repair reuses its work. A genuine unresolved documentary conflict still needs a
135
+ decision by the responsible person.
136
+
137
+ The default explicit-update work budget is two invocation attempts and 131,072 input bytes. `--max-calls` and
138
+ `--max-input-bytes` set totals for the complete work, including extraction, check and resumption.
139
+ A zero-call update reports pending documents without invoking the model. An exhausted work item
140
+ retains its progress; repeating the command does not reset its counter. An authorized larger total
141
+ can complete the remaining stage without repeating completed extraction.
142
+
143
+ A failed or unfinished invocation is not retried automatically by increasing the budget. Inspect its
144
+ reported outcome and usage first. `--retry-failed` can explicitly resume a safely ended failure within
145
+ the same work budget; uncertain invocations remain blocked. A completed adverse check is not an
146
+ invocation failure and is never retried by this flag. Uncertain or pending knowledge does not become a blanket pass.
147
+ The single project-local `.hivex/knowledge.sqlite` stores derived knowledge and work accounting;
148
+ no source Markdown is rewritten. Preserve it when work evidence is needed. Storage is bounded at
149
+ 64 MiB; do not delete an active store to hide unfinished calls or reset a work budget.
150
+
151
+ `recover` inspects abandoned work without invoking the model or killing processes. Live owners or
152
+ native processes remain protected. If local processes ended but remote delivery is uncertain,
153
+ `recover --acknowledge-uncertain` records an explicit acknowledgement; original reports and unknown
154
+ usage remain visible. Recovery itself never retries: a subsequent `--retry-failed` uses the retained
155
+ work budget. Do not treat acknowledgement as proof that the earlier remote turn completed.
156
+
157
+ `prune` releases space occupied by old completed work and cached results, retaining the graph and all
158
+ unfinished work, attempts and budgets. It keeps the newest eight completed works and 64 cached
159
+ results by default; `--keep-completed` and `--keep-caches` change those counts. Pruned answers can
160
+ require a new model call when requested again. Export evidence before pruning if historical reports
161
+ are needed; pruning is explicit, never an automatic budget reset.
162
+
163
+ Native operations accept `--codex` and `--deadline-ms`; the default deadline is 30 minutes. Consultation
164
+ context defaults to 65,536 bytes and can be bounded with `--max-context-bytes`. Limits are reported,
165
+ not met by silently cutting a rule or pretending omitted evidence was reviewed. Input-byte and call
166
+ budgets limit work; reported token usage is actual consumption, including known failed attempts.
167
+
168
+ ## Agent skill and Markdown practice
169
+
170
+ The [portable Hivex skill](skills/hivex/SKILL.md) teaches consultation before implementation, support to
171
+ the principal reviewer, documentation maintenance, uncertainty and budget handling. It uses the
172
+ installed CLI's actual interface and does not require Compi's private tools or other skills.
173
+
174
+ The [optional Markdown convention](skills/hivex/references/markdown.md) describes authority maps,
175
+ glossaries, ADRs, guidelines, process and procedures. Recommend it when useful; existing layouts,
176
+ metadata conventions and writing styles remain valid. Create only the documents a project needs.
177
+
178
+ ## Development
179
+
180
+ ```sh
181
+ bun run typecheck
182
+ bun run lint
183
+ bun run format:check
184
+ bun run test
185
+ ```
186
+
187
+ Tests use the public CLI and a simulated native transport. Real Luna evaluations are bounded and
188
+ reported separately; simulated token usage is not a consumption measurement. Development is
189
+ issue-first, with coherent PRs, independent Standards/Spec review and CI on the final commit.
190
+ See the [engineering workflow](docs/engineering.md).
191
+
192
+ Earlier candidate/fidelity/comparison/admission protocols and their tests are retired from the active
193
+ CLI. Their code remains in Git history and historical evidence keeps its original results. They do
194
+ not impose a requirement to reproduce an Opus graph or exhaustively replay an old gold suite.
195
+
196
+ ## Support an implementation review
197
+
198
+ From the Git project root, supply the task and the base revision. Hivex captures the working change,
199
+ including untracked files, and provides findings tied to code and Markdown versions:
200
+
201
+ ```sh
202
+ hivex review "Change cache behavior" --base main --max-calls 3 > /tmp/hivex-review.json
203
+ hivex review --check /tmp/hivex-review.json
204
+ ```
205
+
206
+ Use the same task and base to resume or reuse retained work. Update, knowledge check and review share
207
+ one budget, including expansion of a partial report. Context is bounded; large changes must be narrowed or split into coherent reviews. Larger existing
208
+ text files contribute diff excerpts with original line numbers and explicit omissions; their full-file
209
+ versions still detect later changes.
210
+ The principal reviewer verifies conflicts and exceptions and resolves supported contradictions before
211
+ closing the change. A `ready` result means assistance is available, never that the implementation is
212
+ approved. A saved report can be checked without a model; changed code or documents make it stale.
213
+ Keep reports outside the project or in an ignored path so they do not become part of the change.
@@ -0,0 +1,59 @@
1
+ # Hivex domain language
2
+
3
+ Hivex supplies project knowledge to the agents responsible for implementation and review. Markdown
4
+ records that knowledge; the graph helps locate and interpret it without becoming authority itself.
5
+
6
+ ## Language
7
+
8
+ **Document**: A selected Markdown file, wherever its project, package or module keeps it.
9
+
10
+ **Ingestion unit**: A bounded fragment of a document with its original line range. It permits
11
+ processing and resumption in rounds without becoming a separate documentary authority.
12
+
13
+ **Document version**: The exact contents of a document at a point in the work. A working copy is a
14
+ version even when it has not been committed; its existence does not establish approval.
15
+
16
+ **Snapshot**: The selected document versions considered together for a particular work item.
17
+
18
+ **Decision**: A meaningful project choice or constraint together with its scope, conditions,
19
+ exceptions and reasons. Proposals and historical decisions retain their declared state.
20
+
21
+ **Relationship**: An evidenced connection between decisions, such as a dependency, exception or
22
+ replacement. It may cross documents that have no authored link; its interpretation can be uncertain.
23
+
24
+ **Evidence**: An identifiable passage of a particular document or implementation version that a
25
+ reader can inspect. A model's paraphrase is not the passage itself.
26
+
27
+ **Knowledge graph**: Derived decisions and relationships, with supporting definitions and lessons, that help an agent recover project context.
28
+ It may be incomplete or uncertain without making every usable part unavailable.
29
+
30
+ **Applicability**: Whether a decision governs the case being considered after its conditions,
31
+ exceptions and replacements have been taken into account.
32
+
33
+ **Freshness**: Whether derived knowledge still corresponds to the selected document versions.
34
+ Freshness does not establish applicability or correctness by itself.
35
+
36
+ **Knowledge update**: Processing a selected set of document versions into decisions and relationships,
37
+ followed by one bounded check of that set and its affected relationships.
38
+
39
+ **Knowledge check**: Examination of an update against its sources to identify omissions or incorrect
40
+ interpretations. It reports issues and uncertainty, not a certificate of global completeness.
41
+
42
+ **Interpretation repair**: Replacing a wrong derived interpretation by comparing it with unchanged
43
+ Markdown. It preserves source authority and does not resolve a genuine policy conflict by itself.
44
+
45
+ **Context**: The decisions, related evidence and remaining uncertainties relevant to a particular task.
46
+
47
+ **Implementation version**: The captured change against a particular base together with the exact
48
+ contents of the affected files. Later code changes are outside that review.
49
+
50
+ **Finding**: A possible conflict between an implementation and project knowledge. The principal
51
+ reviewer verifies it and retains responsibility for the implementation review.
52
+
53
+ **Work**: One requested update, consultation or review, including its phases and any resumed work.
54
+
55
+ **Work budget**: The limits shared by every phase and attempt of one work item. Resuming does not
56
+ reset its consumption, and unknown consumption remains visible.
57
+
58
+ **Recovery**: Incorporating useful historical decisions, reasons and lessons into their appropriate
59
+ Markdown authorities while identifying obsolete, duplicate or purely operational material.
package/docs/README.md ADDED
@@ -0,0 +1,14 @@
1
+ # Documentation map
2
+
3
+ - [Domain language](CONTEXT.md): documents, decisions, relationships, evidence and bounded work.
4
+ - [Engineering workflow](engineering.md): development, verification and knowledge maintenance.
5
+ - [Practical knowledge assistance](adr/0010-practical-knowledge-assistance.md): the current approved
6
+ contract, staged delivery, autonomy, semantic relationships, uncertainty and cost.
7
+ - [Recommended Markdown convention](../skills/hivex/references/markdown.md): optional organization
8
+ and writing practices for any adopting project.
9
+ - [CLI guide](../README.md) and [agent skill](../skills/hivex/SKILL.md): the interface actually available.
10
+
11
+ Earlier decisions remain in `adr/` as history. ADRs 0004–0009 describe the replaced experimental
12
+ cohort/admission workflow; ADR 0010 supersedes its mandatory ceremony. Historical evidence is scoped
13
+ to its original revision and is not a current acceptance result. An adopting project retains its own
14
+ Markdown at monorepo, package or module level; Hivex does not own that source tree.
@@ -0,0 +1,37 @@
1
+ ---
2
+ title: Independent Bun installation
3
+ status: accepted
4
+ date: 2026-09-07
5
+ ---
6
+
7
+ # Independent Bun installation
8
+
9
+ ## Context
10
+
11
+ The owner selected Bun 1.4.2 as Hivex's runtime and package manager. The first independent version
12
+ added a custom installer, registry verifier and generated bootstrap to reproduce Compi's dependency
13
+ policy. The owner explicitly rejected that extra machinery: installation should work as in a project
14
+ that started with Bun. This amendment replaces the initial decision; its original implementation and
15
+ evidence remain in Git history and the bounded historical evidence directory.
16
+
17
+ ## Decision
18
+
19
+ Use `bun install` for development and commit `bun.lock`. Use `bun ci` for frozen installation in CI
20
+ and fresh checkouts. Pin Bun 1.4.2 in the package manifest and CI. Keep Bun's isolated dependency
21
+ layout, seven-day minimum release age and explicit `trustedDependencies` allowlist, currently empty.
22
+ Review required lifecycle-script additions with the dependency change.
23
+
24
+ Do not maintain a parallel installer, publishing-trust verifier, registry metadata cache or generated
25
+ bootstrap. Bun owns installation behavior; its native controls are not a claim of parity with every
26
+ former pnpm policy. Remove code, dependencies and tests that served only the retired installer.
27
+
28
+ ## Consequences
29
+
30
+ Hivex installs and runs independently of Compi and pnpm. It owns its compiler, formatter and lint
31
+ configuration. The native TypeScript 7 compiler uses the unscoped `typescript-native` alias so Bun
32
+ installs its native optional package. The separate TypeScript 6 package provides the compatibility
33
+ API needed by typed ESLint.
34
+
35
+ Typechecking, lint, formatting and relevant product tests validate dependency changes. They do not
36
+ require a second installation framework. Compi's Bun conversion and Expo/native compatibility remain
37
+ separate work under [#1162](https://github.com/H1V35/compi/issues/1162).
@@ -0,0 +1,92 @@
1
+ ---
2
+ title: Practical knowledge assistance with bounded work
3
+ status: accepted
4
+ date: 2026-09-09
5
+ ---
6
+
7
+ # Practical knowledge assistance with bounded work
8
+
9
+ The owner approved a new contract after a grill in [Hivex #17](https://github.com/H1V35/hivex/issues/17).
10
+ The previous implementation spent disproportionate effort certifying intermediate model output.
11
+ Hivex must provide a portable second brain that helps agents act autonomously, reduce hallucinations
12
+ and contradictions, and recover settled decisions before asking the owner again.
13
+
14
+ Markdown remains documentary authority. Documents can live at monorepo, package or module level and
15
+ use the adopting project's own organization and format. Recommend clear domain language, decisions
16
+ with their reasons, explicit conditions and replacements, and one authoritative home per fact.
17
+ Compi's documentation convention is useful guidance, not an admission requirement.
18
+
19
+ Keep a semantic graph of meaningful decisions and relationships, including implicit cross-document
20
+ connections. A document-summary index alone does not satisfy the contract. Recover the relevant
21
+ transitive dependencies within an explicit context budget. Explain applicability when the sources
22
+ support it; otherwise identify uncertainty and the remaining evidence needed.
23
+
24
+ The implementing agent consults Hivex before a coherent feature or behavior change. The principal
25
+ reviewer consults it with the task and diff during review, checks its findings and keeps responsibility
26
+ for accepting the implementation. A demonstrated contradiction must be corrected or resolved by an
27
+ approved decision change. Hivex neither conducts every aspect of code review nor rewrites Markdown
28
+ on its own. Genuine unanswered decisions go to the owner with sources, impact and a recommendation.
29
+
30
+ An update splits oversized Markdown into source-bound units with original line provenance, processes
31
+ bounded rounds, and checkpoints progress so resumption never discards completed ingestion. Reuse
32
+ retained extraction results when their source and processing context still match; do not require the
33
+ whole corpus or a large document to fit in one invocation. Caches optimize work and carry no authority.
34
+
35
+ An update processes a bounded batch and makes one additional knowledge check against its documents
36
+ and affected relationships. Do not review every node separately or every possible source pair.
37
+ Do not automatically revise and retry until the model produces green output. Usable knowledge remains
38
+ available when another part is pending or uncertain, with those limits visible to the caller.
39
+ A wrong derived interpretation can be corrected against its source without changing doctrine.
40
+
41
+ Consultations and reviews detect added, changed and removed Markdown and update affected knowledge
42
+ within their work budget. Reuse unchanged knowledge. Working documents need no commit to be readable,
43
+ but their working state and exact contents must be identifiable. Results refer to the document and
44
+ implementation versions actually considered; subsequent changes are not silently covered.
45
+
46
+ A work budget spans the entire requested operation, its phases and any resumption or attempts.
47
+ Expose actual consumption and unknown usage, preserve progress at a limit and distinguish initial
48
+ indexing, maintenance, consultation and review. Small empirical checks establish useful defaults;
49
+ a cheap model does not justify unnecessary invocations or context.
50
+
51
+ Luna/max is the owner's selected knowledge model and the profile validated for this release, without
52
+ silent fallback. Keep model selection and invocation localized so another user can configure a
53
+ supported model later. Do not build a provider framework speculatively. The principal agent may use
54
+ a different model without moving project knowledge into its vendor's private memory.
55
+
56
+ Use TypeScript/Bun and practical domain-driven modules with small interfaces. There is no obligation
57
+ to retain the old code, Opus graph, gold suite or machinery as the architecture or acceptance target.
58
+ Historical evidence keeps its actual result and limits. This decision supersedes the mandatory
59
+ candidate/fidelity/pair-comparison/admission ceremony in ADRs 0004–0009 for the replacement workflow;
60
+ those ADRs describe the earlier implementation and remain historical records.
61
+
62
+ The portable skill is part of each functional delivery. It teaches the actual CLI, the agreed
63
+ workflow, good documentation practice and cost/uncertainty handling without requiring Compi's
64
+ private tools or skills. The first slice in #47 supplies explicit initial updates and task context;
65
+ #48 adds automatic incremental maintenance and interpretation repair; #19 supplies diff-review assistance. These are
66
+ implementation stages, not claims that the entire new contract is already shipped.
67
+
68
+ Validate with bounded real Compi cases covering a conflict, a valid exception, indirect dependency,
69
+ insufficient evidence and a document change, with explicit expected outcomes and measured cost.
70
+ Also use a differently organized Markdown project and an agent exercising the skill. Tests exercise
71
+ the public CLI and native protocol seam, not incidental representations.
72
+
73
+ Early use in Compi is desirable. Complete closure additionally requires recovering useful historical
74
+ knowledge and retiring the old active machinery and consumers after replacement is verified.
75
+ Keep Git history and necessary external evidence; a legacy evidence document can suffice. Do not
76
+ rebuild another fleet inside that archive or treat a successful package build as completed adoption.
77
+
78
+ ## Incremental consultation delivery (#48)
79
+
80
+ A consultation maintains at most one bounded pending batch before answering, prioritizing matching
81
+ fragments and known affected neighbors. Update, check and answer share one work budget; context-limit
82
+ increases do not reset an unfinished work item. Remaining corpus coverage is reported, and explicit
83
+ updates can advance further rounds. Repeating a completed consultation reuses its result while its
84
+ supplied context remains unchanged.
85
+
86
+ Repair revisits selected source units with an explicit correction reason, without editing Markdown.
87
+ It replaces their derived decisions and relationships and preserves prior attempts. Check findings
88
+ carry source/version/range scope so an unrelated consultation does not inherit a local uncertainty.
89
+ Removed sources remain identifiable when a dependency can no longer be verified. A changed known
90
+ supporting source takes priority over unrelated pending documents. Endpoint updates include the
91
+ source passages supporting their previous relationships; if that evidence is missing or cannot fit
92
+ the context limit, retain pending work and report the limitation before spending a model call.
@@ -0,0 +1,174 @@
1
+ ---
2
+ title: Engineering workflow
3
+ status: accepted
4
+ ---
5
+
6
+ # Engineering workflow
7
+
8
+ Hivex is a TypeScript/Bun product. Modules group behavior by domain responsibility and hide internal
9
+ details behind small interfaces. Do not add a second development-session orchestrator or require
10
+ an adopting project's layout, tracker or product packages. Codex, Git/GitHub and CI coordinate work.
11
+
12
+ ## Development and verification
13
+
14
+ Work is issue-first in `H1V35/hivex`. New vertical work follows discovery where decisions remain open,
15
+ then an agreed spec, verifiable execution tickets, implementation and code review. Reuse settled scope
16
+ instead of reopening an interview. The owning repository carries the execution ticket; a cross-repository
17
+ parent supplies context and coordination, not a substitute for native tracking.
18
+
19
+ Resolve the existing spec/ticket before changing code and link the PR and verification to it. Absorb
20
+ review findings into the appropriate existing ticket whenever its scope permits. Open a separate issue
21
+ only when strictly necessary to preserve independently actionable work, and record why it cannot be
22
+ absorbed. Read-only retrieval does not need a new ticket. Specs and tickets track work and acceptance;
23
+ resulting durable decisions also enter their repository authority.
24
+
25
+ Use an existing issue for an already tracked requirement. Create a branch from the current remote
26
+ main, keep each PR to one coherent change and preserve commit history when merging. Never push
27
+ directly to main or force-push a shared branch. Apply review findings before acceptance; an invalid
28
+ review can be rerun, while an adverse finding must be resolved on its merits. Current explicit owner
29
+ authorization governs whether the agent may merge.
30
+
31
+ Independent code reviewers use the coordinating agent's current model and reasoning effort. Pass
32
+ that profile explicitly when the subagent default differs, and verify the effective configuration
33
+ after dispatch. Do not substitute the cheaper knowledge model for code review. Routine implementation subtasks may use an
34
+ explicitly authorized cheaper model; Hivex's internal knowledge extraction/checking uses the user's
35
+ knowledge-model configuration independently of the development and code-review model.
36
+
37
+ Choose verification for the affected surfaces. Code changes require typechecking, lint, formatting
38
+ and relevant behavior tests; documentation-only changes need formatting and checks of affected
39
+ references or declared sources. Record the exact revision and the checks actually completed. A later
40
+ change invalidates the affected results. Do not claim an omitted, interrupted or truncated check passed.
41
+
42
+ GitHub Actions runs the quality workflow on the owner's Mac through an official self-hosted runner,
43
+ using `[self-hosted, macOS, ARM64, hivex]`. GitHub retains secrets, logs and PR checks; no hosted
44
+ runner fallback is configured. No speed benchmark is required. A queued, skipped or interrupted
45
+ run is not a pass. Local verification remains required when the runner is unavailable.
46
+
47
+ Runner installation is repository administration, outside Hivex's product. Register the admitted
48
+ macOS ARM64 release from GitHub's runner settings in its own directory, verify the official checksum,
49
+ and use the generated `svc.sh install/start/status/stop` commands. Keep automatic updates enabled,
50
+ a stable Homebrew/system PATH and the Mac awake and connected under the logged-in user. The
51
+ runner work directory must be separate from the developer checkout and other repository runners.
52
+ Only trusted code may run on this persistent host; review that boundary before public contributions.
53
+ See [GitHub's runner reference](https://docs.github.com/en/actions/reference/runners/self-hosted-runners).
54
+
55
+ During a host migration, disable Actions, register and confirm the runner is online, and merge all
56
+ workflow routes before re-enabling Actions. Then dispatch Quality on that exact revision and check
57
+ the assigned runner and completed result. The route change alone is not functional verification.
58
+
59
+ Use `bun install` for development and `bun ci` for frozen installation. Bun owns dependency
60
+ installation through its native configuration and lockfile; Hivex has no custom installer or
61
+ registry verifier. See the [installation decision](adr/0003-independent-bun-installation.md).
62
+
63
+ The lint configuration owns executable syntax/complexity constraints: cyclomatic complexity 20,
64
+ cognitive complexity 15, at most four parameters, nesting depth three and no nested/chained
65
+ ternaries. Refactor around meaningful responsibilities rather than adding tiny wrappers merely to
66
+ make a number pass. Changes to those limits require a documented decision.
67
+
68
+ ## Tests protect behavior
69
+
70
+ TDD guides development through meaningful failing examples; it does not require a test for every
71
+ function, component, wrapper or line. A test must identify a supported behavior, meaningful invariant
72
+ or regression it protects. Prefer the caller's observable interface and results that survive an
73
+ internal refactor.
74
+
75
+ For UI, test visible content, accessibility, interactions and loading/error/empty-state behavior.
76
+ Do not freeze arbitrary child arrays, wrapper counts or class/style arrangements. A visual dimension
77
+ needs a test only when it is an intentional requirement worth maintaining. For example, displaying
78
+ "2 of 4" is a behavior; representing it as exactly three React children is not.
79
+
80
+ Mocks, call counts, ordering and exact bytes are not automatically wrong. They can protect an
81
+ external protocol, idempotency, a query budget or faithful source reproduction. Their justification
82
+ must be the contract, not the current arrangement of internal helpers. Expected results must be
83
+ independent examples, not the implementation's own calculation repeated in the test.
84
+
85
+ Review existing tests as retain, rewrite, consolidate or remove. Remove tests for retired behavior
86
+ with that behavior; preserve still-needed guarantees at the replacement's actual interface. Do not
87
+ port a legacy battery mechanically, chase a test-count target or retain duplicate suites indefinitely.
88
+
89
+ ## Files and runtime data have a lifecycle
90
+
91
+ Create a source file for a meaningful responsibility and a document for a distinct authoritative
92
+ purpose. Do not create files for every helper, task, turn, attempt or handoff merely to satisfy a
93
+ layout convention or a lint threshold.
94
+
95
+ Before introducing persistent state, define its purpose, location, owner and retention. Prefer a small
96
+ project-local data store to an unbounded tree of per-event files. A per-unit atomic checkpoint can be
97
+ a database transaction; it does not require a separate file. Fewer filenames alone do not bound data
98
+ growth: cached data, run history and diagnostics also need size/count/age limits and cleanup behavior.
99
+
100
+ Normal read-only queries should leave no per-query artifacts. Clean up owned temporary resources
101
+ on ordinary completion and handled failures. Interrupted work must remain recoverable without being
102
+ silently retried or discarded. Export diagnostic bundles when needed rather than automatically
103
+ writing a new report for every successful step. Retention must preserve the accepted state and the
104
+ evidence needed by supported historical/recovery operations; it must not invent a successful cleanup.
105
+
106
+ ## Documentation is maintained authority
107
+
108
+ Code must be self-explanatory through clear names, structure and behavior. Repository Markdown is
109
+ the source of truth for intent, constraints, decisions and reasons that code cannot explain. Do not
110
+ write a parallel implementation manual or use documentation to compensate for unclear code.
111
+ Accepted source history and Markdown retain authority; caches, model output and search hits do not.
112
+ An accepted status alone does not settle amendments, exceptions or contradictions. Keep unresolved
113
+ evidence explicit. Never promote a historical agent's description of an owner ruling without
114
+ checking its provenance and applicability.
115
+
116
+ Capture every decision worth preserving in its appropriate repository document as part of the work.
117
+ Do not leave accepted knowledge only in a conversation, issue comment or runtime log. Update the
118
+ existing canonical document when it already owns the topic and scope; create a new one only when
119
+ it has a distinct purpose. An issue can track the work and preserve discussion, but it is not a
120
+ substitute for incorporating the resulting doctrine into the documentation.
121
+
122
+ Keep docs with the monorepo, workspace or module they describe. Link to common rules instead of
123
+ copying them. Recommended new Markdown should state purpose/scope, use stable headings and suitable
124
+ metadata, keep a rule with its conditions/exceptions, and link its sources and replacements. Accept
125
+ compatible existing Markdown without forcing those authors to adopt our template. Do not generate
126
+ empty documentation for every module or add non-Markdown readers to the current scope.
127
+
128
+ Use repository decisions and review evidence for durable knowledge, not private agent memory.
129
+ Checkpoints identify the exact commit, verified work and remaining work. Choose a context handoff
130
+ when the task needs it; Hivex does not impose the retired machinery's fixed token thresholds.
131
+ Knowledge-model operations use the admitted Luna/max profile and record actual usage, including
132
+ failed or interrupted attempts. Deterministic retrieval and maintenance do not require a model.
133
+
134
+ The replacement workflow follows [ADR 0010](adr/0010-practical-knowledge-assistance.md). It processes
135
+ bounded document batches with one additional knowledge check, keeps partial knowledge usable and
136
+ preserves a work budget across phases and resumption. A consultation maintains one pending batch
137
+ before answering, and a source-based repair replaces interpretations without changing doctrine.
138
+ Keep check warnings scoped and public evidence limited to source coordinates, version and text. Avoid a new abstraction or protocol unless it
139
+ protects a concrete requirement. The owner-authorized implementation can replace the earlier
140
+ cohort/admission pipeline; its historical evidence remains unchanged.
141
+
142
+ Hivex assists the principal reviewer with decisions, dependencies, exceptions and possible conflicts.
143
+ The reviewer verifies its findings. Missing context or uncertainty limits the conclusions it affects;
144
+ a definitive finding must refer to the actual document and implementation versions reviewed.
145
+
146
+ ## Retire mechanisms without losing knowledge
147
+
148
+ Early use in Compi can support validation and recovery before full retirement. Necessary adoption
149
+ and verification work belongs to Hivex completion. Alternative model integrations are evolutionary work;
150
+ keep the current Codex/Luna route usable without spreading its assumptions into the knowledge model.
151
+
152
+ After knowledge recovery, replacement validation and consumer migration, remove obsolete orchestration
153
+ code, scripts, hooks, configuration, tests, dependencies and active instructions. Do not carry an unused
154
+ legacy framework into Hivex under another name. Preserve useful decisions in their canonical docs and
155
+ retain necessary historical evidence in Git or a bounded private archive outside the active worktree.
156
+ Do not rewrite Git history or destroy the accepted Opus graph before its replacement is admitted.
157
+
158
+ Early use can precede complete legacy recovery. Complete closure requires useful historical knowledge
159
+ in Markdown, Hivex demonstrated in Compi and the old active machinery retired with its consumers.
160
+ Validate the new workflow against bounded real cases, not identity with an old model's graph or an
161
+ exhaustive replay prerequisite. Release packages exclude private project evidence and retired runtime.
162
+
163
+ ## Distribution
164
+
165
+ The owner selected `@h1v35/hivex` for the npm package on 2026-09-08, retaining `hivex` as the installed
166
+ command, and approved the MIT license. The scoped name avoids the unrelated existing unscoped npm
167
+ package. Use an authenticated account authorized for that scope; do not infer npm ownership from a
168
+ matching GitHub name. Release preparation must verify the packed contents and exclude private project
169
+ evidence and runtime stores. Compi adopts a pinned published version after the complete cycle is
170
+ validated; this decision alone does not mean a package has been published.
171
+
172
+ Before publication, inspect and scan the exact package archive for secrets and unintended private
173
+ content. Record its hash and the completed scan result; a repack requires a fresh check. Publish the
174
+ same verified artifact, not an unchecked reconstruction from a changed working tree.