Thanks for helping improve codemem.
pnpm install
pnpm run codemem --help
This repo is TypeScript-first. The legacy Python runtime has been removed from main; use git history or the archive ref if you need to inspect the old implementation.
Run these before opening a PR:
pnpm run lint
pnpm run tsc
pnpm run test
pnpm build
Targeted test examples:
pnpm exec vitest run packages/cli/src/commands/serve.test.ts
pnpm exec vitest run packages/viewer-server/src/index.test.ts
pnpm exec vitest run packages/core/src/index.test.ts
When changing pack retrieval, context injection, or the adapter surfaces
that inject memory into an agent's prompt, the following suites cover
the relevant behavior. Run the targeted one first, then pnpm run test
before opening a PR.
| Concern | Command |
|---|---|
| Core pack invariants (section selection, dedupe, token budget, recall vs default mode) | pnpm exec vitest run packages/core/src/pack.test.ts |
| Pack usefulness evals (recall / task / continuation / working-set ranking) | pnpm exec vitest run packages/core/src/pack.eval.test.ts |
| OpenCode adapter prompt-time injection (transform, cache, toast, failure paths) | pnpm --filter codemem run test:plugin |
| Claude hook context injection (PreToolUse / UserPromptSubmit) | pnpm exec vitest run packages/core/src/claude-hooks.test.ts |
CLI manual injection contract (codemem pack, codemem memory inject) |
pnpm exec vitest run packages/cli/src/commands/pack.test.ts packages/cli/src/commands/memory-inject.test.ts |
Shared fixture corpus for pack / usefulness evals lives at
packages/core/src/pack-eval-fixtures.ts — extend it rather than
inlining ad-hoc test data when adding new ranking scenarios.
- Viewer UI source is
packages/ui/and is served bypackages/viewer-server/. - OpenCode plugin source is
packages/opencode-plugin/.opencode/plugins/codemem.js. - If you change the UI or viewer assets, rebuild first so
packages/viewer-server/static/is restaged:
pnpm --filter @codemem/ui build
- Then restart the viewer if needed:
pnpm run codemem serve restart
Releases are tag-driven (vX.Y.Z) and run via .github/workflows/release.yml.
Before tagging:
- Create a release branch and PR. Do not push release changes directly to
main. - Bump the shared version fields listed in
docs/versioning.md. - Regenerate JS artifacts and lockfiles:
pnpm installpnpm build
- Wait for CI to pass and merge the release PR.
- Switch to updated
main, verifyHEADis the merged release commit, and confirm the worktree is clean. - Tag from
mainand push the tag:
git tag vX.Y.Z
git push origin vX.Y.Z
Verify release version alignment and tag safety before tagging:
pnpm run release:version -- check
pnpm run release:preflight-tag
- Keep README focused on user onboarding.
- Put advanced operational details in
docs/. - If behavior changes, update the related docs in the same PR.