Skip to content

feat(import): ningen-shikkaku.lifecycle@v2 — import the structured --korg-sink - #27

Merged
New1Direction merged 1 commit into
mainfrom
feat/ningen-lifecycle-v2
Oct 13, 2026
Merged

New1Direction merged 1 commit into
mainfrom
feat/ningen-lifecycle-v2

Conversation

@New1Direction

Copy link
Copy Markdown
Owner

Why

ningen-shikkaku.lifecycle@v1 (#25) imports dazai lifecycle events by regex-scraping [dazai] stderr lines. That silently loses events whenever log wording changes, it can't see motokano reads, and it carries PIDs.

ningen-shikkaku now writes a structured lifecycle sink: dazai daemon / motokano --korg-sink PATH, contract ningen-korg-lifecycle@1. It emits one JSON line per session/arm/read/wipe/kill step, built only from closed enums and counters. This PR imports that sink through the existing korg-import@v1 door.

What

  • Profile ningen-shikkaku.lifecycle@v2. Kinds are session_start, arm, read, wipe, kill and session_end, keyed by component plus the producer's random per-run session id. It also allowlists an at_ms field.
    • Named-forbidden fields are v1's list plus pid, name, tool_name, path, socket, length, len, size, hash, sha256 and digest.
    • v1 is unchanged. It is still the path for daemons without the flag and for the Python reference.
  • ningen_sink_to_envelope(lines, version=None).
    • Fixed field-map projection: a field not on the map is never copied.
    • Torn or foreign lines are dropped and counted in dropped.
    • No value coercion: an out-of-vocabulary value rejects the whole envelope atomically.
    • source.version comes from the records' args.producer, or must be passed explicitly if the records name more than one version.
  • CLI: python -m korg_ledger envelope ningen-sink FILE. --source-version is now optional for this source only.
  • Spec: new IMPORT.md §6, a SPEC §11 mention, and a CHANGELOG entry.
    • imports/ningen-shikkaku-sink.example.jsonl is real output from both binaries: an armed dazai hard panic, then a motokano run with a refused re-read.
    • That sink projects exactly onto ningen-shikkaku-lifecycle-v2.example.json. There is also a .rejected.json example.

No hash rule, vector or other profile changes.

Verification

  • CI's Python suite: 298 passed (13 new):
    • the real sink reproduces the spec example;
    • secret-laden extra fields (value, name, pid, cmd, stdout, len) are never copied;
    • junk and torn lines are dropped and counted;
    • out-of-vocabulary values cause an atomic rejection;
    • the version is derived from the records;
    • the CLI round-trips.
  • generate_vectors.py shows no drift; conformance.py and js/conformance.mjs PASS.
  • End to end with the real binaries: sink → envelope ningen-sink → import → lint gives 12 events, chain intact, DAG well-formed, redaction-clean. The secret, tool names and command never appear in the envelope or the ledger.

https://ampcode.com/threads/T-01a135b8-8f38-7394-9d5c-8ac8282f6295

…korg-sink

ningen-shikkaku's `dazai daemon` and `motokano` now write
`ningen-korg-lifecycle@1` records (`--korg-sink`), built from closed enums and
counters only. Import them directly instead of scraping `[dazai]` log lines:

- profile `ningen-shikkaku.lifecycle@v2`: session_start / arm / read / wipe /
  kill / session_end, keyed by component + the producer's random per-run
  session id; covers motokano reads; no PIDs, tool names, lengths or digests
  (named as forbidden alongside v1's list). v1 stays for older daemons and
  the Python reference.
- `ningen_sink_to_envelope`: fixed field-map projection (never copies an
  unlisted field), drops and counts torn/foreign lines, no value coercion
  (out-of-vocabulary values reject the whole envelope), source version from
  the records' producer stamp.
- CLI `python -m korg_ledger envelope ningen-sink FILE`.
- Spec: IMPORT.md §6, SPEC §11, examples incl. real 0.1.0 sink output that
  projects byte-for-byte onto the v2 example envelope; tests for projection,
  leak resistance, atomic rejection, versioning and the CLI round trip.

Amp-Thread-ID: https://ampcode.com/threads/T-01a135b8-8f38-7394-9d5c-8ac8282f6295
Co-authored-by: aisle9angel@gmail.com <aisle9angel@gmail.com>
@github-actions

Copy link
Copy Markdown

🛡️ ✅ Certificate verified

Independently verified — zero trust in the tool that produced it.

✅ demo.korgcert.json — korgcert VALID

claim CI demo: agent added a /healthz endpoint with a passing test
who (issuer) c294765adf91ce96…
what 5 events · Bash×1 Edit×1 Read×1 Write×1 user_prompt×1
files src/app.py, tests/test_health.py
integrity chain ✓ · summary re-derived ✓ · seal ✓

Verified by the independent korg verifier. Re-check in a browser: seal.html.

@New1Direction
New1Direction merged commit 6f8ef7f into main Oct 13, 2026
7 checks passed
@New1Direction
New1Direction deleted the feat/ningen-lifecycle-v2 branch October 13, 2026 19:12
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