@jaimevalasek/aioson 1.9.3 → 1.16.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.
Files changed (41) hide show
  1. package/CHANGELOG.md +188 -0
  2. package/README.md +44 -1
  3. package/package.json +1 -1
  4. package/src/cli.js +45 -1
  5. package/src/commands/op-capture.js +146 -0
  6. package/src/commands/op-forget.js +54 -0
  7. package/src/commands/op-identity.js +145 -0
  8. package/src/commands/op-list.js +105 -0
  9. package/src/commands/op-migrate.js +158 -0
  10. package/src/commands/op-promote.js +66 -0
  11. package/src/commands/op-reinforce.js +73 -0
  12. package/src/commands/op-show.js +71 -0
  13. package/src/commands/op-stubs.js +67 -0
  14. package/src/commands/preflight.js +6 -2
  15. package/src/commands/runtime.js +151 -0
  16. package/src/commands/state-save.js +61 -0
  17. package/src/commands/sync-agents-preflight.js +117 -3
  18. package/src/commands/workflow-next.js +64 -0
  19. package/src/handoff-contract.js +25 -0
  20. package/src/lib/agent-semantic-diff.js +199 -0
  21. package/src/operator-memory/conflict.js +202 -0
  22. package/src/operator-memory/decay.js +157 -0
  23. package/src/operator-memory/decision.js +274 -0
  24. package/src/operator-memory/identity.js +109 -0
  25. package/src/operator-memory/index-md.js +170 -0
  26. package/src/operator-memory/loader.js +106 -0
  27. package/src/operator-memory/proposal.js +179 -0
  28. package/src/operator-memory/prune.js +81 -0
  29. package/src/operator-memory/slug.js +90 -0
  30. package/src/operator-memory/storage.js +121 -0
  31. package/src/preflight-engine.js +91 -1
  32. package/template/.aioson/agents/dev.md +1 -1
  33. package/template/.aioson/agents/deyvin.md +3 -3
  34. package/template/.aioson/agents/neo.md +1 -1
  35. package/template/.aioson/agents/product.md +1 -1
  36. package/template/.aioson/agents/setup.md +1 -1
  37. package/template/.aioson/docs/deyvin/pair-execution.md +1 -1
  38. package/template/.aioson/skills/process/decision-presentation/SKILL.md +9 -0
  39. package/template/AGENTS.md +23 -0
  40. package/template/CLAUDE.md +23 -0
  41. package/template/agents/_shared/memory-capture-directive.md +115 -0
@@ -56,6 +56,15 @@ Every `AskUserQuestion` in creator mode includes an option labeled "Pausar / que
56
56
  2. Add a free-form option labeled "Other / Conte com suas palavras" as the last option.
57
57
  3. If the user picks "Other", the agent synthesizes the free-form answer into one of the known alternatives internally.
58
58
 
59
+ ### Rule 7 — No questions without a decision to make
60
+
61
+ Never emit `AskUserQuestion` (or numbered batches) just because an agent activated. A question requires a *real* decision the user must make — a fork the work cannot proceed past without their input. When an agent loads without a stated task and no active feature requires continuation:
62
+
63
+ 1. Provide a brief informational summary drawn from already-loaded context (active feature, last gate, blockers, next recommendation)
64
+ 2. Stop and wait for the user to direct
65
+
66
+ Fabricated multi-choice questions waste attention, invite arbitrary implementation paths, and corrode trust in the framework.
67
+
59
68
  ## Loading order
60
69
 
61
70
  1. Agent kernel preflight loads this `SKILL.md`.
@@ -9,6 +9,29 @@ You operate as AIOSON — an AI development squad with specialized agents.
9
9
  - If present: read it before any action
10
10
  3. If `.aioson/rules/` contains `.md` files, note silently that project rules are active — each agent will load applicable rules automatically via its "Project rules, docs & design docs" section. Do not alarm if the directory is absent or empty.
11
11
 
12
+ ## Memory loading
13
+
14
+ Default **ON** in v1.15.0+. Opt out via `AIOSON_OPERATOR_MEMORY=false`.
15
+
16
+ When enabled (default):
17
+
18
+ 1. Read `~/.aioson/operators/{sha256(git-email)[0..16]}/MEMORY.md` if it exists.
19
+ 2. For decisions whose title or signal_type matches the current task description: lazy-load `decisions/{slug}.md` from the same identity directory.
20
+ 3. Apply each loaded decision without re-asking the user — they were captured precisely so this conversation does not repeat past decisions.
21
+ 4. If a project rule in `.aioson/rules/` conflicts with a loaded decision, the project rule wins. Surface the warning emitted by the operator-memory layer to stderr; do not silently override.
22
+
23
+ If `AIOSON_OPERATOR_MEMORY=false` is set: skip silently. Backward compatible.
24
+
25
+ ## Memory capture
26
+
27
+ While conversing, watch for the 4 standing-decision signals defined in `template/agents/_shared/memory-capture-directive.md` (authorization, exclusion, correction, confirmation 2x+). When you detect one, emit:
28
+
29
+ ```bash
30
+ aioson op:capture --signal=<type> --quote="<verbatim>" --proposal="<paraphrase>" --source-agent=<self>
31
+ ```
32
+
33
+ Capture is best-effort — do not crash, retry, or surface failures to the user. The storage layer enforces the 2x promotion threshold and emits the 1-line audit on promotion.
34
+
12
35
  ## How to invoke agents
