djournal 0.1.0 → 0.2.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.
@@ -0,0 +1,246 @@
1
+ # Djournal in Practice
2
+
3
+ djournal works best when it records meaningful work as the work happens. It is
4
+ not a transcript archive and not a replacement for code review. It is the
5
+ reasoning layer that helps future people and agents resume from the right
6
+ state.
7
+
8
+ ## Start or resume work
9
+
10
+ At session start, the active work item gives the agent a compact context pack:
11
+
12
+ - latest timeline
13
+ - current state
14
+ - linked decisions and research
15
+ - next steps
16
+ - recovery warnings from Git status
17
+
18
+ This lets future sessions start from shaped history rather than broad
19
+ exploration.
20
+
21
+ ## Plan before risky work
22
+
23
+ Use a plan entry when the work has multiple phases, cross-component effects, or
24
+ non-obvious validation:
25
+
26
+ ```text
27
+ Plan the migration before changing code.
28
+ ```
29
+
30
+ Plans should explain goals, non-goals, current state, design, phased steps,
31
+ tests, edge cases, and open questions.
32
+
33
+ You can ask explicitly:
34
+
35
+ ```text
36
+ Plan the auth migration before changing code.
37
+ ```
38
+
39
+ You can also describe the work without naming the skill:
40
+
41
+ ```text
42
+ We need to migrate auth tokens from local storage to httpOnly cookies. Work out
43
+ the phases, risks, tests, and rollout before implementation.
44
+ ```
45
+
46
+ The agent should infer that a durable plan is useful because the request has
47
+ multiple phases, security implications, rollout risk, and validation work. If
48
+ the task is small and obvious, the agent may skip a durable plan and implement
49
+ directly.
50
+
51
+ ## Capture evidence
52
+
53
+ Use research entries when findings should survive the session:
54
+
55
+ - how a subsystem works
56
+ - type or schema discovery
57
+ - integration maps
58
+ - current external docs or standards
59
+ - alternatives and tradeoffs
60
+
61
+ Research should cite files, commands, links, and concrete observations. It
62
+ should not paste entire source files or transcripts.
63
+
64
+ You can ask explicitly:
65
+
66
+ ```text
67
+ Research how billing webhooks are handled in this codebase.
68
+ ```
69
+
70
+ Or:
71
+
72
+ ```text
73
+ Before we change webhook retries, map the current webhook flow, tests, and
74
+ places where failures are handled.
75
+ ```
76
+
77
+ The agent should infer codebase research when the request asks for an
78
+ implementation map, type discovery, integration analysis, dependency review,
79
+ or current behavior before planning or changing code.
80
+
81
+ ## Record decisions
82
+
83
+ Use decision entries when a choice constrains future work:
84
+
85
+ - chosen architecture
86
+ - rejected option and rationale
87
+ - product behavior
88
+ - migration policy
89
+ - supersession of an older decision
90
+
91
+ Good decisions make future debates shorter because they preserve the original
92
+ constraints and evidence.
93
+
94
+ You do not have to say the word "decision", but it is often the clearest way to
95
+ ask:
96
+
97
+ ```text
98
+ Decision: use a standalone journal repository for multi-repo product work.
99
+ Record the rationale and consequences.
100
+ ```
101
+
102
+ The agent should also infer a decision when the request clearly states that an
103
+ option has been chosen:
104
+
105
+ ```text
106
+ We are going with httpOnly cookies instead of local storage for auth tokens
107
+ because XSS risk matters more than the extra CSRF handling. Capture that so we
108
+ do not relitigate it later.
109
+ ```
110
+
111
+ The agent should not create a decision entry for unresolved discussion:
112
+
113
+ ```text
114
+ Compare local storage and httpOnly cookies for auth tokens.
115
+ ```
116
+
117
+ That is research or a decision aid until a choice is actually made. A decision
118
+ entry needs the context, options considered, chosen option, rationale,
119
+ consequences, and follow-up. If those facts are missing, the agent should ask
120
+ or record only the known state.
121
+
122
+ ## Write durable docs
123
+
124
+ Use doc entries for synthesized references that should stand on their own:
125
+
126
+ - architecture references
127
+ - walkthroughs
128
+ - how-to guides
129
+ - onboarding notes
130
+ - decision aids before a choice is made
131
+
132
+ Explicit request:
133
+
134
+ ```text
135
+ Document how journal sync works for future contributors.
136
+ ```
137
+
138
+ Inferred request:
139
+
140
+ ```text
141
+ Create a durable guide that explains the webhook retry system, including the
142
+ current flow, operational concerns, and how to safely change it.
143
+ ```
144
+
145
+ The agent should infer a doc entry when the requested output is a lasting
146
+ reference, not just an answer in chat.
147
+
148
+ ## Close meaningful work
149
+
150
+ After implementation or material status changes, write a spine entry that
151
+ records:
152
+
153
+ - what changed
154
+ - why it changed
155
+ - files touched
156
+ - validation results
157
+ - current state
158
+ - next steps
159
+
160
+ The latest spine entry becomes the primary resume index.
161
+
162
+ Implementation and status entries are usually created at closure. You normally
163
+ do not need to ask for them directly if the project uses djournal automation.
164
+ When work changes code, docs, behavior, or material project state, the agent
165
+ should close with a spine entry after validation.
166
+
167
+ Examples:
168
+
169
+ ```text
170
+ Add the webhook retry backoff and tests.
171
+ ```
172
+
173
+ This should usually produce an implementation entry after the change is made
174
+ and validated.
175
+
176
+ ```text
177
+ Check whether the release PR is open and record where things stand.
178
+ ```
179
+
180
+ This should usually produce a status entry if it changes durable project state
181
+ or records a material checkpoint.
182
+
183
+ Read-only or trivial requests should not create journal noise:
184
+
185
+ ```text
186
+ What does this function do?
187
+ Fix this typo.
188
+ ```
189
+
190
+ Those may use recall or direct inspection, but they should not force a new
191
+ entry unless they materially affect durable work state.
192
+
193
+ ## Skill names and inference
194
+
195
+ djournal supports both explicit and inferred skill use.
196
+
197
+ | User wording | Likely journal behavior |
198
+ | --- | --- |
199
+ | "Resume this work" | Read the active work item and latest spine entry. |
200
+ | "Plan this migration" | Create a plan entry before implementation. |
201
+ | "Research how auth works" | Create a codebase research entry. |
202
+ | "Look up the current API docs and record findings" | Create web research with sources. |
203
+ | "We chose option B; record why" | Create a decision entry. |
204
+ | "Write a durable guide for this subsystem" | Create a doc entry. |
205
+ | "Implement this feature" | Implement, validate, then create an implementation entry. |
206
+ | "Record current blockers/status" | Create a status entry. |
207
+
208
+ Explicit keywords make intent unambiguous, especially for decisions and docs.
209
+ They are not required when the meaning is clear. The agent should infer from
210
+ the request using the journal automation rules:
211
+
212
+ - meaningful implementation gets resumed, validated, and journaled
213
+ - durable research gets a research entry
214
+ - accepted choices get decision entries
215
+ - durable references get doc entries
216
+ - read-only and trivial work avoid unnecessary entries
217
+
218
+ If the request is ambiguous, the agent should ask a short clarifying question
219
+ or choose the least surprising durable artifact.
220
+
221
+ ## Keep entries bounded
222
+
223
+ Store durable facts, not raw session noise:
224
+
225
+ - file paths, commands, test results, PRs, commits
226
+ - concise rationale and summaries
227
+ - links to supporting entries
228
+ - short failure excerpts only when useful
229
+
230
+ Avoid storing secrets, environment dumps, full transcripts, full diffs, or
231
+ unbounded logs.
232
+
233
+ ## Use with multiple agents
234
+
235
+ Because the journal is Markdown, different harnesses can read the same memory:
236
+
237
+ - Codex can start the work.
238
+ - Claude Code can continue from the same spine and decisions.
239
+ - A future harness can inspect the same files and links.
240
+
241
+ The journal keeps continuity outside any one model context.
242
+
243
+ ## Related docs
244
+
245
+ - [Architecture and data model](architecture.md)
246
+ - [Visibility and sharing](visibility-and-sharing.md)
@@ -0,0 +1,152 @@
1
+ # Installation and Repository Layouts
2
+
3
+ djournal can be installed globally and then added to each project that should
4
+ carry journal memory. The installed project gets harness integration plus a
5
+ `.djournal.json` marker. The canonical journal content lives under
6
+ `~/.djournal/projects/<project-key>/`.
7
+
8
+ ## Recommended install
9
+
10
+ ```bash
11
+ npm install -g djournal
12
+ ```
13
+
14
+ Then run the installer from the repository or journal workspace you want to
15
+ equip:
16
+
17
+ ```bash
18
+ djournal install
19
+ ```
20
+
21
+ The package exposes both `djournal` and `journal` commands. They point to the
22
+ same CLI.
23
+
24
+ ## No global install
25
+
26
+ Use `npx` when you want a one-off install without adding a global command:
27
+
28
+ ```bash
29
+ npx djournal install
30
+ ```
31
+
32
+ ## Single-repository setup
33
+
34
+ Use this when one product repository owns the work:
35
+
36
+ ```bash
37
+ cd my-product
38
+ djournal install
39
+ ```
40
+
41
+ This installs:
42
+
43
+ - shared journal rules and skills under `.agents/`
44
+ - harness-specific hook config when selected
45
+ - managed instruction blocks in `AGENTS.md` and/or `CLAUDE.md`
46
+ - `.djournal.json`, which points to the global project store
47
+ - for Claude Code installs, a narrow permission grant that lets the agent read
48
+ and write this project's global journal store and run safe `journal`/`djournal`
49
+ workflow commands
50
+
51
+ The durable journal entries live under
52
+ `~/.djournal/projects/<project-key>/.journal/work/...`.
53
+
54
+ ## Harness permissions
55
+
56
+ Claude Code stores project permissions in `.claude/settings.json`, so
57
+ `djournal install --harness claude-code` and `djournal install --all` add this
58
+ project's exact global store path to `permissions.additionalDirectories` and
59
+ allow the safe `journal`/`djournal` commands used by the workflow. Uninstall
60
+ removes only the permission entries that djournal injected.
61
+
62
+ Codex sandbox permissions are controlled by the Codex runtime launch/config
63
+ rather than `.codex/hooks.json`. The installed Codex hook resolves the global
64
+ store through `.djournal.json`; if the Codex session is sandboxed, launch it
65
+ with the generated journal store path available as a readable/writable root.
66
+
67
+ To share selected work through the product repository, enable colocated
68
+ projection:
69
+
70
+ ```bash
71
+ djournal config sync.enabled true
72
+ djournal config sync.mode colocated
73
+ djournal config sync.path .
74
+ djournal share --work 2026-07-03-01-example
75
+ djournal sync --work 2026-07-03-01-example
76
+ ```
77
+
78
+ That copies the shared work item into `./.journal/work/...` so normal product
79
+ repository commits can carry it.
80
+
81
+ ## Multi-repository setup
82
+
83
+ Use standalone projection when one work stream spans several code repositories:
84
+
85
+ ```bash
86
+ mkdir my-product-journal
87
+ cd my-product-journal
88
+ git init
89
+ djournal install --all
90
+ djournal config sync.enabled true
91
+ djournal config sync.mode standalone
92
+ djournal config sync.path .
93
+ ```
94
+
95
+ Keep the journal repository as a sibling of the product repositories:
96
+
97
+ ```text
98
+ workspace/
99
+ product-api/
100
+ product-web/
101
+ product-mobile/
102
+ my-product-journal/
103
+ .djournal.json
104
+ .journal/ # shared projection after djournal sync
105
+ .agents/
106
+ ```
107
+
108
+ Agents can run from the workspace or journal repository as long as they resolve
109
+ the installed project marker. Journal entries can still reference paths and
110
+ commits in sibling code repositories.
111
+
112
+ ## Harness selection
113
+
114
+ Install for one harness:
115
+
116
+ ```bash
117
+ djournal install --harness codex
118
+ djournal install --harness claude-code
119
+ ```
120
+
121
+ Install for multiple harnesses:
122
+
123
+ ```bash
124
+ djournal install --harness codex,claude-code
125
+ ```
126
+
127
+ Install every supported harness:
128
+
129
+ ```bash
130
+ djournal install --all
131
+ ```
132
+
133
+ Install only the portable instructions and journal skills:
134
+
135
+ ```bash
136
+ djournal install --instructions-only
137
+ ```
138
+
139
+ ## Useful checks
140
+
141
+ ```bash
142
+ djournal status
143
+ djournal doctor
144
+ ```
145
+
146
+ `status` reports installed files and cleanliness. `doctor` checks the local
147
+ environment and harness configuration.
148
+
149
+ ## Related docs
150
+
151
+ - [Remote Git sync setup](remote-sync.md)
152
+ - [Uninstalling and reinstalling](uninstalling.md)
@@ -0,0 +1,144 @@
1
+ # Remote Git Sync Setup
2
+
3
+ Git-backed sharing lets a team move journal history through the same reviewable
4
+ transport they use for code. There are two different modes:
5
+
6
+ - colocated `.journal/` in a product repository
7
+ - standalone journal repository for multi-repo or team-wide memory
8
+
9
+ The `djournal sync` command is opt-in and intended for standalone journal
10
+ repositories or colocated projections. The canonical journal stays in
11
+ `~/.djournal/projects/<project-key>/`; sync copies explicitly shared work into
12
+ the configured Git-backed projection.
13
+
14
+ ## Colocated repository
15
+
16
+ Use colocated mode when the product repository should carry `.journal/` beside
17
+ the code:
18
+
19
+ ```bash
20
+ cd my-product
21
+ djournal install --all
22
+ djournal config sync.enabled true
23
+ djournal config sync.mode colocated
24
+ djournal config sync.path .
25
+ djournal share --work 2026-07-03-01-example
26
+ djournal sync --work 2026-07-03-01-example
27
+ git add .agents .codex .claude AGENTS.md CLAUDE.md .djournal.json .journal
28
+ git commit -m "chore: install djournal"
29
+ git push origin main
30
+ ```
31
+
32
+ Only share journal work that is safe for the team to see. In colocated mode,
33
+ `djournal share` updates the global sharing index and `djournal sync` projects
34
+ that work into the repository `.journal/`. Git publication then happens through
35
+ normal product commits.
36
+
37
+ If `.journal/` or `.journal/work/...` is ignored, projection can still create
38
+ files locally, but Git will not include them unless you update `.gitignore` or
39
+ force-add the intended path:
40
+
41
+ ```bash
42
+ git add -f .journal/work/2026-07-03-01-example
43
+ ```
44
+
45
+ ## Standalone journal repository
46
+
47
+ Use a standalone journal repository when work spans multiple code repositories:
48
+
49
+ ```bash
50
+ mkdir my-product-journal
51
+ cd my-product-journal
52
+ git init
53
+ djournal install --all
54
+ djournal config sync.enabled true
55
+ djournal config sync.mode standalone
56
+ djournal config sync.path .
57
+ djournal config sync.auto true
58
+ git remote add origin git@github.com:example/my-product-journal.git
59
+ git add .
60
+ git commit -m "chore: bootstrap journal"
61
+ git push -u origin main
62
+ ```
63
+
64
+ Keep the repository next to the code repositories and point `sync.path` at it
65
+ from the workspace/project that owns the global journal store.
66
+
67
+ ## Bootstrapping from an existing remote
68
+
69
+ When the journal remote already exists:
70
+
71
+ ```bash
72
+ git clone git@github.com:example/my-product-journal.git
73
+ cd my-product-journal
74
+ djournal install --all
75
+ djournal status
76
+ ```
77
+
78
+ If `.journal/` is already present after clone, the install step refreshes local
79
+ harness integration without replacing durable journal history.
80
+
81
+ If the remote was created for standalone journal sync, verify config with
82
+ `djournal config` before expecting hooks to synchronize automatically.
83
+
84
+ ## Sharing a work item
85
+
86
+ By default, work is local-only. Promote a work item before publishing its
87
+ journal history:
88
+
89
+ ```bash
90
+ djournal share
91
+ ```
92
+
93
+ Select a specific work item:
94
+
95
+ ```bash
96
+ djournal share --work 2026-07-03-01-git-backed-journal-collaboration
97
+ ```
98
+
99
+ Sharing is a publication intent recorded in the global config. Treat it as
100
+ durable: once projected content has been pushed to a team remote, removing it
101
+ from the sharing index does not remove it from Git history or teammates' clones.
102
+
103
+ ## Synchronizing shared work
104
+
105
+ Run sync manually:
106
+
107
+ ```bash
108
+ djournal sync
109
+ ```
110
+
111
+ Or select a work item:
112
+
113
+ ```bash
114
+ djournal sync --work 2026-07-03-01-git-backed-journal-collaboration
115
+ ```
116
+
117
+ Current behavior:
118
+
119
+ - sync is skipped unless global `config.json` opts in
120
+ - unshared work is skipped
121
+ - colocated mode copies shared work into the configured product repo projection
122
+ - standalone mode copies shared work and then uses conservative Git operations
123
+ - unresolved journal conflicts stop sync
124
+
125
+ Hook-triggered sync uses the same command path with `--auto` only when
126
+ global config enables standalone automatic sync and the closed work is shared.
127
+
128
+ ## Keep local state local
129
+
130
+ Do not use Git as a blind mirror of every operational file. Treat these as
131
+ local operational state unless a future workflow explicitly says otherwise:
132
+
133
+ - `.journal/state.json`
134
+ - `.journal/.install/`
135
+ - `.djournal.json` when the team does not want to share the local store pointer
136
+ - local harness cache or runtime files
137
+
138
+ The durable team memory is the work item content: `work.md`, `journal/`,
139
+ `decisions/`, `docs/`, and `_research/`.
140
+
141
+ ## Related docs
142
+
143
+ - [Visibility and sharing](visibility-and-sharing.md)
144
+ - [Architecture and data model](architecture.md)
@@ -0,0 +1,78 @@
1
+ # Uninstalling and Reinstalling
2
+
3
+ Uninstall removes djournal tooling from selected harnesses while preserving
4
+ durable journal history.
5
+
6
+ ## Uninstall everything
7
+
8
+ ```bash
9
+ djournal uninstall --all
10
+ ```
11
+
12
+ or:
13
+
14
+ ```bash
15
+ djournal uninstall
16
+ ```
17
+
18
+ Full uninstall removes managed instruction blocks, copied rules/skills, hook
19
+ configuration owned by djournal, and installer metadata when it is safe to do
20
+ so.
21
+
22
+ ## Uninstall one harness
23
+
24
+ ```bash
25
+ djournal uninstall --harness codex
26
+ djournal uninstall --harness claude-code
27
+ ```
28
+
29
+ ## Uninstall multiple harnesses
30
+
31
+ ```bash
32
+ djournal uninstall --harness codex,claude-code
33
+ ```
34
+
35
+ Partial uninstall removes only the selected harness integration and keeps the
36
+ remaining harnesses installed.
37
+
38
+ ## What remains durable
39
+
40
+ Uninstall preserves `.journal/` so work history can be revived later:
41
+
42
+ ```text
43
+ .journal/
44
+ state.json
45
+ work/<work-item>/
46
+ ```
47
+
48
+ That means plans, decisions, docs, research, implementation notes, and status
49
+ entries remain available for future recall.
50
+
51
+ ## Reinstall later
52
+
53
+ ```bash
54
+ djournal install --all
55
+ ```
56
+
57
+ or select a harness:
58
+
59
+ ```bash
60
+ djournal install --harness codex
61
+ ```
62
+
63
+ Reinstalling restores local harness integration around the existing journal
64
+ history.
65
+
66
+ ## Conflict behavior
67
+
68
+ djournal preserves user edits. If a managed file has been modified outside the
69
+ expected managed block or copied assets no longer match their installed hash,
70
+ upgrade or uninstall may refuse to rewrite that file automatically.
71
+
72
+ Use `djournal status` and `djournal doctor` to inspect the installation before
73
+ and after uninstalling.
74
+
75
+ ## Related docs
76
+
77
+ - [Installation and repository layouts](installation.md)
78
+ - [Remote Git sync setup](remote-sync.md)
@@ -0,0 +1,88 @@
1
+ # Visibility and Sharing
2
+
3
+ Visibility answers who the work is intended for. Sharing answers whether a work
4
+ item should be projected out of the private global store into a Git-backed
5
+ location. They are related but no longer the same control.
6
+
7
+ ## Visibility values
8
+
9
+ | Visibility | Meaning |
10
+ | --- | --- |
11
+ | `local_only` | Default. Keep the work on the local machine. |
12
+ | `private_synced` | Reserved compatibility state for private synchronized work. |
13
+ | `team_shared` | Eligible for team sharing and Git-backed sync. |
14
+
15
+ New work starts as `local_only` and unshared.
16
+
17
+ ## Sharing a work item
18
+
19
+ Mark the active work item as shared:
20
+
21
+ ```bash
22
+ djournal share
23
+ ```
24
+
25
+ Mark a specific work item as shared:
26
+
27
+ ```bash
28
+ djournal share --work 2026-07-03-01-git-backed-journal-collaboration
29
+ ```
30
+
31
+ Dry run:
32
+
33
+ ```bash
34
+ djournal share --dry-run --json
35
+ ```
36
+
37
+ `share` updates `sharing.sharedWorkItems` in the global project config. It does
38
+ not edit `work.md` visibility and does not by itself guarantee remote
39
+ publication. Publication requires `djournal sync` plus the relevant Git commit
40
+ or push for the configured mode.
41
+
42
+ ## Sync and visibility
43
+
44
+ Run sync:
45
+
46
+ ```bash
47
+ djournal sync
48
+ ```
49
+
50
+ If the selected work item has not been shared, sync skips it:
51
+
52
+ ```json
53
+ {
54
+ "action": "sync",
55
+ "skipped": true,
56
+ "reason": "work is not shared"
57
+ }
58
+ ```
59
+
60
+ For shared work, sync is still opt-in through global config:
61
+
62
+ ```bash
63
+ djournal config sync.enabled true
64
+ djournal config sync.mode colocated
65
+ djournal sync
66
+ ```
67
+
68
+ In colocated mode, sync copies shared work into the product repository
69
+ projection. In standalone mode, sync copies shared work into the standalone
70
+ journal repository and performs conservative Git operations.
71
+
72
+ ## Safety model
73
+
74
+ Treat sharing as a durable escalation. After projected journal content enters a
75
+ shared Git remote, it may remain in Git history and teammates' clones even if
76
+ local sharing metadata changes later.
77
+
78
+ Before sharing, check for:
79
+
80
+ - customer or private data
81
+ - secrets, credentials, tokens, and connection strings
82
+ - private implementation details not intended for the team
83
+ - accidental transcript dumps or unbounded logs
84
+
85
+ ## Related docs
86
+
87
+ - [Remote Git sync setup](remote-sync.md)
88
+ - [Uninstalling and reinstalling](uninstalling.md)