Skip to content

Add: hi export <ID>, one criterion with its cases and what it sits under - #23

Merged
0xLeif merged 1 commit into
mainfrom
0xleif/feat/export-one-criterion
Sep 23, 2026
Merged

0xLeif merged 1 commit into
mainfrom
0xleif/feat/export-one-criterion

Conversation

@0xLeif

@0xLeif 0xLeif commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Summary

hi export accepted a family, a file, or the whole repository. On a product with a few hundred criteria the whole repository is tens of thousands of tokens, and one family can be most of that. An agent building one criterion needs only that criterion, what it is a case of, and why the feature exists. hi's own hi/ exports at about 10,000 tokens whole and about 300 for hi export EXPORT-7.

  • An id is now a scope (EXPORT-7). The export returns that criterion, every case beneath it, every criterion it sits under, and its file's intent, in the same envelope as every other scope. It adds no field and moves none, so it is still "export": 1 (EXPORT-3). HI-1.md adds the id to the values scope can hold, plus one normative line saying what an id scope carries.
  • Parents come with a case (EXPORT-7.a). A payload whose parent names something absent from it points at nothing, and a case read alone is missing its subject. An orphan-case still names the parent it lacks, because export reports what the files hold and hi check is where that break gets reported.
  • An id wins over a family with the same name. Nothing validates the family names a file declares in frontmatter. A cold read declared families: [SEND, SEND-1], hi check passed, and hi export SEND-1 came back empty. Any scope that parses as an id is now read as one. No scope that selected a file or a real family before selects anything different now.
  • A retired case keeps the live criteria it was a case of, kept apart under retired as EXPORT-4 requires.
  • An id-shaped scope that is not an id is refused with the reason, the same way capture refuses it (SEND-01 → leading zero). The refusal for a scope that matches nothing now lists an id as the fourth thing a scope can be.
  • hi/AGENTS.md names the habit in one sentence. Under §38's test it is a habit resting on a frozen fact, not a fact about an unfrozen format. The 0.8 template is added to src/seed/agents_0_8.md so that hi seed upgrades an untouched copy and leaves an edited one alone.

DECISIONS.md §40 records the reasoning and what was left out on purpose: a token budget, a reverse lookup from an id to the code that cites it, an outline mode, and several ids in one call, which would be "export": 2.

Release placement: this is additive (no new field, no new check kind, no change to the format or exit codes) and sits under Unreleased. Whether it ships before or after the 1.0 tag is left as a release decision.

Test Plan

  • fledge lanes run verify: all 8 steps pass (fmt + clippy, tests, view-behaves 14/14, intent, index, spec, nudge-behaves 7/7, plugin-validate)
  • specsync check --force: 10 specs checked, 10 passed, 0 warnings; file coverage 15/15, LOC coverage 8862/8862 (100%)
  • 9 new unit tests in src/out.rs (slice contents, all parents of a case, orphan case, id-over-family precedence, retired case, malformed id refusal, retired id kept apart, envelope unchanged, unknown id refused) and 1 black-box test in tests/cli.rs for argv routing
  • By hand: hi export EXPORT-7.a returns EXPORT-7 and EXPORT-7.a with generate.md's intent; hi export SEND-01 exits 1 with the leading-zero reason

🤖 Generated with Claude Code

An agent building one criterion of a large hi/ no longer has to load the
whole directory. `hi export EXPORT-7` returns that criterion, its cases,
the criteria above it and its file's intent, in the unchanged export
envelope (EXPORT-7, EXPORT-7.a, DECISIONS.md §40).

- An id scope wins over a frontmatter-declared family of the same name
- A retired case keeps the live criteria it was a case of
- An id-shaped scope that is not an id is refused with the reason
- hi/AGENTS.md names the habit in one sentence; the 0.8 template is kept
  in src/seed/ so `hi seed` upgrades an untouched copy

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

@corvid-agent corvid-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CoS glance — APPROVE (b0e4f9dc)

HI product tip: hi export <ID> as a fourth scope. Additive, envelope still "export": 1, and EXPORT-7 / EXPORT-7.a are real captured criteria (not invented AC).

What holds

  • in_slice keeps the id, descendants, and ancestors so every parent in a clean workspace names an entry in the payload (EXPORT-7.a); orphans still name the missing parent.
  • Id parse wins over a frontmatter-declared family of the same name — fixes the cold-read empty export for SEND-1.
  • File-vs-id and family-vs-id collisions stay impossible by casing/hyphen rules; file-scope still takes the file whole via is_this_file || in_scope.
  • Malformed id-shaped scopes (SEND-01) refuse with the parse reason once nothing matched; unknown well-formed ids take the four-thing nothing-matches path.
  • Retired case brings live ancestors into criteria and itself into retired (EXPORT-4 + EXPORT-7.a).
  • Nine unit tests + CLI black-box cover the slice, orphan, precedence, retired, malformed, envelope, and unknown-id paths. Specs/REQ-out-022/HI-1/DECISIONS §40 aligned.
  • agents_0_8.md seed + one-sentence habit in agent_instructions match §38/§40 (habit on a frozen fact).
  • CI green on this tip (ubuntu/macos/windows Check, Lint, CodeQL, page-in-browser).

Nit (non-blocking): release placement (before vs after 1.0) left open in §40 — human release decision, not a code blocker.

Prefer APPROVE. Humans merge; CoS will not.

@0xLeif
0xLeif merged commit a8422a1 into main Sep 23, 2026
9 checks passed
@0xLeif
0xLeif deleted the 0xleif/feat/export-one-criterion branch September 23, 2026 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants