AGENT SKILL

memex:steward:reconcile-orphan

Authorized fix-up of a flagged orphan. Four actions — delete-index (remove documents row), repair (backfill row_id when target exists), reindex (re-run Librarian; deferred), note (acknowledge). Raises OrphanNotFoundError when index_id is unknown or, for repair, already linked.

License 许可
MIT
所属仓库
nitekeeper/memex
最近更新
2026-09-22
Stars
★ 0
Forks
0

01 前言 Front Matter

name
memex:steward:reconcile-orphan
description
Authorized fix-up of a flagged orphan. Four actions — delete-index (remove documents row), repair (backfill row_id when target exists), reindex (re-run Librarian; deferred), note (acknowledge). Raises OrphanNotFoundError when index_id is unknown or, for repair, already linked.

03 SKILL.md 正文

memex:steward:reconcile-orphan

When to use

After reviewing an audit report and deciding how to resolve a specific finding, or after a consumer's bootstrap sweep detects orphan-class rows in its own store and needs to either delete the dangling Index row or backfill the link.

Inputs

  • index_id — the orphaned row's identifier
  • action — one of:
    • delete-index — remove the documents row and its relations rows (use when the target store row is gone, or when no matching target row can be found by other means)
    • repair — backfill documents.row_id from a known target PK (use when the target row exists but the link was never written — the forward-orphan class where Index committed, target committed, but the row_id write was lost). Requires repair_row_id.
    • reindex — re-run Librarian on the target row (reverse-orphan case; deferred — raises NotImplementedError)
    • note — leave as-is but record acknowledgment in ~/.memex/audits/reconciliation-log.md
  • repair_row_id (repair only) — the target store's primary-key value to bind into documents.row_id
  • note_text (note only) — free-form acknowledgment text

Errors

  • OrphanNotFoundError(index_id) — raised when index_id doesn't exist in documents (all actions), or when called with repair against a row whose row_id is already populated (i.e., not a link-missing orphan). Catch by class; the exception carries index_id and reason attributes.
  • ValueError — invalid action, missing repair_row_id, unregistered target store, or repair_row_id not present in the target table.

Audit trail

Every action writes a row to ~/.memex/audits/reconciliation-log.md (delete-index, repair, note). Reverse-orphan reindex is deferred.

Returns

{"action": "<action>", "index_id": "<id>", "result": "<removed|linked|logged>", ...}

repair additionally returns "row_id": "<repaired_row_id>".

Implementation

scripts/agents/data_steward.py:reconcile_orphan(). Reverse-orphan reindex raises NotImplementedError until Plan 4 re-embedding tooling lands.

04 同仓库更多 Skills

nitekeeper
nitekeeper/memex

run

Use to invoke any Memex v2.0 operation. Routes user-facing intents (ingest, ask, capture, lint, synthesize, dashboard) and agent-facing CRUD primitives to the right internal procedure.

★ 0
nitekeeper
nitekeeper/memex

memex:steward:dashboard

Launch a loopback-only, read-only HTTP dashboard over Memex — per-store summary, the federated index, knowledge communities, the code-navigation graph, and the agent registry, plus keyword search, a click-to-read content overlay, and an interactive 3D knowledge-graph view.

★ 0
nitekeeper
nitekeeper/memex

memex:steward:audit

Run a full integrity audit across the Memex Index and all registered stores. Detects orphans, broken relations, schema drift. Writes a structured audit report to ~/.memex/audits/. Read-only — never auto-fixes.

★ 0
nitekeeper
nitekeeper/memex

memex:steward:audit-store

Run an integrity audit scoped to a single registered store (reverse orphans + schema drift). Lighter than full audit.

★ 0
nitekeeper
nitekeeper/memex

memex:index:write

Direct write to the federated Index — the lower-level primitive that memex:brain:ingest and memex:brain:capture build on. Use when a consumer (Atelier, custom plugin) needs to add a document to its own store and have it indexed by the Librarian, without going through the Brain layer. Routes through Librarian subagent + Memex Core.

★ 0
nitekeeper
nitekeeper/memex

memex:index:search

Federated search across every registered Memex store via the Reference Librarian. Lower-level primitive that memex:brain:ask builds on — use directly when a consumer (Atelier, custom plugin) needs raw query results without Brain-specific formatting.

★ 0