13
36
 
14
37
  **Option 1 — @ file include (Codex v0.110+):**
@@ -9,6 +9,29 @@ You operate as AIOSON.
9
9
  - If present: read it before any action
10
10
  3. If `.aioson/rules/` contains `.md` files, note silently that project rules are active — each agent will load applicable rules automatically via its "Project rules, docs & design docs" section. Do not alarm if the directory is absent or empty.
11
11
 
12
+ ## Memory loading
13
+
14
+ Default **ON** in v1.15.0+. Opt out via `AIOSON_OPERATOR_MEMORY=false`.
15
+
16
+ When enabled (default):
17
+
18
+ 1. Read `~/.aioson/operators/{sha256(git-email)[0..16]}/MEMORY.md` if it exists.
19
+ 2. For decisions whose title or signal_type matches the current task description: lazy-load `decisions/{slug}.md` from the same identity directory.
20
+ 3. Apply each loaded decision without re-asking the user — they were captured precisely so this conversation does not repeat past decisions.
21
+ 4. If a project rule in `.aioson/rules/` conflicts with a loaded decision, the project rule wins. Surface the warning emitted by the operator-memory layer to stderr; do not silently override.
22
+
23
+ If `AIOSON_OPERATOR_MEMORY=false` is set: skip silently. Backward compatible.
24
+
25
+ ## Memory capture
26
+
27
+ While conversing, watch for the 4 standing-decision signals defined in `template/agents/_shared/memory-capture-directive.md` (authorization, exclusion, correction, confirmation 2x+). When you detect one, emit:
28
+
29
+ ```bash
30
+ aioson op:capture --signal=<type> --quote="<verbatim>" --proposal="<paraphrase>" --source-agent=<self>
31
+ ```
32
+
33
+ Capture is best-effort — do not crash, retry, or surface failures to the user. The storage layer enforces the 2x promotion threshold and emits the 1-line audit on promotion.
34
+
12
35
  ## Agents
13
36
  - /setup -> `.aioson/agents/setup.md`
14
37
  - /discovery-design-doc -> `.aioson/agents/discovery-design-doc.md`
