Repository navigation
Added — confidence write-back from grounding reconciliation (#364, Phase 2 of #245)
The Phase-1 mk grounding report (read-only, #245) gains its destructive companion: mk grounding --apply writes a reconciled confidence back onto the actionable review/promote atoms. Gated on human_edit events (#247) — without that signal a blind write-back could clobber a confidence a human deliberately set. MINOR (new flags + exported engine).
- Engine
src/reconcile.ts(reconcileGrounding,reconciledConfidence): reusescomputeGrounding/classifyQuadrant(no re-derived scoring). The reconciled value is an asymmetric convex pull of the prior toward the grounding score —reconciled = clamp(prior + α·(grounding − prior), 0, 1)— with α_neg = 0.08 > α_pos = 0.03 (SmartVector, arXiv 2604.20598) so disconfirmation (review: pull down) moves faster than confirmation (promote: pull up). The small step means repeated passes converge an atom toward its grounded value and stop once it crosses the quadrant threshold, rather than snapping onto the diagonal. - Provenance-aware skip: atoms carrying a
human_editevent are skipped (human-asserted confidence) unless--override— this is the dependency on #247. Each write emits anatom_reconciledaudit event (added toEVENT_ACTIONS+MUTATION_ACTIONS; carries the post-write snapshot, so replay reconstructs it and compaction keeps the latest).--dry-runpreviews; onlyreview/promoteatoms that pass the actionability guards and aminDeltafloor (0.005) are written. - CLI (
mk grounding --apply [--dry-run] [--override] [--agent-id] [--session-id]):--apply --jsonemits{ scanned, candidates, applied, skipped_human_edit, skipped_below_min_delta, dry_run, changes[] }(distinct from the advisory report shape). Plainmk groundingis unchanged — still read-only, no index. - Exports (
src/index.ts):reconcileGrounding/reconciledConfidence+ReconcileOptions/ReconcileResult/ReconcileChange+DEFAULT_ALPHA_NEG/DEFAULT_ALPHA_POS/DEFAULT_MIN_DELTA. - Completes #245 step 4 (the deferred write-back half). +14 tests (
test/reconcile.test.ts+mk grounding --applyCLI cases);contracts.md§2.1 +sdk-reference.mdgrounding section +public-api-surfacesnapshot updated.
Added — human_edit events: close the dark-signal gap in provenance tracking (#247)
human_edit had been in EVENT_ACTIONS since v1 but was never emitted — direct filesystem edits (via $EDITOR, the Edit tool, or any non-mk path) bypassed the event system entirely, leaving the strongest correction signal in the store (a human directly validating or correcting an atom) invisible to the log. This wires both paths. MINOR (new public CLI command + flag + exported engine functions).
- Forward path —
mk edit <atom-id>(src/edit.ts, engineeditAtom+ CLIsrc/cli/edit.ts): opens the atom in$EDITOR, hashes the file before/after, and on change re-serializes through the canonical writer (so the on-disk bytes match the recorded snapshot) and emits a provenancedhuman_editevent carrying a diff summary (hash_before/hash_after,lines_added/lines_removed) inmeta. No-op (no event) when saved unchanged; refuses encrypted (SECRET) atoms (editing ciphertext is meaningless). Injectable editor runner (EditorRunner) for testing.--dry-run/--jsonlikemk execute. - Backward path —
mk reflect --backfill-human-edits(src/provenance.ts,detectUnprovenancedWrites+backfillHumanEdits): detects writes that already happened off-band, labelled by confidence —content-diff(high: current serialized form, normalized through the current serializer to cancel format drift, differs from the snapshot in the last recorded mutation event; skipped for SECRET, whose snapshots are encrypted) andtimestamp-heuristic(low:updated_atis newer than the last mutation event). Bulkmk doctor --fixmigration passes cluster on a single same-secondupdated_at— that signature (≥3 candidates) is detected and excluded from backfill. Synthetic events are taggedmeta.synthetic = true+ their detection confidence. Opt-in (off by default in plainmk reflect) because content-diff also surfaces legitimate-but-eventlessmkwrites (relate/relink/enrich-relations); emission must be deliberate.ReflectResultgains optionalunprovenanced_writes/human_edits_backfilled(present only with the flag, so the default result shape is unchanged). human_editadded toMUTATION_ACTIONS(src/schema.ts) — it carries a full post-edit snapshot, so replay reconstructs the edited state and compaction keeps the latest per atom_ref. This is also what makes the backward detector idempotent: an emittedhuman_editbecomes the atom's latest snapshot baseline, so a second pass re-detects nothing.- Exports (
src/index.ts):editAtom+EditOptions/EditResult/EditorRunner;detectUnprovenancedWrites/backfillHumanEdits+UnprovenancedWrite/DetectionConfidence/BackfillOptions/BackfillResult. - Unblocks the grounding reconciliation write-back (#364 / #245-246), which weights human corrections 2.67× over silent accepts and was operating without the disconfirmatory signal.
- +17 tests (
test/edit.test.ts,test/provenance.test.ts,test/edit-cli.test.ts);schema-v2/public-api-surfacesnapshots updated.
Changed — releases now publish CHANGELOG notes + an Announcements discussion
release.yml's main-package job now derives its GitHub-release notes from the curated CHANGELOG.md ## [X.Y.Z] section (via a new shared scripts/changelog-section.sh) instead of PR auto-notes, and posts a linked announcement in the public repo's Discussions Announcements category (gh release create --notes-file … --discussion-category "Announcements"; needs the new discussions: write workflow permission). scripts/sync-to-public.sh was migrated onto the same extractor so the CHANGELOG-section logic lives in exactly one place.
scripts/changelog-section.sh(new) — extract one version's CHANGELOG section;--body-onlyomits the heading. +9 tests (test/changelog-section.test.ts)..github/workflows/release.yml— release notes from CHANGELOG; Announcements discussion;discussions: write.scripts/sync-to-public.sh— reuse the shared extractor (sibling-relative resolution viaSCRIPT_DIR).
CI / release-infra only — no version bump.
Fixed — Dependabot auto-merge workflow could not read status checks
The .github/workflows/dependabot-auto-merge.yml poll loop queries the PR's statusCheckRollup, which GitHub resolves through commit.statusCheckRollup. Reading that nested rollup needs checks: read and statuses: read, but the workflow's permissions: block granted only contents: write + pull-requests: write. Under the Dependabot-context GITHUB_TOKEN (undeclared permissions default to none), the GraphQL drill-down was denied with Resource not accessible by integration, so the job failed on its first poll and every Dependabot PR fell back to manual merge (e.g. #239).
.github/workflows/dependabot-auto-merge.yml— addschecks: readandstatuses: readto the workflowpermissions:block. Norun:step or trigger change.
No library code, tests, or build outputs change — CI-infrastructure-only fix, no version bump.