@codacy/verity-cli 0.23.3 → 0.24.0-experimental.6a390ac

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.
@@ -1,47 +1,83 @@
1
1
  # /verity-reflect — Capture learnings after a task
2
2
 
3
- Trigger knowledge extraction for the current task, or submit a human reflection that becomes a high-confidence knowledge node.
3
+ At a natural task-completion moment, **the agent reflects first** draft a
4
+ concrete, cited observation from what actually happened — then either confirm it
5
+ with the user (interactive) or record it directly (autonomous). This is the
6
+ "reflection flip": Verity stops asking the user to do the reflecting and instead
7
+ does the work, with the human as editor rather than author.
4
8
 
5
- ## Auto-reflection (extract from task history)
9
+ ## The flip draft first, then confirm or auto-record
10
+
11
+ ### 1. Self-draft (always)
12
+
13
+ When a task is complete, draft **1–3** things genuinely worth remembering — a
14
+ **decision**, a **gotcha**, or a **pattern** — from what happened this task. Each
15
+ item must be **concrete and cited**: name the files, PR, commands, or
16
+ error-signatures it came from. **Skip entirely if nothing non-obvious happened**
17
+ — an empty reflection is better than a filler one.
18
+
19
+ Pick the right `--kind` per item: `decision`, `gotcha`, `pattern`, `security`,
20
+ `quality`, `intent`, `domain`, `integration`.
21
+
22
+ ### 2. Branch on run mode
6
23
 
7
- When called without `--user-input`, triggers the LLM extractor to review the current task's run history and produce 0-3 knowledge nodes:
24
+ **Interactive** (a person is at the keyboard a TTY): show your draft and ask
25
+ one question before recording:
26
+
27
+ > "Here's my reflection draft for the project memory: _\<draft\>_. Anything to
28
+ > **confirm, correct, or add** before I record it? (Say 'skip' to drop it.)"
29
+
30
+ Then record the **final** text — with their corrections folded in — via:
8
31
 
9
32
  ```bash
10
- verity reflect
33
+ verity reflect --user-input "<final reflection>" --kind <kind>
34
+ ```
35
+
36
+ If they say "skip", do **not** record.
37
+
38
+ **Autonomous** (no person to confirm — headless / CI / cron, or
39
+ `VERITY_AUTONOMOUS=1`, or a non-TTY session): record your draft **directly**,
40
+ never blocking:
41
+
42
+ ```bash
43
+ verity reflect --user-input "<your draft>" --kind <kind> --autonomous
11
44
  ```
12
45
 
13
- This is the same extraction that runs automatically on task close and every 5 runs. Use this to manually trigger it mid-task if you've learned something significant.
46
+ Mode is auto-detected when you omit the flag (TTY interactive, non-TTY
47
+ autonomous); pass `--autonomous` to be explicit, or set `VERITY_AUTONOMOUS=0` to
48
+ force a confirm step even in a headless run.
49
+
50
+ ### 3. Where it lands
51
+
52
+ The reflection is recorded **only to Verity's own memory namespace** —
53
+ `.verity/memory/` (synced to the service). Verity never writes a repo's own
54
+ `agents/memory` or any other store. One node per item; `source: 'user'`,
55
+ `confidence: 1.0`, never auto-archived.
14
56
 
15
- ## Human reflection (the compound moment)
57
+ ## Auto-reflection (extract from task history)
16
58
 
17
- When the user provides their own insight, it becomes a high-confidence node (`source: user`, `confidence: 1.0`) that is never auto-archived:
59
+ Complementary to the flip: trigger the server-side LLM extractor to mine the
60
+ current task's run history and produce 0–3 nodes. This is the same extraction
61
+ that runs automatically on task close and every 5 runs — use it to trigger
62
+ mid-task:
18
63
 
19
64
  ```bash
20
- verity reflect --user-input "The Stripe retry logic needs idempotency keys or we double-charge"
65
+ verity reflect
21
66
  ```
22
67
 
23
- The CLI will:
24
- 1. Call the extractor LLM to classify the reflection into a domain (decisions/, patterns/, gotchas/, etc.)
25
- 2. Set `source: 'user'` and `confidence: 1.0`
26
- 3. Opportunistically link to existing nodes
27
- 4. Write the node locally and sync to cloud
68
+ Use the self-draft flow above for the **compound moment** (a specific insight
69
+ worth a confirmed node); use auto-extract to harvest what the run history shows.
28
70
 
