Skip to content

A palace without vectors: lexical code ingestion for a coding agent - #90

Merged
ascalva merged 13 commits into
mainfrom
feat/palace-lite
Nov 12, 2026
Merged

ascalva merged 13 commits into
mainfrom
feat/palace-lite

Conversation

@ascalva

@ascalva ascalva commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

The palace can now run with no embedder, per instance or per source, and its first lite instance lands this repository's files for a coding agent to query over MCP: 2,021 files in 10.9 s, 111 MB, no vector, no model, and kept current by the repository's own hooks.

Abstract

A knowledge store that lands every item through one writer can make the embedding of an item a derived field, written after the item lands. This change makes it optional: an instance may embed nothing at all ([embedding] enabled = false), and within an instance that embeds, a single source may keep no vectors ([ingestion.code] embed = false). The writer decides per item whether its plane rows are written before its key, deferred to a drain, or never written, and the query engine ranks every item without a vector by a BM25 index over the same chunks, labelling each such answer. The first deployment is a code instance that lands the files of a git repository at a ref, read through git's object store. It ingests the 2,021 files of this repository (27,059 lexical units) in 10.9 s with a peak resident memory of 271 MB and 111 MB on disk, and re-syncs after a commit in 2.6 s. On eleven lookups with answers declared before the run it ranks a correct file in its top five for 8; ripgrep's output holds a correct file for all 11 but prints a median of 8 files to open. A query takes a median of 163 ms warm, against 50 ms for ripgrep, and the MCP server answers its first query 1.30 s after it is spawned, at 168 MB.

The article

papers/2026-11-09-palace-lite/paper.tex (6 pages): the two switches and the writer's predicates, a repository as a source, the verbs without vectors, the measurements, and the proposed shared embedding service (priority classes, per-instance deficit round robin, backpressure, the embedder's fingerprint on every request) and slim install. The design note is docs/design-notes/dn-palace-lite.md; the measurements are docs/experiments/palace-lite-2026-11-09.md.

What changes

  • The switches (core/kernel/config/loader.py): [embedding] enabled, [ingestion.code] embed and [[ingestion.code.repositories]] (name, path, ref; none declared is the checkout at main); lexical_code and needs_lexical. [instance] root lets a named instance hold its state outside every checkout and worktree (absolute, refused inside a git working tree, refused for the default chain).
  • No embedder, no plane (core/stores/noplane.py): build_embedder, open_vector_store and open_curated_store refuse an instance that embeds nothing (EmbeddingOff); the writer, the query engine and the MCP counts get NoPlane, which reads empty and refuses writes.
  • The writer (core/ingest/writer.py): keeps_vectors, embeds_now and lexical_witness decide per store; a store that keeps no vector lands as a lazy one does (ING-19) and asks for no drain.
  • A repository source (core/ingest/repository.py, core/ingest/readers.py, core/ingest/table.py, ingress/sync_repository.palace): a ref's tree read through git's object store, never the working tree and never the network; items at code/<name>/<path> in a new reference place with version chains; foundation paths, tool directories, symlinks and binaries left out; the landed commit marked.
  • The sentence engine (core/sentence/universe.py, execute.py, core/query.py): vectorless nodes beside pending ones, ranked lexically and labelled (ranked_by: lexical: the item keeps no vector); near ... over reference seeds the lexical index's code units; read of a landed file reads the raw store; a version chain's hit carries its ref's stratum. With nothing vectorless, the two-phase wording is unchanged.
  • Operations: palace repo-sync (under the supervisor lock, refused beside a live daemon, batched on a first sync, --if-landed for hooks); a repository_sync queue kind the daemon's housekeeping and catch-up run instead of the code embed lane when the code keeps no vectors; palace start refuses an instance that embeds nothing; palace embed and the embed job say there is nothing to derive; the MCP overview reports embedding off, the lexical units and how far each repository is behind its ref, and status never probes an embedder that does not exist.
  • Freshness: .githooks/post-merge (new) and .githooks/post-commit run repo-sync --if-landed for the code instance on main.
  • The instance: config/instances/code.toml, root ~/.mind-palace/instances/code, this repository at main, no embedder, no scheduled model, no secrets, effectors, backup or attestation keys.
  • Measurement: eval/palace_lite.py (lookups against ripgrep, and --mcp).
  • Tests: tests/integration/test_palace_lite.py (16, one of them the lexical re-derivation below) and a daemon-wiring test; four existing tests updated for the new key, kind, script and inner-ring member.

The default instance's configuration does not change. To land its code without embedding later, its overlay's [ingestion.code] becomes enabled = true with embed = false.

