Skip to content

Re-export the TinyMemory contract instead of duplicating it (tinymemory#18 §A1) - #149

Open
YellowSnnowmann wants to merge 1 commit into
tinyhumansai:mainfrom
YellowSnnowmann:feat/18-a1-reexport-the-tinymemory-contract
Open

Re-export the TinyMemory contract instead of duplicating it (tinymemory#18 §A1)#149
YellowSnnowmann wants to merge 1 commit into
tinyhumansai:mainfrom
YellowSnnowmann:feat/18-a1-reexport-the-tinymemory-contract

Conversation

@YellowSnnowmann

Copy link
Copy Markdown
Contributor

Implements the tinycortex half of tinyhumansai/tinymemory#18 §A1.

The problem

This crate and tinymemory-api describe the same memory value types — MemoryEntry, MemoryCategory, MemoryTaint, NamespaceSummary, RecallOpts, Capability, the provider::types set. Not by coincidence: tinymemory-api was extracted from this crate and held byte-identical. types.rs differs between them by 14 lines, and every one is a doc comment, a doctest path, or a single extra parse arm.

They are the same code and nominally distinct types. So adapters/tinycortex/src/convert.rs in tinymemory translates between them on every call, and a field added to one has to be added to the other and to the conversion — three places, or a value is silently dropped.

The change

api/ re-exports tinymemory-api and defines nothing of its own. 33 files deleted; lib.rs is the re-export.

Every existing path still resolves. tinycortex_api::types::MemoryEntry now is tinymemory_api::types::MemoryEntry, so no dependant needs an edit to gain the single type set — and convert.rs downstream collapses to identity.

Two deliberate changes, checked against the engine first

Change Why it is safe
Capability vocabulary 13 → 18 families the engine matches on Capability in zero places
CONTRACT_VERSION (1,0) → (2,2) the engine never reads it, and (1,0) was already stale — hosts bind against the contract

The enums the engine does match on are variant-identicalMemoryCategory (16 sites) and MemoryTaint (9 sites) — so no match arm changes. I checked this before writing the re-export rather than after.

Why publish = false

The dependency is by git, and cargo refuses a git dependency in a published crate.

This records the state the repository has actually been in rather than changing it. Since api/ was split out, publishing has been broken:

$ cargo package -p tinycortex --no-verify
error: failed to prepare local package for uploading
Caused by:
  no matching package named `tinycortex-api` found
  location searched: crates.io index
  required by package `tinycortex v0.1.1`

tinycortex-api was never published, and tinycortex main depends on it by path + version. The last release (0.1.1, 29–30 June, 54 downloads) predates the split, so the release workflow would fail the next time it ran.

A host that vendors both crates patches the git entry to its own checkout — as tinymemory's workspace root does — so a build never resolves two copies of the contract.

Validation

From a clean clone at 5fdeac9:

Command Result
cargo check --workspace --all-targets clean
cargo test --workspace 1259 passed, 0 failed
cargo fmt --all -- --check clean
cargo clippy --all-targets -- -D warnings (the ci.yml gate) clean — 0 before, 0 after
cargo clippy --workspace --all-targets --all-features -- -D warnings 6 before, 6 after

Those 6 are pre-existing, in persona/ and sync/composio/, and untouched here — I measured the baseline on the unmodified commit rather than assuming.

Merge order

tinymemory's companion change — deleting convert.rs and simplifying the adapter — depends on this landing first, since it needs the gitlink bumped to a commit that carries the re-export.

tinymemory#18 §A1. This crate and `tinymemory-api` described the same memory
value types — `MemoryEntry`, `MemoryCategory`, `MemoryTaint`, `NamespaceSummary`,
`RecallOpts`, `Capability`, the `provider::types` set — because the latter was
extracted from the former and held byte-identical. They were the same code and
nominally distinct types, so `adapters/tinycortex/src/convert.rs` in tinymemory
had to translate between them on every call, and a field added to one had to be
added to the other and to the conversion, in three places, or a value was
silently dropped.

`api/` now re-exports `tinymemory-api` and defines nothing of its own: 33 files
deleted, `lib.rs` left as the re-export. Every existing path still resolves —
`tinycortex_api::types::MemoryEntry` now *is* `tinymemory_api::types::MemoryEntry`
— so no dependant needs an edit to gain the single type set.

Two things change on purpose, both checked against the engine before doing this:

- The capability vocabulary grows from thirteen families to eighteen. The engine
  matches on `Capability` in zero places, so nothing here is affected.
- `CONTRACT_VERSION` becomes the contract's `(2, 2)` rather than this crate's
  `(1, 0)`. That value was already stale — hosts bind against the contract, and
  the engine never reads it.

The enums the engine *does* match on are variant-identical (`MemoryCategory` at
16 sites, `MemoryTaint` at 9), so no match arm changes.

The dependency is by git, which requires this crate not to publish — hence
`publish = false` here and on the engine. That records the state the repository
has actually been in rather than changing it: since `api/` was split out,
`cargo package -p tinycortex` has failed with `no matching package named
'tinycortex-api' found`, because that crate was never published. The last
release predates the split. A host that vendors both patches the git entry to
its own checkout, so a build never resolves two copies.

Validation, all from a clean clone at 5fdeac9:

- `cargo check --workspace --all-targets` — clean
- `cargo test --workspace` — 1259 passed, 0 failed
- `cargo fmt --all -- --check` — clean
- `cargo clippy --all-targets -- -D warnings` (the CI gate) — clean, 0 before and after
- `cargo clippy --workspace --all-targets --all-features -- -D warnings` — 6 errors
  before and 6 after, all pre-existing in `persona/` and `sync/composio/` and
  untouched by this change

Refs tinyhumansai/tinymemory#18 (§A1)
@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Caution

Review failed

An error occurred during the review process. Please try again later.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@tinysweeper tinysweeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

tinysweeper found nothing blocking. Approving.

$0.0000 · 0 in / 0 out · 716 embedded · openrouter/openai/text-embedding-3-small

@tinysweeper tinysweeper Bot added the priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect. label Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant