Commit 6cc2a5b
authored
feat(claude-plugin): record guideline usage per session in audit.log (#239)
* feat(claude-plugin): record guideline usage per session in audit.log
Adds the reverse provenance direction: which sessions used a given
guideline. Complements the existing source-trajectory stamp on each
entity.
- recall/retrieve_entities.py now appends one `recall` event per
UserPromptSubmit to .evolve/audit.log, listing the served entity
slugs and the session_id derived from transcript_path. Failures are
swallowed so logging cannot break the user-visible recall path.
- learn/SKILL.md gains a Step 4 that reads audit.log, reconstructs the
set of guidelines served to this session, and emits per-entity
verdicts (followed | contradicted | not_applicable) with a short
evidence line.
- A new log_influence.py script validates and writes those verdicts
back into audit.log.
- The e2e test asserts both event types land correctly after session 2.
* style(tests): apply ruff format to sandbox learn+recall test
Fixes failing CI check: check-formatting
* fix(learn): guard payload and assessment types in log_influence.py
Validate that the JSON payload is a mapping before calling
payload.get(), and skip non-dict assessment items instead of letting
a.get() raise AttributeError. Logs each skipped item for traceability.
Addresses CodeRabbit review finding: Guard payload and assessment item types before calling `.get()`
* fix(learn): resolve recalled slugs across subscribed entity trees
Step 4 previously hard-coded .evolve/entities/guideline/<slug>.md,
which misses entities served from subscribed repositories at
.evolve/entities/subscribed/<source>/guideline/<slug>.md. Switch the
instructions to a recursive search under .evolve/entities/ so the
influence assessment can reach the actual file wherever it lives.
Addresses CodeRabbit review finding: Resolve recalled slugs beyond only `.evolve/entities/guideline/`
* test(learn): add unit tests for log_influence.py
Covers happy path (single/multiple assessments, default evidence),
per-item skip paths (invalid verdict, missing entity, non-dict item),
and top-level input validation (non-dict payload, missing session_id,
non-list assessments, invalid JSON).
Complements the e2e sandbox test with fast, deterministic coverage of
the helper's input-validation surface.
Addresses CodeRabbit review finding: Add unit tests for log_influence.py
* fix(claude-plugin): qualify recall audit ids across local/subscribed trees
The recall audit log stored bare filename stems, so the same slug from
a local entity and a subscribed repo collapsed into one entry and the
influence step couldn't tell which guideline actually fired. Switch
the stored id to the path relative to .evolve/entities/ (without .md):
"guideline/foo" for local entries, "subscribed/alice/guideline/foo"
for subscribed ones. The id is unambiguous, names exactly one file,
and lets learn open it directly (no recursive search).
SKILL.md Step 4 is simplified accordingly — no more find / multi-tree
resolver; just Read .evolve/entities/<id>.md.
The e2e test matches session 1's guidelines against the new qualified
ids, and the existing log_influence unit tests pass unchanged.
Addresses review feedback from visahak
* fix(learn): renumber influence step to Step 5 after merge
Merging public/main brought in #243's SKILL.md restructure, which
inserted a "Review Existing Guidelines" step and shifted Save Entities
to Step 4 — collidingwith the "Step 4: Assess Influence" section this
branch added. Rename the influence section to Step 5 and update its
sub-steps to reference Step 4 (save) and derive session_id from the
saved_trajectory_path variable (the post-#243 name) instead of the
removed transcript_path.
* test(learn): switch log_influence tests to temp_project_dir fixture
Align with the rest of tests/platform_integrations/ which use the
temp_project_dir fixture (a thin wrapper over tmp_path that creates
an isolated test_project/ subdir). All 11 tests still pass.
Addresses CodeRabbit review finding: Replace the use of the tmp_path fixture with the temp_project_dir fixture
* test(learn): assert no audit writes on invalid JSON input
Mirrors the "no audit side effect" assertion present in the other
reject-path tests so we catch any regression where invalid JSON would
sneak a partial write into audit.log.
Addresses CodeRabbit review finding: The test_rejects_invalid_json case is missing the "no audit side effect" assertion1 parent d8b9ac0 commit 6cc2a5b
5 files changed
Lines changed: 370 additions & 1 deletion
File tree
- platform-integrations/claude/plugins/evolve-lite/skills
- learn
- scripts
- recall/scripts
- tests
- e2e
- platform_integrations
Lines changed: 32 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
119 | 151 | | |
120 | 152 | | |
121 | 153 | | |
| |||
Lines changed: 79 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
Lines changed: 27 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
82 | 83 | | |
83 | 84 | | |
84 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
85 | 93 | | |
86 | 94 | | |
87 | 95 | | |
| |||
129 | 137 | | |
130 | 138 | | |
131 | 139 | | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
132 | 158 | | |
133 | 159 | | |
134 | 160 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
0 commit comments