Gates

  • uv run ruff check .: all checks passed.
  • uv run mypy core agents eval ops scheduler scripts: no issues in 359 files; the whole repository holds its baseline of 67, all in tests/.
  • uv run python scripts/check_imports.py: OK.
  • The deterministic tier, before the rebase (uv run pytest -q -p no:cacheprovider -m 'not live and not podman and not needs_vault and not needs_restic' --deselect tests/unit/test_core_self_containment.py::test_core_imports_nothing_outside_core): 3,596 passed, 11 skipped, 21 deselected. After the rebase the README says 3,651 by arithmetic (main's 3,633 plus this branch's 18: the 17 it had and the re-derivation test); CI's ratchet prints the count. After the fix commit: tests/integration/test_palace_lite.py, test_two_phase_ingestion.py and test_corpus_ingest.py 52 passed, the tests selected by -k "lexical or derive or embed" 149 passed, ruff and mypy clean on the changed files.
  • formal/check.sh: not run; formal/ and docs/LAWS.md are untouched (no law changes; ING-19 is the landing of every store here).
  • The article builds with scripts/build_papers.sh: 6 pages, no error, undefined reference, overfull box or BibTeX warning.

Notes

  • The MCP command line, from a checkout: MIND_PALACE_OVERLAY=config/instances/code.toml uv run --project <checkout> python <checkout>/scripts/palace_mcp.py. The read-only guest principal (a parallel branch) removes the write tools once it merges.
  • The code instance has no citation graph yet (reach F is empty there): the code sensor observes every commit of the history, several gigabytes on the default instance; observing the landed commit alone is a follow-up. The tokenizer splits identifiers at underscores; Embedder use: six choices measured, and a normalizing tokenizer with an identity #88's tokenizer identity has merged, so a code tokenizer is now a follow-up of its own.
  • Rebased onto main f969904e. The twelve commits replayed with the same messages; README.md, ops/lifecycle/launcher.py and scheduler/embed.py conflicted with main's lexical backfill (derive_lexical before the vector drain, from the embedder study). The rebase showed a gap the two changes made together, fixed in fix(ingest): an instance that embeds nothing re-derives its lexical index: the embed job and palace embed returned before the backfill when embedding is off, and the backfill's classes were the plane's, which leave out the code. On an instance that embeds nothing, a tokenizer change would have left the index stale, refusing to land or to score, with the code's units never re-derived. The backfill now runs whatever the embedding switch says and covers the code's class (LEXICAL_CLASSES); the new test fails without the commit.
  • Timings were taken in a window with no other busy process (one-minute load 1.8 to 2.2); other agents' formal checks and test suites ran before and after it.

Merge order

