@balpal4495/quorum 0.4.0 → 1.0.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/CLAUDE.md CHANGED
@@ -2,11 +2,12 @@
2
2
 
3
3
  ## Project overview
4
4
 
5
- Quorum is a portable reasoning layer for agentic codebases. Three TypeScript modules form
6
- the knowledge and validation layer for all agentic work:
5
+ Quorum is a portable reasoning layer for agentic codebases. Five TypeScript modules:
7
6
 
8
7
  ```
9
- oracle.query()jury.evaluate() → council.deliberate() → human gate → Executor
8
+ Advisorplain-language Chronicle queries
9
+ Oracle → Jury → Council → human gate → Executor
10
+ Sentinel → coverage + drift
10
11
  ```
11
12
 
12
13
  Full module rules and design decisions: [modules/CLAUDE.md](modules/CLAUDE.md)
@@ -14,73 +15,132 @@ File ownership map: [modules/AGENTS.md](modules/AGENTS.md)
14
15
 
15
16
  ---
16
17
 
17
- ## Gemini CLI (optional assistant)
18
+ ## Session protocol run this every session
19
+
20
+ This is not optional. Quorum is a self-improving system. It only improves if you use it.
18
21
 
19
- Before attempting any Gemini call, check availability:
22
+ ### On session start
23
+
24
+ Run these before reading any code or proposing anything:
20
25
 
21
26
  ```bash
22
- which gemini 2>/dev/null
27
+ node bin/quorum.js advisor brief
23
28
  ```
24
29
 
25
- If the command returns empty, skip this section entirely. The project is fully functional
26
- without Gemini. Never try to install it or ask the user to install it mid-task.
30
+ This shows what's in Chronicle. Read it. It tells you what the team has already learned.
27
31
 
28
- **If Gemini is available**, use it as a large-context assistant — it can hold the entire
29
- codebase in a single context window where you work best on focused, precise tasks.
32
+ Then query for the topic at hand:
30
33
 
31
- **Call `gemini -p "..."` when:**
32
- - You need to survey many files at once before deciding where to look
33
- - You want to trace a pattern, type, or call across the whole codebase
34
- - You want a second opinion on an architecture decision before proposing it to the user
34
+ ```bash
35
+ node bin/quorum.js advisor query "topic of the work"
36
+ ```
35
37
 
36
- **Important:** The Bash tool does not auto-source shell profiles. Always prefix Gemini
37
- calls with `source ~/.zshrc &&` so that `GEMINI_API_KEY` and `GEMINI_CLI_TRUST_WORKSPACE`
38
- are loaded from the user's profile before invoking the CLI.
38
+ If there are relevant entries, treat them as ground truth. If there are none, that's useful to know too — it means you're working in undocumented territory.
39
39
 
40
- **Patterns:**
40
+ ### During the session
41
41
 
