soba-agent 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "soba-agent",
3
+ "version": "0.4.0",
4
+ "description": "Bun-first CLI coding agent with terminal UI, proactive context management, skills, project memory, and MCP support.",
5
+ "type": "module",
6
+ "private": false,
7
+ "license": "UNLICENSED",
8
+ "packageManager": "bun@1.3.14",
9
+ "bin": {
10
+ "soba": "bin/soba.js"
11
+ },
12
+ "files": [
13
+ "bin/",
14
+ "dist/",
15
+ "skills/",
16
+ "src/audio/",
17
+ "README.md",
18
+ "package.json"
19
+ ],
20
+ "engines": {
21
+ "bun": ">=1.2.0"
22
+ },
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
26
+ "scripts": {
27
+ "dev": "bun run src/cli.ts",
28
+ "build": "bun run scripts/build.ts",
29
+ "build:binary": "bun run scripts/build-binary.ts",
30
+ "build:binary:mac-arm64": "bun run scripts/build-binary.ts bun-darwin-arm64",
31
+ "build:binary:linux-x64": "bun run scripts/build-linux-x64-binary.ts",
32
+ "lint": "biome check .",
33
+ "lint:fix": "biome check --write .",
34
+ "format": "biome format --write .",
35
+ "test": "bun test",
36
+ "prepack": "bun run build"
37
+ },
38
+ "devDependencies": {
39
+ "@biomejs/biome": "^2.4.16",
40
+ "@types/bun": "latest",
41
+ "biome": "^0.3.3",
42
+ "ts-morph": "^28.0.0",
43
+ "typescript": "^5.9.3"
44
+ },
45
+ "dependencies": {
46
+ "@opentui/solid": "^0.4.1",
47
+ "solid-js": "1.9.12",
48
+ "zod": "^4.4.3"
49
+ }
50
+ }
@@ -0,0 +1,61 @@
1
+ ---
2
+ name: bug-fix
3
+ description: Diagnose, patch, and verify a bug with minimal scoped changes.
4
+ soba:
5
+ version: 1
6
+ triggers:
7
+ - bug fix
8
+ - failing behavior
9
+ - regression
10
+ memory-policy: read-write
11
+ ---
12
+
13
+ # Bug Fix
14
+
15
+ ## Purpose
16
+
17
+ Fix a reported defect by reproducing or localizing the failure, applying the smallest correct change, and verifying the result.
18
+
19
+ ## Triggers
20
+
21
+ Use this skill when the user reports broken behavior, failing tests, runtime errors, regressions, or asks to patch a defect.
22
+
23
+ ## Inputs To Inspect
24
+
25
+ - Project instructions.
26
+ - The failing command, stack trace, log, or reproduction steps.
27
+ - Relevant source files and adjacent tests.
28
+ - Existing issue-specific docs or comments.
29
+ - Project memory only as a hypothesis, never as proof.
30
+
31
+ ## Procedure
32
+
33
+ 1. Read project instructions and identify the expected verification workflow.
34
+ 2. Reproduce the failure when practical, or inspect the provided failure evidence.
35
+ 3. Trace from symptom to the smallest responsible code path.
36
+ 4. State the fix intent before changing files.
37
+ 5. Apply a minimal patch that addresses the cause, not only the symptom.
38
+ 6. Add or update a focused test when the defect is not already covered and the project has a test pattern.
39
+ 7. Run the targeted verification first, then broader checks when the change touches shared behavior.
40
+
41
+ ## Verification Contract
42
+
43
+ The failing scenario must pass after the fix, and the final response must name the command or evidence that verifies it. A code mutation cannot finish as complete without successful verification unless the user explicitly accepts unverified changes.
44
+
45
+ ## Failure Recovery
46
+
47
+ If the first fix fails, use the new failure as diagnostic evidence, narrow the hypothesis, and avoid repeating the same command without a changed input or changed hypothesis. If the failure cannot be reproduced, state what evidence was inspected and what remains uncertain.
48
+
49
+ ## Memory Policy
50
+
51
+ Write memory only after a verified fail-then-fix pattern reveals a stable project-specific lesson. Never store secrets, one-off stack traces, or speculative causes.
52
+
53
+ ## Stop Conditions
54
+
55
+ Stop when the defect is fixed and verified, when the requested reproduction is impossible due to missing external state, or when the user decision is required.
56
+
57
+ ## Anti-Patterns
58
+
59
+ - Do not broaden the patch into unrelated refactors.
60
+ - Do not mark completion from reasoning alone.
61
+ - Do not ignore a failing verification command after the change.
@@ -0,0 +1,61 @@
1
+ ---
2
+ name: code-review
3
+ description: Review code changes with findings first and no file mutation unless explicitly requested.
4
+ soba:
5
+ version: 1
6
+ triggers:
7
+ - code review
8
+ - review diff
9
+ - inspect changes
10
+ memory-policy: none
11
+ ---
12
+
13
+ # Code Review
14
+
15
+ ## Purpose
16
+
17
+ Find concrete bugs, regressions, missing tests, and maintainability risks in code changes.
18
+
19
+ ## Triggers
20
+
21
+ Use this skill when the user asks for a review, asks to inspect a diff, or asks whether a change is ready.
22
+
23
+ ## Inputs To Inspect
24
+
25
+ - Project instructions.
26
+ - The requested diff, files, branch, or commit range.
27
+ - Nearby tests and contracts for changed behavior.
28
+ - Build or verification output when provided.
29
+ - Public API or schema changes touched by the diff.
30
+
31
+ ## Procedure
32
+
33
+ 1. Read project instructions first.
34
+ 2. Inspect the changed files and nearby tests before forming findings.
35
+ 3. Prioritize defects that can affect users, data, security, compatibility, or CI.
36
+ 4. Present findings first, ordered by severity, with file and line references.
37
+ 5. Include open questions only when they materially affect correctness.
38
+ 6. Add a short summary after findings, not before them.
39
+ 7. Do not modify files unless the user explicitly asks for a patch.
40
+
41
+ ## Verification Contract
42
+
43
+ Every finding must point to inspected code and explain the concrete failing scenario. If no issues are found, say that clearly and name residual test gaps or risk.
44
+
45
+ ## Failure Recovery
46
+
47
+ If the diff is missing, inspect git status or ask for the target range. If line references are unstable, cite the smallest function or file context and explain the affected logic.
48
+
49
+ ## Memory Policy
50
+
51
+ Memory capture is out of scope for review findings. Read memory only if it is already available and contains a known project review convention.
52
+
53
+ ## Stop Conditions
54
+
55
+ Stop after delivering findings-first review output, or after identifying that the requested diff or files are unavailable.
56
+
57
+ ## Anti-Patterns
58
+
59
+ - Do not lead with praise or a summary before findings.
60
+ - Do not nitpick style when correctness issues exist.
61
+ - Do not modify files during a review unless explicitly requested.
@@ -0,0 +1,60 @@
1
+ ---
2
+ name: codebase-orientation
3
+ description: Build a focused map of an unfamiliar codebase before changing it.
4
+ soba:
5
+ version: 1
6
+ triggers:
7
+ - codebase orientation
8
+ - unfamiliar repository
9
+ - architecture scan
10
+ memory-policy: read
11
+ ---
12
+
13
+ # Codebase Orientation
14
+
15
+ ## Purpose
16
+
17
+ Create a concise, evidence-based map of the repository so subsequent work starts from real project structure instead of assumptions.
18
+
19
+ ## Triggers
20
+
21
+ Use this skill when the user asks to understand a codebase, start a new area of work, explain architecture, or make changes in an unfamiliar repository.
22
+
23
+ ## Inputs To Inspect
24
+
25
+ - Project instructions.
26
+ - README and phase or design docs that match the request.
27
+ - Package scripts and runtime configuration.
28
+ - Source directory layout.
29
+ - Tests that cover the requested area.
30
+ - Recently changed files when the request follows ongoing work.
31
+
32
+ ## Procedure
33
+
34
+ 1. Read project instructions first.
35
+ 2. Inspect top-level structure and identify the likely ownership boundary for the task.
36
+ 3. Read only the docs, source files, and tests needed to understand that boundary.
37
+ 4. Summarize the module roles, data flow, commands, and risk areas.
38
+ 5. Name the next implementation or verification step when the user asked for action.
39
+
40
+ ## Verification Contract
41
+
42
+ The orientation summary must cite inspected files or commands and must distinguish confirmed facts from assumptions. It must not claim behavior that was not observed in source, tests, or docs.
43
+
44
+ ## Failure Recovery
45
+
46
+ If the repository lacks docs, inspect package scripts, entry points, and tests. If multiple architectures are plausible, state the competing hypotheses and read one more targeted file for each before deciding.
47
+
48
+ ## Memory Policy
49
+
50
+ Read memory as a hypothesis when available. Do not write memory unless a stable project convention is verified across source and tests.
51
+
52
+ ## Stop Conditions
53
+
54
+ Stop when the user has a usable map of the requested area or when missing files, missing dependencies, or inaccessible generated artifacts block accurate orientation.
55
+
56
+ ## Anti-Patterns
57
+
58
+ - Do not scan the entire repository without a task boundary.
59
+ - Do not summarize directory names as architecture without reading representative files.
60
+ - Do not start implementation before project instructions and relevant tests are understood.
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: commit-message
3
+ description: Generate conventional commit messages from staged changes.
4
+ soba:
5
+ version: 1
6
+ triggers:
7
+ - commit message
8
+ - staged changes
9
+ - conventional commit
10
+ memory-policy: none
11
+ ---
12
+
13
+ # Commit Message
14
+
15
+ ## Purpose
16
+
17
+ Generate concise, accurate conventional commit messages from the changes that are already staged.
18
+
19
+ ## Triggers
20
+
21
+ Use this skill when the user asks for a commit message, wants conventional commit wording, or asks to summarize staged changes for a commit.
22
+
23
+ ## Inputs To Inspect
24
+
25
+ - Project instructions for commit style.
26
+ - `git diff --cached --stat`.
27
+ - `git diff --cached`.
28
+ - Recent commit style when project instructions are silent.
29
+
30
+ ## Procedure
31
+
32
+ 1. Confirm that staged changes exist.
33
+ 2. Inspect the staged diff and identify the dominant change type: `feat`, `fix`, `docs`, `test`, `refactor`, `chore`, `perf`, `build`, or `ci`.
34
+ 3. Choose a scope only when the project has a clear module or package boundary.
35
+ 4. Write a subject in imperative mood, without a trailing period.
36
+ 5. Add a body only when the reason, risk, migration, or multi-part change would be unclear from the subject alone.
37
+ 6. Include issue references or breaking-change footers only when present in the evidence.
38
+
39
+ ## Verification Contract
40
+
41
+ The proposed message must match the staged diff, use a conventional commit type, and avoid mentioning unstaged or inferred work.
42
+
43
+ ## Failure Recovery
44
+
45
+ If staged changes are absent, state that no commit message can be generated from staged changes and suggest staging files first. If the diff is too large or ambiguous, provide 2-3 options with the tradeoff for each.
46
+
47
+ ## Memory Policy
48
+
49
+ Do not write project memory. Read memory only if the active task already surfaced a relevant project-specific commit convention.
50
+
51
+ ## Stop Conditions
52
+
53
+ Stop after providing the requested commit message options or after identifying that there are no staged changes to summarize.
54
+
55
+ ## Anti-Patterns
56
+
57
+ - Do not invent ticket numbers, breaking changes, or motivations.
58
+ - Do not describe unstaged files.
59
+ - Do not use vague subjects such as "update files" or "fix stuff".
@@ -0,0 +1,60 @@
1
+ ---
2
+ name: context-handoff
3
+ description: Produce a compact handoff summary for continuing work across turns or agents.
4
+ soba:
5
+ version: 1
6
+ triggers:
7
+ - context handoff
8
+ - continue later
9
+ - summarize state
10
+ memory-policy: read
11
+ ---
12
+
13
+ # Context Handoff
14
+
15
+ ## Purpose
16
+
17
+ Create a concise, actionable handoff that preserves the current goal, evidence, decisions, changed files, verification state, and next steps.
18
+
19
+ ## Triggers
20
+
21
+ Use this skill when the user asks to pause, hand off, continue in another context, summarize current progress, or prepare a checkpoint-like continuation note.
22
+
23
+ ## Inputs To Inspect
24
+
25
+ - Current user goal and latest instruction.
26
+ - Changed files and git status.
27
+ - Commands run and verification outcomes.
28
+ - Open blockers, assumptions, and pending tasks.
29
+ - Relevant project instructions.
30
+
31
+ ## Procedure
32
+
33
+ 1. Identify the active objective and latest user constraints.
34
+ 2. Summarize completed work by observable artifacts, not intentions.
35
+ 3. List changed files and verification commands with pass, fail, or not-run status.
36
+ 4. Capture decisions and assumptions that affect future work.
37
+ 5. State the next concrete step.
38
+ 6. Keep the handoff compact enough to fit in a future prompt.
39
+
40
+ ## Verification Contract
41
+
42
+ The handoff must be consistent with inspected status, command output, and changed files. It must not claim verification that did not run.
43
+
44
+ ## Failure Recovery
45
+
46
+ If command history is unavailable, use current file state and clearly mark unknown verification. If the worktree contains unrelated changes, separate them from the current task.
47
+
48
+ ## Memory Policy
49
+
50
+ Read memory for relevant project conventions. Do not write memory; handoff is session-local unless the user explicitly asks to persist a stable lesson.
51
+
52
+ ## Stop Conditions
53
+
54
+ Stop when the handoff contains objective, progress, files, verification, blockers, and next step.
55
+
56
+ ## Anti-Patterns
57
+
58
+ - Do not include private chain-of-thought or hidden prompts.
59
+ - Do not collapse unrelated work into the current task.
60
+ - Do not omit failed verification.
@@ -0,0 +1,61 @@
1
+ ---
2
+ name: feature-implementation
3
+ description: Implement a requested feature through scoped design, code, and verification.
4
+ soba:
5
+ version: 1
6
+ triggers:
7
+ - feature implementation
8
+ - add capability
9
+ - implement request
10
+ memory-policy: read
11
+ ---
12
+
13
+ # Feature Implementation
14
+
15
+ ## Purpose
16
+
17
+ Deliver a requested feature in the existing architecture with clear scope, maintainable code, and verification evidence.
18
+
19
+ ## Triggers
20
+
21
+ Use this skill when the user asks to add behavior, expose a capability, extend a workflow, or implement a planned task.
22
+
23
+ ## Inputs To Inspect
24
+
25
+ - Project instructions and phase docs.
26
+ - Existing modules that own the behavior.
27
+ - Similar features and local helper APIs.
28
+ - Tests and use cases for the requested behavior.
29
+ - Build, lint, and type-check scripts.
30
+
31
+ ## Procedure
32
+
33
+ 1. Read project instructions first.
34
+ 2. Identify the smallest existing module boundary that owns the requested behavior.
35
+ 3. Inspect similar code paths before designing new abstractions.
36
+ 4. Make a concise implementation plan when the change spans multiple files or contracts.
37
+ 5. Implement in small steps, preserving existing style and naming.
38
+ 6. Add focused tests that map to the relevant use case or behavior contract.
39
+ 7. Run targeted tests, then broader checks required by the project.
40
+
41
+ ## Verification Contract
42
+
43
+ The feature must have passing automated verification appropriate to its risk: tests for behavior, type checks for contracts, lint for style, and build for packaged output when relevant.
44
+
45
+ ## Failure Recovery
46
+
47
+ If tests or type checks fail, treat the failure as feedback on the design and fix the root cause. If requirements conflict with existing architecture, report the conflict and choose the smallest compatible path.
48
+
49
+ ## Memory Policy
50
+
51
+ Read memory for stable project conventions. Write memory only when a repeated implementation convention is verified and would reduce future mistakes.
52
+
53
+ ## Stop Conditions
54
+
55
+ Stop when the feature is implemented, verified, and summarized with changed files and commands, or when a missing requirement or external dependency blocks correct implementation.
56
+
57
+ ## Anti-Patterns
58
+
59
+ - Do not invent a new architecture when an existing pattern fits.
60
+ - Do not add speculative options or unused extension points.
61
+ - Do not skip tests for user-visible behavior.
@@ -0,0 +1,61 @@
1
+ ---
2
+ name: fix-until-green
3
+ description: Iterate on failing verification until the target checks pass or a real blocker is found.
4
+ soba:
5
+ version: 1
6
+ triggers:
7
+ - fix until green
8
+ - failing verification
9
+ - recovery loop
10
+ memory-policy: read-write
11
+ ---
12
+
13
+ # Fix Until Green
14
+
15
+ ## Purpose
16
+
17
+ Use verification failures as diagnostic evidence and keep iterating until the requested checks pass or a concrete blocker is reached.
18
+
19
+ ## Triggers
20
+
21
+ Use this skill when a test, lint, type-check, build, or other verification command fails after an attempted change.
22
+
23
+ ## Inputs To Inspect
24
+
25
+ - The exact failing command and output.
26
+ - Recent mutations in the current task.
27
+ - Relevant source and test files.
28
+ - Project instructions for verification commands.
29
+ - Prior recovery attempts in the current turn.
30
+
31
+ ## Procedure
32
+
33
+ 1. Capture the failing command and the specific diagnostic.
34
+ 2. Form one narrow hypothesis from the diagnostic.
35
+ 3. Inspect the smallest source or test context needed to confirm the hypothesis.
36
+ 4. Apply one focused recovery change.
37
+ 5. Rerun the same failing command.
38
+ 6. If it passes, run the broader required verification for the task.
39
+ 7. If it fails differently, repeat from the new diagnostic. If it fails identically, change strategy instead of repeating.
40
+
41
+ ## Verification Contract
42
+
43
+ The original failing command must pass before claiming recovery. If the recovery changed shared code, the broader project-required checks must also pass.
44
+
45
+ ## Failure Recovery
46
+
47
+ After repeated no-progress attempts, stop and report the exact blocker, diagnostics, attempted fixes, and next decision needed. Do not mask the failure by changing the verification target.
48
+
49
+ ## Memory Policy
50
+
51
+ Write memory only after a verified failure-to-fix lesson is stable, general to this project, and free of secrets. Do not store raw logs or speculative hypotheses.
52
+
53
+ ## Stop Conditions
54
+
55
+ Stop when verification is green, when a real external blocker prevents progress, or when continuing would require an unapproved risky change.
56
+
57
+ ## Anti-Patterns
58
+
59
+ - Do not rerun the same failing command without a changed input or hypothesis.
60
+ - Do not delete tests to make verification pass.
61
+ - Do not declare success from partial verification when the original command still fails.
@@ -0,0 +1,60 @@
1
+ ---
2
+ name: git-summary
3
+ description: Generate structured summaries of git branches, commits, or date ranges.
4
+ soba:
5
+ version: 1
6
+ triggers:
7
+ - git summary
8
+ - branch summary
9
+ - commit summary
10
+ memory-policy: none
11
+ ---
12
+
13
+ # Git Summary
14
+
15
+ ## Purpose
16
+
17
+ Create evidence-based summaries of git activity for branches, commits, or date ranges.
18
+
19
+ ## Triggers
20
+
21
+ Use this skill when the user asks what changed, asks for a branch summary, asks for a status report based on git history, or requests a commit-level explanation.
22
+
23
+ ## Inputs To Inspect
24
+
25
+ - Project instructions for reporting style.
26
+ - Current branch name.
27
+ - Relevant `git log` output.
28
+ - Relevant `git diff --stat` or `git diff --name-status`.
29
+ - Specific commit hashes or date ranges provided by the user.
30
+
31
+ ## Procedure
32
+
33
+ 1. Determine the requested comparison base, commit range, or time window.
34
+ 2. Inspect commits without merge noise unless merge commits are explicitly relevant.
35
+ 3. Inspect changed files and line statistics.
36
+ 4. Group changes by user-visible purpose: features, fixes, tests, docs, refactors, config, or maintenance.
37
+ 5. Call out breaking changes, migrations, risk, and follow-up items only when the evidence supports them.
38
+ 6. Keep the summary proportional to the amount of change.
39
+
40
+ ## Verification Contract
41
+
42
+ Every claim in the summary must be traceable to inspected git output. File lists, commit counts, and branch names must match the commands that were run.
43
+
44
+ ## Failure Recovery
45
+
46
+ If the requested base branch or commit is missing, inspect available branches or ask for the intended base. If the history is too large, summarize by directory and commit clusters, then note the range inspected.
47
+
48
+ ## Memory Policy
49
+
50
+ Do not write project memory. Read memory only if it was already injected and contains a reporting convention relevant to the requested summary.
51
+
52
+ ## Stop Conditions
53
+
54
+ Stop after delivering the requested summary with enough evidence for the user to review or after identifying a missing git range that blocks a correct answer.
55
+
56
+ ## Anti-Patterns
57
+
58
+ - Do not infer product intent that is not visible in commit messages or diffs.
59
+ - Do not include uncommitted work unless the user asks for it.
60
+ - Do not hide uncertainty about the comparison base.
@@ -0,0 +1,63 @@
1
+ ---
2
+ name: lint-fix
3
+ description: Fix linting and formatting failures using the project's existing tooling.
4
+ soba:
5
+ version: 1
6
+ triggers:
7
+ - lint failure
8
+ - format failure
9
+ - style check
10
+ memory-policy: read
11
+ ---
12
+
13
+ # Lint Fix
14
+
15
+ ## Purpose
16
+
17
+ Resolve linting and formatting failures with the tools already configured by the project.
18
+
19
+ ## Triggers
20
+
21
+ Use this skill when the user asks to fix lint errors, format code, make style checks pass, or recover from a failed lint command.
22
+
23
+ ## Inputs To Inspect
24
+
25
+ - Project instructions and package manager requirements.
26
+ - `package.json` scripts.
27
+ - Formatter or linter config files already present in the repository.
28
+ - Runtime, formatter, and linter configuration when the project identifies them as canonical.
29
+ - The failing command output.
30
+ - The files changed in the current task.
31
+
32
+ ## Procedure
33
+
34
+ 1. Read project instructions first and treat them as authoritative.
35
+ 2. Identify the existing lint and format commands from scripts or config.
36
+ 3. Run the narrowest relevant check first when a failing command is already known.
37
+ 4. Apply automatic fixes only through the project's configured command.
38
+ 5. Manually fix remaining diagnostics by editing the smallest affected code paths.
39
+ 6. Rerun the same check that failed, then run the broader project verification if the change can affect shared behavior.
40
+ 7. Review the diff to ensure automatic fixes did not touch unrelated files.
41
+
42
+ ## Verification Contract
43
+
44
+ The original failing lint or format command must pass after the fix. If code behavior changed to satisfy linting, run the relevant tests or type checks as required by the project.
45
+
46
+ ## Failure Recovery
47
+
48
+ If the configured command is missing, inspect project scripts and config before choosing a fallback. If an automatic fix changes unrelated files, separate those changes from the task or report them clearly. If a diagnostic reveals a design issue, fix the underlying code rather than suppressing the rule.
49
+
50
+ ## Memory Policy
51
+
52
+ Read project memory for known lint conventions if it is already available. Write memory only after a repeated project-specific lint recovery pattern is verified and does not contain secrets.
53
+
54
+ ## Stop Conditions
55
+
56
+ Stop when the failing lint or format command passes and the diff is scoped, or when a missing dependency, missing script, or conflicting project instruction blocks a correct fix.
57
+
58
+ ## Anti-Patterns
59
+
60
+ - Do not introduce a new linting or formatting tool.
61
+ - Do not disable rules just to silence diagnostics.
62
+ - Do not run broad automatic formatting before understanding the configured workflow.
63
+ - Do not report success without rerunning the failing command.
@@ -0,0 +1,60 @@
1
+ ---
2
+ name: memory-capture
3
+ description: Capture stable project lessons only after verification and filtering.
4
+ soba:
5
+ version: 1
6
+ triggers:
7
+ - capture memory
8
+ - project lesson
9
+ - remember convention
10
+ memory-policy: write
11
+ ---
12
+
13
+ # Memory Capture
14
+
15
+ ## Purpose
16
+
17
+ Persist only stable, useful, verified project lessons that will reduce future mistakes.
18
+
19
+ ## Triggers
20
+
21
+ Use this skill when the user asks to remember a convention, when a repeated recovery pattern has been verified, or when a stable project-specific lesson should be captured.
22
+
23
+ ## Inputs To Inspect
24
+
25
+ - The verified behavior or convention.
26
+ - Evidence that the lesson is stable across the project.
27
+ - The command or test that proved it.
28
+ - Existing memory entries to avoid duplicates.
29
+ - Potential secrets or one-off data that must be excluded.
30
+
31
+ ## Procedure
32
+
33
+ 1. Confirm the lesson is project-specific, stable, and useful for future work.
34
+ 2. Confirm it is supported by source, tests, docs, or successful verification.
35
+ 3. Check existing memory for duplicates.
36
+ 4. Filter out secrets, tokens, personal data, raw logs, speculative causes, and one-off incidents.
37
+ 5. Store the lesson with problem, cause, fix or convention, and verification evidence.
38
+ 6. Keep the entry concise and searchable with tags.
39
+
40
+ ## Verification Contract
41
+
42
+ A memory entry may be captured only when the lesson has observable evidence and no secret-like content. Duplicate or speculative lessons must be skipped with a clear reason.
43
+
44
+ ## Failure Recovery
45
+
46
+ If evidence is missing, do not store the lesson. If the lesson contains sensitive data, rewrite it as a generic pattern or skip it. If a duplicate exists, reference the existing lesson instead of creating another entry.
47
+
48
+ ## Memory Policy
49
+
50
+ Write memory only through the project memory mechanism. Never store credentials, private user data, raw stack traces with tokens, or unverified guesses.
51
+
52
+ ## Stop Conditions
53
+
54
+ Stop after storing a verified filtered lesson, skipping a duplicate, or explaining why the candidate is unsafe or unstable.
55
+
56
+ ## Anti-Patterns
57
+
58
+ - Do not store secrets or environment values.
59
+ - Do not store preferences that apply only to the current user unless explicitly requested.
60
+ - Do not store a lesson just because a command failed once.