AGENTS.md@packages/profile · git:20261009.95ca1ef · 2026-10-09 · sha256 c6dfc74679e6fc99

AGENTS.md@packages/profile git:20261009.95ca1efA

Immutable. This exact content never changes and is served at /api/v1/blob/c6dfc74679e6fc99.

# @shadowclone/profile

Holds the learned rule model, the legacy profile, scoped references, and the Claude memory migration. Environment and learning read and write rules through it.

<!-- package-facts:start -->

(generated by `bun run guides`; do not edit by hand)

- Package name: `@shadowclone/profile`
- Workspace dependencies: `@shadowclone/changes`, `@shadowclone/core`, `@shadowclone/redact`, `@shadowclone/sessions`, `@shadowclone/skills`
- External dependencies: `zod`
- Export subpaths: `.`, `./testing`

<!-- package-facts:end -->

## Owns

- `src/profile/`: rule parsing and rendering, evidence, `compileProfile`, `writeLegacyProfile`, and repair plans.
- `src/references/`: scoped reference records, with `readScopedReferences`, `searchReferences`, and `recallReferences`.
- `src/migrate/claudeMemory/`: `scanClaudeMemory`, `createClaudeMemoryMigrationPlan`, and `migrateClaudeMemory`.

## Rules

- A rule that the model infers needs three independent sessions (`independentSessionThreshold`). Explicit evidence can activate after one.
- References read through `resolveRedacted`, so recall returns redacted text.
- The profile compiler has a byte budget (`defaultProfileByteBudget`, `defaultIndexByteBudget`). It lists omitted rules.
- `writeLegacyProfile` takes a lock and writes through `commitLocalChanges`, so `undo` can reverse it.
- A reference file is at most 64 KiB. A memory scan reads at most 256 files and 2 MiB.
- This package keeps the legacy profile only. Active skill delivery lives in `environment`.

## Tests

Run `bun test` in this folder, or `bun test packages/profile` from the root. The `./testing` export gives `rule` and `fixture`. The tests use temporary profile folders.

Update this file in the same commit when you change the package purpose, public exports, dependencies, or a rule above.