42
- ```bash
43
- # Broad survey before narrowing
44
- source ~/.zshrc && gemini -p "What are all the public exports across modules/ and what does each do?"
42
+ Before making any architectural decision, ask explicitly:
45
43
 
46
- # Trace a pattern across many files
47
- source ~/.zshrc && find . -name "*.ts" | xargs cat | gemini -p "Find every place oracle.commit() is called"
44
+ ```bash
45
+ node bin/quorum.js advisor query "the specific decision you're about to make"
46
+ ```
48
47
 
49
- # Second opinion on a design
50
- source ~/.zshrc && gemini -p "I'm about to add streaming to oracle/query.ts. Given the full codebase, what should I watch out for?"
48
+ Examples:
49
+ - `node bin/quorum.js advisor query "retry logic"`
50
+ - `node bin/quorum.js advisor query "LLM validation"`
51
+ - `node bin/quorum.js advisor query "CLI command structure"`
52
+
53
+ If an entry is refuted, do not retry the approach. Surface the failure reason.
54
+
55
+ ### On session end
56
+
57
+ For every significant decision made in the session, create a Chronicle proposal.
58
+
59
+ What counts as Chronicle-worthy:
60
+ - A new module or significant feature and its design rationale
61
+ - An API or interface choice that will affect future sessions
62
+ - A rejected approach and why it was rejected (important — prevents re-trying bad ideas)
63
+ - A configuration or tooling decision that affects all future work
64
+ - A failure or bug root cause that was non-obvious
65
+
66
+ What does NOT need a Chronicle entry:
67
+ - Routine code changes, style fixes, obvious bug fixes
68
+ - Things already fully captured in git commit messages
69
+ - Transient implementation details with no future impact
70
+
71
+ **Template for a Chronicle proposal:**
72
+
73
+ ```javascript
74
+ // Run with: node -e "..."
75
+ const { randomUUID } = require('crypto')
76
+ const { writeFileSync, mkdirSync } = require('fs')
77
+ const path = require('path')
78
+
79
+ mkdirSync('.chronicle/proposals', { recursive: true })
80
+
81
+ const proposal = {
82
+ schema_version: 2,
83
+ topic: 'short label — module/area',
84
+ decision: 'One sentence: what was decided and why.',
85
+ key_insight: 'One sentence: what was decided and why.', // same as decision
86
+ affected_areas: ['path/to/relevant/file.ts'],
87
+ scope: ['module-name', 'area-tag'],
88
+ alternatives_considered: ['Other approach that was considered'],
89
+ rejected_reason: ['Why the alternative was rejected'],
90
+ status: 'validated', // or 'open' if still uncertain
91
+ confidence: 0.9, // how certain you are this is right
92
+ source_module: 'council',
93
+ evidence_cited: [],
94
+ work_ref: { type: 'pr', ref: 'PR #N' }, // or spike/story
95
+ }
96
+
97
+ const id = randomUUID()
98
+ writeFileSync(path.join('.chronicle', 'proposals', id + '.json'), JSON.stringify(proposal, null, 2), 'utf8')
99
+ console.log('Proposed:', id.slice(0, 8), '—', proposal.topic)
51
100
  ```
52
101
 
53
- **Processing Gemini responses:**
54
- - You reason about Gemini's output — it assists, you decide
55
- - If Gemini contradicts what you know from reading the code, trust your direct reading
56
- - Never pass Gemini's response to the user unfiltered; synthesise it through your own judgment
102
+ After creating proposals, tell the user: "I've staged N Chronicle entries — run `quorum commit --list` to review."
57
103
 
58
104
  ---
59
105
 
60
106
  ## Chronicle — the persistent knowledge store
61
107
 
62
- Chronicle lives at `.chronicle/`. Every prior decision, investigation finding, and outcome
63
- is stored there.
108
+ Chronicle lives at `.chronicle/`. It is the team's accumulated learning — what has been tried, what worked, what failed, and why decisions were made.
64
109
 
65
- - **Query Oracle before proposing any solution.** Treat entries as ground truth for what has
66
- been tried, what worked, and what failed.
67
- - **Never call `oracle.commit()` autonomously.** Use `oracle.propose()` to stage an entry.
68
- A human must call `oracle.commit(proposalId)` to index it. There are no exceptions.
110
+ **Rules:**
111
+ - **Query first, always.** `node bin/quorum.js advisor query "topic"` before proposing any design.
112
+ - **Never call `oracle.commit()` autonomously.** Use the proposal template above. A human must run `quorum commit <id>`.
113
+ - **Cite entries by ID.** When referencing a Chronicle finding, use `[entry-id-prefix]`.
114
+ - **Respect refuted entries.** If an entry is refuted, do not retry the approach without surfacing the failure reason to the user first.
69
115
 
70
116
  ---
71
117
 
72
- ## Rules for AI agents
118
+ ## Gemini CLI (optional assistant)
119
+
120
+ ```bash
121
+ which gemini 2>/dev/null
122
+ ```
73
123
 
74
- - **Evidence first.** Query Oracle before proposing any design or implementation.
75
- - **No auto-commits.** Never call `oracle.commit()` without explicit human input.
76
- - **Cite entries.** Use entry IDs (e.g. `[abc-123]`) when referencing Chronicle findings.
77
- - **Respect refuted entries.** Surface the failure reason don't ignore it.
78
- - **Fail loudly.** Jury and Council throw on bad LLM output. Do not swallow errors.
124
+ If empty, skip. Never install it or ask the user to install it mid-task.
125
+
126
+ **Use Gemini when:**
127
+ - You need to survey many files at once before deciding where to look
128
+ - You want to trace a pattern across the whole codebase
129
+ - You want a second opinion on an architecture decision before proposing it
130
+
131
+ ```bash
132
+ source ~/.zshrc && gemini -p "What are all the public exports across modules/ and what does each do?"
133
+ source ~/.zshrc && find . -name "*.ts" | xargs cat | gemini -p "Find every place oracle.commit() is called"
134
+ ```
135
+
136
+ Reason about Gemini's output — it assists, you decide. Never pass it unfiltered to the user.
79
137
 
80
138
  ---
81
139
 
82
140
  ## Build and test
83
141
 
84
142
  ```bash
85
- npx vitest run modules/
143
+ npx vitest run modules/ evals/
86
144
  ```
145
+
146
+ All 141 tests must pass before any PR.