29
71
  ## When to reflect
30
72
 
31
- The agent should ask for a reflection at natural task-completion moments:
73
+ At natural task-completion moments:
32
74
 
33
75
  - After creating a PR
34
76
  - When the user says "done", "ship it", or "that's it"
35
77
  - When a task is explicitly closed
36
78
 
37
- The reflection prompt (installed in CLAUDE.md during setup):
38
-
39
- > "Quick reflection for future agents: what's one thing you learned during this task that would help next time? A decision, a gotcha, a pattern — anything worth remembering. (Say 'skip' to skip.)"
40
-
41
- If the user says "skip", do NOT call `verity reflect`. The reflection is optional.
42
-
43
- ## Examples of good reflections
79
+ ## Examples of good drafts
44
80
 
45
- - "The Stripe retry logic needs to use idempotency keys or we double-charge. Learned this the hard way." → `gotchas/stripe-idempotency-keys.md`
46
- - "We decided to use advisory locks instead of optimistic locking because Supabase supports it natively." → `decisions/advisory-locks-for-versioning.md`
47
- - "Don't touch the RLS policies without updating the cleanup cron job — they're coupled." → `gotchas/rls-cleanup-coupling.md`
81
+ - "The Stripe retry logic needs idempotency keys or we double-charge hit it in `payments/retry.ts:88`." → `gotchas/stripe-idempotency-keys.md`
82
+ - "We chose advisory locks over optimistic locking because Supabase supports them natively (see PR #214)." → `decisions/advisory-locks-for-versioning.md`
83
+ - "Don't touch the RLS policies without updating the cleanup cron — they're coupled (`migrations/0190`, `cron/cleanup.sql`)." → `gotchas/rls-cleanup-coupling.md`
@@ -425,18 +425,31 @@ If `CLAUDE.md` exists (or `.claude/CLAUDE.md`), append these two blocks. If it d
425
425
 
426
426
  ## Post-task reflection
427
427
  When a task is complete (you've created a PR, the user says "done" or "ship it",
428
- or the work is clearly finished), ask the user one question before moving on:
428
+ or the work is clearly finished), **draft the reflection yourself first** 1–3
429
+ concrete things worth remembering (a decision, a gotcha, or a pattern), each
430
+ cited with the files / PR / commands / error-signatures it came from. Skip
431
+ entirely if nothing non-obvious happened.
429
432
 
430
- > "Quick reflection for future agents: what's one thing you learned during this
431
- > task that would help next time? A decision, a gotcha, a pattern — anything
432
- > worth remembering. (Say 'skip' to skip.)"
433
+ Then, depending on how the session is running:
433
434
 
434
- If the user responds (not "skip"), run `verity reflect --user-input "<their response>"`.
435
+ - **Interactive** (a person is at the keyboard): show your draft and ask one
436
+ question before recording —
437
+
438
+ > "Here's my reflection draft for the project memory: \<draft\>. Anything to
439
+ > confirm, correct, or add before I record it? (Say 'skip' to drop it.)"
440
+
441
+ Record the final text (with their corrections) via
442
+ `verity reflect --user-input "<final reflection>" --kind <kind>`. If they say
443
+ "skip", do not record.
444
+
445
+ - **Autonomous** (headless / CI / cron, or `VERITY_AUTONOMOUS=1`): record your
446
+ draft directly, never blocking —
447
+ `verity reflect --user-input "<your draft>" --kind <kind> --autonomous`.
435
448
  ```
436
449
 
437
450
  These blocks enable two capabilities:
438
451
  1. **Knowledge Base pointer** — agents can browse `.verity/memory/` for project context on demand (KNOWLEDGE-SYSTEM §8.2 Path B)
439
- 2. **Post-task reflection** — the compound moment where the user's judgment enters the knowledge base (KNOWLEDGE-SYSTEM §9.3)
452
+ 2. **Post-task reflection** — the compound moment where the agent drafts a cited reflection and the user confirms/corrects it (interactive) or it's auto-recorded (autonomous), entering the knowledge base (KNOWLEDGE-SYSTEM §9.3)
440
453
 
441
454
  ---
442
455
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codacy/verity-cli",
3
- "version": "0.23.3",
3
+ "version": "0.24.0-experimental.6a390ac",
4
4
  "description": "CLI for Verity quality gate service",
5
5
  "homepage": "https://verity.md",
6
6
  "repository": {