feat(monorepo): import repo-memory runtime

This commit is contained in:
2026-03-20 13:20:28 +08:00
parent b6e524de41
commit 388c25b1b0
20 changed files with 2461 additions and 10 deletions
+70
View File
@@ -0,0 +1,70 @@
# Repo Memory Skill Test Plan
## Purpose
This directory tracks human-readable test plans for the `skills/repo-memory/`
Codex skill bundle.
These documents are not package-level unit tests for `briefdb`.
Those live with the runtime under `packages/repo-memory-runtime/`.
This directory covers a different surface:
- whether an agent can actually use the packaged `repo-memory` skill
- whether the bundled `./assets/briefdb` CLI works inside real skill-guided
repository work
- whether durable repository knowledge is stored and retrieved correctly
## Test Model
- `README.md` is the index for this directory
- each skill test case lives in its own Markdown file
- use stable case slugs in filenames
## Shared Execution Contract
Use these defaults unless a case file explicitly overrides them:
- run the scenario with one real agent using the bundled `repo-memory` skill
- create an isolated temporary directory, repository fixture, and SQLite DB path
- require the agent to use the bundled `./assets/briefdb` CLI instead of ad hoc
notes
- validate final database state independently from the main thread after the
agent stops
## Per-Case Template
Each case file should use this structure:
- `Test Type`
- `Purpose`
- `Preconditions`
- `Inputs`
- `Execution Parameters`
- `Execution Steps`
- `Validation Commands`
- `Expected Outcomes`
- `Assertions`
- `Cleanup`
- `Recorded Example Run` when a real run has already been captured
## Case Files
| Case Slug | File | Coverage Note |
| --- | --- | --- |
| `search-and-add-through-bundled-cli` | [search-and-add-through-bundled-cli.md](./search-and-add-through-bundled-cli.md) | validates that an agent can miss on search, add one durable entry, then retrieve it through the packaged `repo-memory` skill |
## Scope
In scope:
- explicit `$repo-memory` skill invocation
- bundled `./assets/briefdb` CLI usage
- durable knowledge add/search/list/event flows
- package-backed SQLite memory database behavior as surfaced through the skill
Out of scope:
- package-level unit tests for `briefdb`
- future auto-export flows such as `repo-brief` generation
- implicit skill triggering without `$repo-memory`
@@ -0,0 +1,70 @@
# Search And Add Through Bundled CLI
## Test Type
- forward skill execution
## Purpose
- validate that a single agent can use `skills/repo-memory/` to search an empty
memory DB, write one durable entry through the bundled CLI, and retrieve the
same knowledge afterwards
## Preconditions
- `skills/repo-memory/assets/briefdb` exists and is executable
- the test runner can create a temporary Git repository fixture
- the test runner can create a temporary SQLite DB path
## Inputs
- `SKILL_PATH=/.../skills/repo-memory`
- `TMPDIR=/tmp/...`
- `DB_PATH=TMPDIR/repo-memory.db`
- `REPO_PATH=TMPDIR/repo-fixture`
## Execution Parameters
- one agent only
- per-agent timeout: `3m`
- overall timeout: `4m`
## Execution Steps
1. Create a temporary Git repository fixture under `REPO_PATH`.
2. Add one file that will serve as evidence for the durable knowledge entry.
3. Ask the agent to use `$repo-memory` against `DB_PATH`.
4. Have the agent initialize the DB, search for a key that does not yet exist,
add one `term` entry with evidence, then search again for the same key.
5. Capture the agent summary and the concrete entry key used.
## Validation Commands
Run these from the main thread after the agent stops:
```bash
SKILL_PATH/assets/briefdb init --db DB_PATH
SKILL_PATH/assets/briefdb search --db DB_PATH --repo REPO_PATH --query "plan task"
SKILL_PATH/assets/briefdb list --db DB_PATH --repo REPO_PATH --kind term
SKILL_PATH/assets/briefdb events --db DB_PATH --id 1
```
## Expected Outcomes
- the first search misses before the entry is written
- the `add` command succeeds and creates entry `1`
- the second search returns the new `term`
- `list` returns exactly one `term` entry for the fixture repo
- `events` includes a `created` event for the new entry
## Assertions
- the stored entry key matches the one the agent added
- the stored entry summary matches the durable fact the agent recorded
- the stored entry is linked to the target repo path
- the agent used the bundled CLI rather than free-form notes
## Cleanup
- keep the temporary DB and repo on failure
- remove temporary artifacts on success only if replay evidence is not needed