@@ -0,0 +1,115 @@
1
+ ---
2
+ name: memory-capture-directive
3
+ schema_version: "1.0"
4
+ ships_with: operator-memory v1.13.0+
5
+ purpose: "Versioned prompt template defining the 4 signal types that agents observe and emit aioson op:capture for. Source-of-truth for signal detection heuristics; wired into agent preflight by Phase 3 universal loading directive."
6
+ ---
7
+
8
+ # Memory Capture Directive (operator-memory v1.13.0)
9
+
10
+ > **Loaded by:** the universal loading directive in `template/CLAUDE.md` / `template/AGENTS.md` (Phase 3, v1.14.0). Phase 2 ships this file dormant — Phase 3 wires it in.
11
+ >
12
+ > **Versioned:** if signal taxonomy changes in V2, bump `schema_version` and update the loading directive's reference. PMD-02 commitment: divergence from AIOSON's deterministic principle is documented and bounded.
13
+
14
+ ## What to watch for
15
+
16
+ While conversing with the user, watch their messages for **standing decisions** — preferences they want applied to *future* sessions, not just the current turn. There are exactly 4 signal types in V1.
17
+
18
+ ### 1. Authorization
19
+
20
+ User grants ongoing permission for an action. Look for: `pode X sempre`, `from now on X`, `não precisa me perguntar X`, `vai fazendo X`, `confio em você pra X`, `daqui pra frente X`.
21
+
22
+ **Examples that ARE authorization:**
23
+
24
+ - "pode commitar autonomamente sempre que aprovar a fatia"
25
+ - "from now on, use TypeScript by default in new files"
26
+ - "não precisa me perguntar antes de rodar npm test, pode rodar direto"
27
+
28
+ **Examples that are NOT (do not capture):**
29
+
30
+ - "agora pode commitar" → context-bound to current task, not standing
31
+ - "ok faz isso" → simple agreement, not authorization
32
+
33
+ ### 2. Exclusion
34
+
35
+ User explicitly carves out an action that they keep manual / restricted. Look for: `X eu faço manual`, `X nunca autonomamente`, `não X automaticamente`, `X sempre comigo`, `me deixa fazer X`.
36
+
37
+ **Examples that ARE exclusion:**
38
+
39
+ - "npm publish eu sempre faço manualmente"
40
+ - "git push para main nunca autonomamente"
41
+ - "deploy de produção é sempre comigo"
42
+
43
+ **Examples that are NOT:**
44
+
45
+ - "agora não publica" → context-bound
46
+ - "espera eu testar" → temporal, not standing
47
+
48
+ ### 3. Correction
49
+
50
+ User explicitly tells you to stop doing something or change behavior going forward. Look for: `não faça X`, `pare de X`, `stop doing X`, `evita X`, `nunca X`, `prefiro X em vez de Y`.
51
+
52
+ **Examples that ARE correction:**
53
+
54
+ - "stop adding emojis to commit messages"
55
+ - "não faça mais resumos no fim de cada resposta"
56
+ - "prefiro respostas curtas em vez de longas"
57
+
58
+ **Examples that are NOT (likely one-shot):**
59
+
60
+ - "neste arquivo prefiro brevidade" → file-scoped
61
+ - "agora vai com cuidado" → session-scoped
62
+
63
+ ### 4. Confirmation (2x+ threshold)
64
+
65
+ User accepts the same non-obvious approach twice without pushback. The 2x threshold is enforced by the storage layer — the prompt directive only needs to emit `op:capture` whenever the pattern repeats; the 2nd-detection promotion is automatic.
66
+
67
+ **Examples that ARE confirmation worth capturing:**
68
+
69
+ - User accepts the same unusual architectural choice across 2 PRs without questioning it
70
+ - User repeatedly says "perfect, keep doing X" for an approach that wasn't obvious
71
+
72
+ **Examples that are NOT:**
73
+
74
+ - Single acceptance ("ok") — wait for repetition
75
+ - Acceptance of trivially-correct approaches — no signal value
76
+
77
+ ## How to emit
78
+
79
+ When you detect any of the 4 signals, emit this exact CLI call (best-effort — if it fails, do NOT crash the session):
80
+
81
+ ```bash
82
+ aioson op:capture \
83
+ --signal=<authorization|exclusion|correction|confirmation> \
84
+ --quote="<verbatim user message>" \
85
+ --proposal="<your paraphrase of the standing decision>" \
86
+ --source-agent=<your-agent-name>
87
+ ```
88
+
89
+ **Field guidance:**
90
+
91
+ - `--quote` — the EXACT user words (verbatim) that triggered detection. Used for audit; trimmed automatically.
92
+ - `--proposal` — your one-sentence paraphrase in user-facing language. This becomes the slug seed + the decision body. Be concrete: "commit autônomo após approval explícito de slice" beats "user authorized commits".
93
+ - `--source-agent` — your own agent name (`dev`, `deyvin`, `pm`, etc.) so the audit trail knows which agent observed the signal.
94
+
95
+ ## When NOT to capture (anti-patterns)
96
+
97
+ Suppress capture in these cases — they create noise that drowns real signal:
98
+
99
+ 1. **Context-bound preferences** — "neste PR prefiro brevidade" (PR-scoped, not standing).
100
+ 2. **Negotiations / questions** — "será que dá pra commitar autonomo?" (asking, not deciding).
101
+ 3. **Routine agreements** — "ok", "sim", "vai" without specific scope (no signal).
102
+ 4. **Apologies / corrections of immediate output** — "isso ficou errado, refaz" (immediate, not standing).
103
+ 5. **Test sessions** — if `AIOSON_OPERATOR_ID=test-*` or `_anonymous`, the capture happens but no decisions promote to global memory (storage layer handles isolation).
104
+ 6. **Conflict with project rules** — if a decision would conflict with `.aioson/rules/*.md`, the storage layer will surface a warning at preflight; you still capture (the conflict is logged, not silently dropped).
105
+
106
+ ## Capture is best-effort
107
+
108
+ If `aioson op:capture` exits non-zero (CLI unavailable, storage failure, etc.), DO NOT crash the session, retry, or surface the failure to the user. The capture is informational — failure here is non-critical. Continue with the conversation normally.
109
+
110
+ The storage layer (Phase 2 v1.13.0 onwards) handles:
111
+
112
+ - Deterministic slug derivation (same paraphrase → same slug)
113
+ - Idempotent capture (re-detection updates `last_detected`, increments `detected_count`)
114
+ - 2x threshold promotion (proposal → decision atomic transition)
115
+ - Silent operation on first detection; 1-line audit on promotion