Rebased onto f969904e (#84, #86, #87, #88 and #91 merged). The open guest-principal PR (#89) touches agents/ambassador/mcp.py, core/ingest/ingress.py, core/query.py and core/sentence/universe.py; the README's tests badge conflicts with every PR that counts tests.

🤖 Generated with Claude Code

ascalva and others added 13 commits November 11, 2026 18:58
…out vectors

The lite profile needs three switches the loader did not have.

`[embedding] enabled = false` names an instance that embeds nothing: no
embedder is built, no plane is opened and every item lands lexically.
`[ingestion.code] embed = false` is the same choice for the code source
alone, so an instance can keep vectors for its notes while its code
lands lexically; `[[ingestion.code.repositories]]` lists the
repositories that source reads, each a name, a path and a ref (none
declared is the checkout at `main`). `lexical_code` and `needs_lexical`
say when the code lands through the ingress and when an instance keeps
a lexical index.

`[instance] root` lets a named instance hold its state outside the
checkout it runs from: absolute, and refused inside any git working
tree, since a worktree is removed when its branch merges. The default
chain refuses the key; the sharing checks hold against a declared root
as against a derived one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… rows

A store of a source that keeps no vectors, or of an instance that
embeds nothing, now lands as a lazy store lands (raw object, lexical
units, version, attestation, key) and stays so: the writer charges no
embedding, writes no plane row and asks no drain for it
(`Writer.keeps_vectors`, from `Source.embed` and `[embedding] enabled`).

The table gains a `reference` place (the reference stratum, versions
kept) and a `repository` source kind: a git repository's files at a
ref, read through git's object store and never the working tree, each
item at `code/<name>/<path>`, labelled code. Foundation paths, tool
directories and binary blobs are not items; git is told never to
fetch. `ingress/sync_repository.palace` lands the tree and retires a
file the ref no longer has, and the view records the commit once every
file of it has been stored.

An instance that embeds nothing is handed `NoPlane`, an empty plane
that refuses writes, and the factories that would build an embedder or
open a plane refuse by name (`EmbeddingOff`).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An instance that embeds nothing has no embedder for a `near` text, so
the universe gives the text the zero vector and calls nothing; the
query engine hands out `NoPlane` for the plane and the curated store.
Items that keep no vector are nodes marked `unembedded`, beside the
pending ones of two-phase ingestion: `near` ranks both by the lexical
index, and each hit's `ranked_by` (a field's or a region's) and the
notes say which it is: pending, a vector will come; none, the instance
or its source keeps none. A clause with nothing vectorless keeps the
two-phase wording.

A `near` over the reference stratum also seeds the files of the
lexical index's best code units, so a repository source's files are
found without a vector. An anchor that is such a file takes its
catalog title and digest; `read` of one reads its landed bytes from
the raw store, windowed as a repo file is; a version chain's hit
carries its ref's stratum.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`palace repo-sync` lands each configured repository through the
writer, under the instance's supervisor lock and refused beside a live
daemon; a first sync, a plan of fresh stores on distinct paths, lands a
stage at a time, and the receipt's stage timings are printed. The
daemon gets a `repository_sync` kind (pinned, idempotent, background)
that its housekeeping and catch-up enqueue in place of the code embed
lane and its backfill when the code keeps no vectors, so an instance
that turns `[ingestion.code] embed = false` on keeps its code current
with no embedder call.

An instance that embeds nothing runs no daemon (the daemon wires the
embedder's consumers), its embed job and `palace embed` report that
there is nothing to derive, and the MCP surface never probes an
embedder for it: `overview` says embedding is off and counts the
lexical units and how far each repository is behind its ref.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`core.stores.noplane` imports the standard library alone, so the inner
ring claims it (49 + 1 = 50). The coalescing kinds include
`repository_sync`; the library scripts' table gives `sync_repository`
its argument; and the `[instance]` table's refusal cases are a key it
does not hold and a relative root, now that it holds a named
instance's absolute root.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`config/instances/code.toml` is the first lite instance: source
repositories for a coding agent to query over MCP. It embeds nothing,
schedules no model, keeps no secrets or effectors, and reads the
repository through git at `main`. Its state lives under its declared
root, `~/.mind-palace/instances/code`, outside every checkout and
worktree, so it outlives the one a process runs from.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The repository already observes each commit on main through
`.githooks/post-commit`. A pull that fast-forwards main commits
nothing locally, so `.githooks/post-merge` runs the code instance's
`repo-sync` after every merge or pull on main, and the post-commit
hook does the same after a commit there. Both run
`repo-sync --if-landed`, which opens nothing until the instance has
landed once, so its first sync stays the operator's; neither ever
blocks the merge or the commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An instance that embeds nothing lands a repository, re-lands nothing,
lands a changed file as a new version, retires a deleted one and marks
the commit, while constructing an embedder, an inference client or a
vector store fails the test; `near`, `read`, `trace`, `reach` and
`diffuse` answer over it, and a vault note lands and ranks lexically
too. A repository source reads the ref, never the working tree, and
never lands the foundation's paths, a binary or a symlink. In an
instance that embeds, the code keeps no vectors while a note keeps its
own, and a lazy landing asks no drain for the code. The default
instance's configuration and table are what they were; a declared root
is absolute and outside every working tree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he lane

With `[ingestion.code] embed = false` the daemon's housekeeping and
catch-up enqueue `repository_sync` and neither the code embed lane nor
its history backfill; with the code lever off they enqueue none of the
three.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`eval/palace_lite.py` asks eleven questions with known answers of a
code instance through the sentence engine (`top 5 near ... over
reference`), cold and warm, and asks ripgrep the pattern an agent would
type over a checkout of the same commit: whether the answer is in the
palace's top five, whether ripgrep's files hold it and how many it
prints, and the times. A twelfth asks a file's history of `trace` and
of `git log`. `--mcp` spawns the MCP server as a client does and
times `initialize` and two queries, with the peak resident memory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dn-palace-lite records the profile (the language model optional, the
embedder optional), what each verb does without a vector, the code
instance as its first deployment and how it stays current, the lines
that would land the default instance's code without embedding, the
measured footprint, and two proposals not built: one shared embedding
service with a queue in front of the server (interactive queries, then
landings, then backfills; per-instance fairness; backpressure) and a
slim install for small devices. The measurements are recorded as
aggregates; the article is papers/2026-11-09-palace-lite.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…adge

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ndex

Rebasing onto main brought main's lexical backfill (a tokenizer change resets the index and the
embed job lands every item again) together with this branch's profile that embeds nothing, and
the two did not meet. The job and `palace embed` returned before the backfill when embedding is
off, and the backfill's classes were the plane's, which leave out the code. On an instance that
embeds nothing a tokenizer change would leave the index stale, refusing to land or to score, and
the code's units would never come back.

The backfill now runs whatever the embedding switch says, and only the vector drain is skipped;
its classes are the plane's and the code's (`LEXICAL_CLASSES`). `palace embed` refuses a live
daemon before it opens the stores, since it now writes the index. A test lands a repository under
one tokenizer, opens the index under another, and checks that the job re-derives every item and
constructs no embedder and no vector store; it fails on the rebased code without this commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant