opencode-worklog 0.0.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Luke Garceau
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,158 @@
1
+ ```
2
+ ██╗ ██╗ ██████╗ ██████╗ ██╗ ██╗██╗ ██████╗ ██████╗
3
+ ██║ ██║██╔═══██╗██╔══██╗██║ ██╔╝██║ ██╔═══██╗██╔════╝
4
+ ██║ █╗ ██║██║ ██║██████╔╝█████╔╝ ██║ ██║ ██║██║ ███╗
5
+ ██║███╗██║██║ ██║██╔══██╗██╔═██╗ ██║ ██║ ██║██║ ██║
6
+ ╚███╔███╔╝╚██████╔╝██║ ██║██║ ██╗███████╗╚██████╔╝╚██████╔╝
7
+ ╚══╝╚══╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚═════╝
8
+ ```
9
+
10
+ <div align="center">
11
+
12
+ **Cross-session work management for AI agents. Your todos survive. Your decisions persist. Your context comes back.**
13
+
14
+ [![npm](https://img.shields.io/npm/v/opencode-worklog)](https://www.npmjs.com/package/opencode-worklog)
15
+ [![license: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
16
+ [![works with opencode](https://img.shields.io/badge/works%20with-opencode-black)](https://opencode.ai)
17
+ [![TypeScript](https://img.shields.io/badge/TypeScript-3178C6?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
18
+ [![runtime: bun](https://img.shields.io/badge/runtime-bun-fbf0df?logo=bun&logoColor=black)](https://bun.sh)
19
+
20
+ </div>
21
+
22
+ ---
23
+
24
+ ## The problem
25
+
26
+ OpenCode sessions are stateless. Every context compaction or restart wipes the agent's working memory — todos vanish, blockers disappear, half-finished decisions evaporate. You're left re-explaining context that was perfectly documented ten minutes ago.
27
+
28
+ `opencode-worklog` fixes this. It persists todos, blockers, and decisions to disk, then automatically injects them back into context at compaction time. Work in progress survives session resets.
29
+
30
+ ---
31
+
32
+ ## What it does
33
+
34
+ An OpenCode plugin (`index.ts`) that hooks into two lifecycle events:
35
+
36
+ 1. **On session start** — bootstraps the `.worklog/` directory structure in the project root (idempotent; safe to run repeatedly)
37
+ 2. **On session start** — auto-installs 6 skills to `.opencode/skills/` (skips any already present)
38
+ 3. **On context compaction** — reads open todos and active blockers from disk, injects them into the compaction payload so they land in the next session's context
39
+
40
+ ---
41
+
42
+ ## How it works
43
+
44
+ ```
45
+ Session Start
46
+
47
+ ├──► Bootstrap .worklog/ directory structure
48
+
49
+ └──► Auto-install skills to .opencode/skills/
50
+
51
+
52
+ Inject system prompt:
53
+ "use /worklog, /worklog-todo, /worklog-decide…"
54
+
55
+
56
+ [ work happens ]
57
+
58
+
59
+ Context Compaction
60
+
61
+ └──► Read todos.json + blockers.md
62
+
63
+
64
+ Inject into compaction payload
65
+
66
+
67
+ Open work survives reset ✓
68
+ ```
69
+
70
+ ---
71
+
72
+ ## Install
73
+
74
+ Add to `opencode.json` in your project root:
75
+
76
+ ```json
77
+ {
78
+ "plugins": ["opencode-worklog"]
79
+ }
80
+ ```
81
+
82
+ That's it. On the next session start the plugin bootstraps `.worklog/` and installs the skills automatically. No further configuration needed.
83
+
84
+ ### Local / development
85
+
86
+ ```json
87
+ {
88
+ "plugins": ["file:../opencode-worklog"]
89
+ }
90
+ ```
91
+
92
+ > **Peer dependency:** `@opencode-ai/plugin`
93
+ > **Runtime:** Bun (OpenCode's native runtime)
94
+
95
+ ---
96
+
97
+ ## Skills reference
98
+
99
+ Six skills are installed to `.opencode/skills/` automatically. Invoke them by slash command or by describing what you want to the agent.
100
+
101
+ | Skill | Triggers | Purpose |
102
+ |---|---|---|
103
+ | `worklog` | `/worklog` · `/worklog checkpoint` · `/worklog end` | Session dashboard, mid-session checkpoint, close-out summary |
104
+ | `worklog-todo` | `/worklog-todo add <title>` · `list` · `done <id>` · `drop <id>` | Cross-session todo list backed by `.worklog/todos.json` |
105
+ | `worklog-archive` | `/worklog-archive` | Move done/dropped todos to `todos.done.json` |
106
+ | `worklog-blocker` | `/worklog-blocker add <title>` · `resolve <id>` | Record and resolve blockers and open questions |
107
+ | `worklog-decide` | `/worklog-decide` | Lightweight ADR appended to `.worklog/decisions.md` |
108
+ | `worklog-docs` | `/worklog-docs` · `new adr` · `new report` · `new research` | Full ADR, formal report, and research note management |
109
+
110
+ ---
111
+
112
+ ## `.worklog/` layout
113
+
114
+ ```
115
+ .worklog/
116
+ ├── todos.json ← active todos (JSON array)
117
+ ├── todos.done.json ← archived done/dropped todos
118
+ ├── blockers.md ← open questions and blockers
119
+ ├── decisions.md ← lightweight ADRs (ADR-001…)
120
+ ├── sessions/ ← daily session files (YYYY-MM-DD.md)
121
+ ├── adrs/ ← pre-decision technical research
122
+ ├── reports/ ← formal investigation reports
123
+ └── research/ ← quick audit notes
124
+
125
+ docs/
126
+ └── adr-NNN-*.md ← full formal ADRs (committed, permanent)
127
+ ```
128
+
129
+ ---
130
+
131
+ ## Gitignore recommendations
132
+
133
+ ```gitignore
134
+ # Session files are noisy — safe to ignore
135
+ .worklog/sessions/
136
+
137
+ # Auto-installed skills — reinstalled each session start
138
+ .opencode/skills/worklog
139
+ .opencode/skills/worklog-todo
140
+ .opencode/skills/worklog-archive
141
+ .opencode/skills/worklog-blocker
142
+ .opencode/skills/worklog-decide
143
+ .opencode/skills/worklog-docs
144
+ ```
145
+
146
+ **Worth committing:** `.worklog/todos.json`, `.worklog/decisions.md`, `.worklog/blockers.md`, and everything under `docs/`. These are your persistent project memory.
147
+
148
+ ---
149
+
150
+ ## Contributing
151
+
152
+ PRs and issues welcome on [GitHub](https://github.com/lgarceau768/worklog). Keep it small — this plugin is intentionally minimal.
153
+
154
+ ---
155
+
156
+ ## License
157
+
158
+ MIT
package/index.ts ADDED
@@ -0,0 +1,72 @@
1
+ import type { Plugin } from "@opencode-ai/plugin"
2
+ import { join } from "path"
3
+ import { fileURLToPath } from "url"
4
+
5
+ const SKILLS = [
6
+ "worklog",
7
+ "worklog-todo",
8
+ "worklog-archive",
9
+ "worklog-blocker",
10
+ "worklog-decide",
11
+ "worklog-docs",
12
+ ]
13
+
14
+ // ponytail: package root via import.meta.url — works with Bun's native TS execution
15
+ const PKG_SKILLS = join(fileURLToPath(new URL(".", import.meta.url)), "skills")
16
+
17
+ export const WorklogPlugin: Plugin = async ({ directory, $ }) => {
18
+ const wl = join(directory, ".worklog")
19
+ await $`mkdir -p ${wl}/sessions ${wl}/adrs ${wl}/reports ${wl}/research`
20
+
21
+ const decisions = join(wl, "decisions.md")
22
+ const blockers = join(wl, "blockers.md")
23
+ const todosFile = join(wl, "todos.json")
24
+
25
+ await $`test -f ${decisions} || printf '# Decisions\n\n_No decisions recorded yet._\n' > ${decisions}`
26
+ await $`test -f ${blockers} || printf '# Blockers & Open Questions\n\n_No open blockers._\n' > ${blockers}`
27
+ await $`test -f ${todosFile} || printf '{"version":1,"todos":[]}\n' > ${todosFile}`
28
+
29
+ // Auto-install skills to .opencode/skills/ (idempotent — skips if already present)
30
+ const projectSkillsDir = join(directory, ".opencode", "skills")
31
+ await $`mkdir -p ${projectSkillsDir}`
32
+ for (const skill of SKILLS) {
33
+ const dest = join(projectSkillsDir, skill)
34
+ await $`test -d ${dest} || cp -r ${join(PKG_SKILLS, skill)} ${dest}`
35
+ }
36
+
37
+ return {
38
+ // Remind the agent when to use each worklog skill — fires on every LLM call
39
+ "experimental.chat.system.transform": async (_input, output) => {
40
+ output.system.push(
41
+ `## Worklog — Cross-Session Continuity\n` +
42
+ `At session start, run \`/worklog\` to review open todos and blockers.\n` +
43
+ `During work: record tasks with \`/worklog-todo\`, blockers with \`/worklog-blocker\`, and decisions with \`/worklog-decide\`.\n` +
44
+ `At session end, run \`/worklog end\` to write a closing summary.`
45
+ )
46
+ },
47
+
48
+ // Inject open todos and blockers into compaction context so they survive resets
49
+ "experimental.session.compacting": async (_input, output) => {
50
+ try {
51
+ const todosRaw = await $`cat ${todosFile}`.text()
52
+ const todos = JSON.parse(todosRaw)
53
+ const open = (todos.todos ?? []).filter((t: { status: string }) => t.status === "open")
54
+
55
+ if (open.length > 0) {
56
+ const lines = open
57
+ .map((t: { priority: string; id: string; title: string }) => `- [${t.priority}] ${t.id} — ${t.title}`)
58
+ .join("\n")
59
+ output.context.push(`## Open Worklog TODOs\n${lines}`)
60
+ }
61
+
62
+ const blockersRaw = await $`grep -c '\\[OPEN\\]' ${blockers}`.text().catch(() => "0")
63
+ if (parseInt(blockersRaw.trim()) > 0) {
64
+ const blockersContent = await $`grep -A3 '\\[OPEN\\]' ${blockers}`.text()
65
+ output.context.push(`## Open Worklog Blockers\n${blockersContent}`)
66
+ }
67
+ } catch {
68
+ // .worklog not present — skip silently
69
+ }
70
+ },
71
+ }
72
+ }
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "opencode-worklog",
3
+ "version": "0.0.1",
4
+ "description": "Cross-session work management for OpenCode — todos, blockers, decisions, ADRs, and session checkpoints.",
5
+ "type": "module",
6
+ "main": "index.ts",
7
+ "exports": {
8
+ ".": "./index.ts"
9
+ },
10
+ "files": [
11
+ "index.ts",
12
+ "skills/",
13
+ "LICENSE",
14
+ "README.md"
15
+ ],
16
+ "keywords": [
17
+ "opencode",
18
+ "opencode-plugin",
19
+ "worklog",
20
+ "adr",
21
+ "todos",
22
+ "session",
23
+ "agentic"
24
+ ],
25
+ "license": "MIT",
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "https://github.com/lgarceau768/worklog.git"
29
+ },
30
+ "homepage": "https://github.com/lgarceau768/worklog#readme",
31
+ "bugs": {
32
+ "url": "https://github.com/lgarceau768/worklog/issues"
33
+ },
34
+ "scripts": {
35
+ "typecheck": "tsc --noEmit"
36
+ },
37
+ "peerDependencies": {
38
+ "@opencode-ai/plugin": "*"
39
+ },
40
+ "devDependencies": {
41
+ "@opencode-ai/plugin": "latest",
42
+ "@types/node": "^22",
43
+ "typescript": "^5"
44
+ }
45
+ }
@@ -0,0 +1,105 @@
1
+ ---
2
+ name: worklog
3
+ description: Cross-session work management. Use when the user wants to see current work status, save a checkpoint mid-session, or write a closing summary at the end of a session. Subcommands — no args: dashboard; "checkpoint": save progress now; "end": close out session with full summary.
4
+ ---
5
+
6
+ # Worklog — Session Management
7
+
8
+ Manages `.worklog/` for cross-session continuity.
9
+
10
+ ## Invocation forms
11
+
12
+ | Command | What to do |
13
+ |---|---|
14
+ | `/worklog` | Show the **status dashboard** |
15
+ | `/worklog checkpoint` | Write current progress to today's session file |
16
+ | `/worklog end` | Write a full closing summary and update todos/blockers |
17
+
18
+ ---
19
+
20
+ ## `/worklog` — Status Dashboard
21
+
22
+ Read these files and present a concise dashboard:
23
+
24
+ 1. **Open TODOs** — read `.worklog/todos.json`, list items where `"status": "open"`, sorted by priority
25
+ 2. **Open Blockers** — read `.worklog/blockers.md`, list any `[OPEN]` entries
26
+ 3. **Today's session** — read `.worklog/sessions/YYYY-MM-DD.md` if it exists (use today's date), show Activity section
27
+ 4. **Last decision** — read `.worklog/decisions.md`, show the most recent lightweight ADR
28
+ 5. **Recent formal ADRs** — list `docs/adr-*.md` files (filename + first heading line only); use `ls docs/adr-*.md` and read the `# ADR-NNN` line from each
29
+
30
+ Format:
31
+ ```
32
+ ## Worklog Status — YYYY-MM-DD
33
+
34
+ ### Open TODOs (N)
35
+ - [high] 001 — Description
36
+
37
+ ### Open Blockers
38
+ - none
39
+
40
+ ### Today's session
41
+ - 14:32:01
42
+ - 14:45:22
43
+ [summary if written]
44
+
45
+ ### Last decision (.worklog/decisions.md)
46
+ ADR-005 — Brief title
47
+
48
+ ### Formal ADRs (docs/)
49
+ - adr-005-some-decision.md — Some Decision
50
+ ```
51
+
52
+ > To browse, read, or write ADRs/reports/research in full, use `/worklog-docs`.
53
+
54
+ ---
55
+
56
+ ## `/worklog checkpoint` — Mid-Session Checkpoint
57
+
58
+ Write a checkpoint to `.worklog/sessions/YYYY-MM-DD.md`.
59
+
60
+ 1. Read the current session file (create with template header if missing)
61
+ 2. Append a `## Checkpoint — HH:MM` section containing:
62
+ - What is currently in progress
63
+ - Any decisions made so far this session
64
+ - Files changed (summarize, don't list every line)
65
+ 3. Write the updated file
66
+
67
+ Template for a new checkpoint section:
68
+ ```markdown
69
+ ## Checkpoint — HH:MM
70
+
71
+ **In progress:** [what's being worked on]
72
+
73
+ **Done so far:**
74
+ - [item]
75
+
76
+ **Files touched:** [brief list]
77
+
78
+ **Next:** [what comes next]
79
+ ```
80
+
81
+ ---
82
+
83
+ ## `/worklog end` — Close Session
84
+
85
+ Write a full closing summary to today's session file.
86
+
87
+ 1. Read `.worklog/todos.json` — ask the user if any todos changed status; update if so
88
+ 2. Read `.worklog/blockers.md` — note any new or resolved blockers
89
+ 3. Append a `## Summary` section to `.worklog/sessions/YYYY-MM-DD.md`:
90
+
91
+ ```markdown
92
+ ## Summary
93
+
94
+ **Accomplished:**
95
+ - [bullet per major thing done]
96
+
97
+ **Commits:** [list commit SHAs or descriptions if any]
98
+
99
+ **Decisions made:** [reference ADR numbers if any were added this session]
100
+
101
+ **Handoff:** [what the next session should pick up first]
102
+ ```
103
+
104
+ 4. Write the session file
105
+ 5. If todos changed, write `.worklog/todos.json`
@@ -0,0 +1,107 @@
1
+ ---
2
+ name: worklog-archive
3
+ description: Archive completed todos from todos.json into todos.done.json. Use when the user asks to archive done items, clean up the todo list, or move completed work out of the active list. Args: "archive" (default — move all done/dropped), "archive <id>" (move one specific item).
4
+ ---
5
+
6
+ # Worklog — Archive Done Todos
7
+
8
+ Moves `"status": "done"` or `"status": "dropped"` items from `.worklog/todos.json`
9
+ into `.worklog/todos.done.json`, keeping the active list clean.
10
+
11
+ ## Files
12
+
13
+ | File | Purpose |
14
+ |---|---|
15
+ | `.worklog/todos.json` | Active todos — open items only after archive |
16
+ | `.worklog/todos.done.json` | Permanent archive of done/dropped items |
17
+
18
+ ---
19
+
20
+ ## `/worklog-archive` or `/worklog-archive archive`
21
+
22
+ Archive all non-open items.
23
+
24
+ 1. Read `.worklog/todos.json`
25
+ 2. Read `.worklog/todos.done.json` (create with `{"version":1,"archived":[]}` if missing)
26
+ 3. Partition todos into `keep` (status=open) and `move` (status=done or dropped)
27
+ 4. If `move` is empty, report "Nothing to archive." and stop
28
+ 5. Append `move` items to `archived` array in `todos.done.json`
29
+ - Deduplicate by `id` — if the id already exists in `archived`, skip (idempotent)
30
+ 6. Write `todos.done.json` with merged archive
31
+ 7. Write `todos.json` with only `keep` items
32
+ 8. Report:
33
+
34
+ ```
35
+ Archived N item(s) → .worklog/todos.done.json
36
+ - [done] 001 — Description
37
+ ...
38
+
39
+ Active todos remaining: M open item(s).
40
+ ```
41
+
42
+ ---
43
+
44
+ ## `/worklog-archive archive <id>`
45
+
46
+ Archive a single item by id.
47
+
48
+ 1. Read both files (same as above)
49
+ 2. Find item with matching `id` in `todos.json`
50
+ 3. If not found: "Todo <id> not found in todos.json."
51
+ 4. If found and status is `open`: warn "Todo <id> is still open — archive anyway? (y/n)" and wait for confirmation
52
+ 5. Move the item and write both files
53
+ 6. Report: `Archived <id>: <title>`
54
+
55
+ ---
56
+
57
+ ## `/worklog-archive list`
58
+
59
+ Show what's in the archive without modifying anything.
60
+
61
+ 1. Read `.worklog/todos.done.json`
62
+ 2. Print items grouped by closed date (newest first), showing id, title, closed date
63
+
64
+ ```
65
+ ### Archived Todos (16)
66
+
67
+ 2026-06-21
68
+ [done] 022 — Description
69
+ ...
70
+
71
+ 2026-06-20
72
+ [done] 009 — Description
73
+ ...
74
+ ```
75
+
76
+ ---
77
+
78
+ ## Schema reference
79
+
80
+ `todos.json` item shape:
81
+ ```json
82
+ {
83
+ "id": "NNN",
84
+ "title": "...",
85
+ "status": "open | done | dropped",
86
+ "priority": "high | medium | low",
87
+ "created": "YYYY-MM-DD",
88
+ "closed": "YYYY-MM-DD",
89
+ "notes": "..."
90
+ }
91
+ ```
92
+
93
+ `todos.done.json` shape:
94
+ ```json
95
+ {
96
+ "version": 1,
97
+ "archived": [ /* same item shape as above */ ]
98
+ }
99
+ ```
100
+
101
+ ---
102
+
103
+ ## Notes
104
+
105
+ - Archive is append-only and idempotent — running twice is safe.
106
+ - Never delete items from `todos.done.json`; only append.
107
+ - `todos.json` must never contain `"status": "done"` or `"status": "dropped"` items after a successful archive run.
@@ -0,0 +1,55 @@
1
+ ---
2
+ name: worklog-blocker
3
+ description: Record or resolve an open question or blocker in .worklog/blockers.md. Use when something is blocking progress or needs investigation before work can continue. Args: no args = list open; "add <title>"; "resolve <id>".
4
+ ---
5
+
6
+ # Worklog — Blockers & Open Questions
7
+
8
+ Manages `.worklog/blockers.md`.
9
+
10
+ ## Format in the file
11
+
12
+ ```markdown
13
+ ## BLOCKER-NNN — YYYY-MM-DD [OPEN]
14
+ **What:** One sentence describing the blocker or question.
15
+ **Impact:** What can't be done until this is resolved?
16
+ **Needs:** What would resolve it (investigation, upstream fix, decision, etc.)?
17
+ ```
18
+
19
+ When resolved, update `[OPEN]` → `[RESOLVED YYYY-MM-DD]` and add a resolution line:
20
+ ```markdown
21
+ **Resolution:** What turned out to be the answer or workaround.
22
+ ```
23
+
24
+ ---
25
+
26
+ ## `/worklog-blocker` — List Open Blockers
27
+
28
+ 1. Read `.worklog/blockers.md`
29
+ 2. Print all entries where status is `[OPEN]`
30
+ 3. If none: print `No open blockers.`
31
+
32
+ ---
33
+
34
+ ## `/worklog-blocker add <title>`
35
+
36
+ 1. Read `.worklog/blockers.md`
37
+ 2. Find the highest BLOCKER-NNN and increment
38
+ 3. Ask for / infer:
39
+ - **What:** description
40
+ - **Impact:** what's blocked
41
+ - **Needs:** what would unblock it
42
+ 4. Append the formatted block to the file
43
+ 5. Remove the `_No open blockers._` placeholder if present
44
+ 6. Confirm: `Recorded BLOCKER-NNN: <title>`
45
+
46
+ ---
47
+
48
+ ## `/worklog-blocker resolve <id>`
49
+
50
+ 1. Read `.worklog/blockers.md`
51
+ 2. Find `BLOCKER-<id>`
52
+ 3. Change `[OPEN]` to `[RESOLVED YYYY-MM-DD]`
53
+ 4. Append `**Resolution:** <user-provided or inferred resolution>`
54
+ 5. Write file
55
+ 6. Confirm: `Resolved BLOCKER-<id>`
@@ -0,0 +1,52 @@
1
+ ---
2
+ name: worklog-decide
3
+ description: Record an architectural or design decision (ADR) in .worklog/decisions.md. Use when a non-obvious decision is made that future sessions should understand — why something was done a certain way, what was rejected, or what constraints apply.
4
+ ---
5
+
6
+ # Worklog — Decision Recording
7
+
8
+ Appends a lightweight ADR to `.worklog/decisions.md`.
9
+
10
+ ## Decision routing — which tool to use?
11
+
12
+ | Decision size | Tool | Output |
13
+ |---|---|---|
14
+ | Small (1–2 sentences, inline context) | `/worklog-decide` (this skill) | Appends to `.worklog/decisions.md` |
15
+ | Major (version selection, architecture change, new system, alternatives considered) | `/worklog-docs new adr <title>` | Creates `docs/adr-NNN-*.md` — committed, permanent |
16
+
17
+ **Use this skill when:**
18
+ - A design choice that isn't obvious from the code
19
+ - A decision that rejected an alternative worth remembering
20
+ - A constraint imposed by the runtime, framework, or environment that shapes code structure
21
+ - Anything you'd explain in a PR description that isn't in the diff
22
+
23
+ **Escalate to `/worklog-docs new adr` when:**
24
+ - The decision affects a whole subsystem
25
+ - Alternatives were seriously compared with trade-offs
26
+ - Future contributors need the full context to avoid re-litigating it
27
+
28
+ ## Steps
29
+
30
+ 1. Read `.worklog/decisions.md`
31
+ 2. Find the current highest ADR number (e.g. `ADR-002`) and increment
32
+ 3. Prompt for (or infer from context):
33
+ - **Context:** Why did this come up?
34
+ - **Decision:** What was chosen?
35
+ - **Alternatives considered:** (optional, only if relevant)
36
+ - **Status:** `Accepted` | `Superseded by ADR-NNN` | `Experimental`
37
+ 4. Append to the file:
38
+
39
+ ```markdown
40
+ ## ADR-NNN — YYYY-MM-DD: <short title>
41
+ **Context:** ...
42
+ **Decision:** ...
43
+ **Status:** Accepted
44
+ ```
45
+
46
+ 5. Confirm: `Recorded ADR-NNN: <title>`
47
+
48
+ ## Format notes
49
+
50
+ - Keep context and decision to 1–2 sentences each
51
+ - Only add Alternatives if the other option was seriously considered
52
+ - Use `Superseded by ADR-NNN` when a later decision overrides this one — don't delete old ADRs
@@ -0,0 +1,224 @@
1
+ ---
2
+ name: worklog-docs
3
+ description: Browse, read, and write documentation across the worklog system — ADRs, reports, and research notes. Use when asked to "check the ADRs", "look at research on X", "write a report about Y", "what do we know about Z", or "create an ADR". Covers .worklog/adrs/, .worklog/reports/, .worklog/research/, docs/adr-*.md, and .worklog/decisions.md.
4
+ ---
5
+
6
+ # Worklog — Documentation (ADRs, Reports, Research)
7
+
8
+ Manages the documentation layer of `.worklog/` and `docs/`. Not to be confused with the session log (`/worklog`) or decision recorder (`/worklog-decide`).
9
+
10
+ ---
11
+
12
+ ## Directory Map
13
+
14
+ ```
15
+ .worklog/
16
+ decisions.md ← lightweight inline ADRs (ADR-001…), managed by /worklog-decide
17
+ adrs/ ← deep technical research docs (content is research, not decisions)
18
+ reports/ ← formal reports on topics, investigations, reconnaissance
19
+ research/ ← audit notes, quick investigation outputs
20
+
21
+ docs/
22
+ adr-NNN-*.md ← full formal ADRs (longer form, versioned, committed)
23
+ architecture.md ← (if present) high-level architecture overview
24
+ ```
25
+
26
+ ### Which location for which content?
27
+
28
+ | Content type | Location | When to use |
29
+ |---|---|---|
30
+ | Lightweight ADR (2–4 sentences) | `.worklog/decisions.md` | Use `/worklog-decide` for these |
31
+ | Formal ADR (full context, alternatives, consequences) | `docs/adr-NNN-*.md` | Major architectural decisions affecting long-term direction |
32
+ | Deep technical research (API survey, version compat, integration patterns) | `.worklog/adrs/<topic>.md` | Pre-implementation research drop; not a decision, just findings |
33
+ | Formal report (recon, analysis, design proposals) | `.worklog/reports/<name>.md` | Multi-section structured output for a specific topic |
34
+ | Quick audit / investigation notes | `.worklog/research/<name>.md` | Ad-hoc findings from a focused spike |
35
+
36
+ ---
37
+
38
+ ## `/worklog-docs` — List All Docs
39
+
40
+ List every file across all doc locations:
41
+
42
+ 1. Run: `find .worklog/adrs .worklog/reports .worklog/research -name "*.md" | sort`
43
+ 2. List `docs/adr-*.md` files
44
+ 3. Summarize `.worklog/decisions.md` — just the ADR numbers and titles (one line each)
45
+
46
+ Output format:
47
+ ```
48
+ ## Worklog Docs Index
49
+
50
+ ### Formal ADRs (docs/)
51
+ - adr-005-some-decision.md — Some Decision
52
+
53
+ ### Lightweight ADRs (.worklog/decisions.md)
54
+ - ADR-001 — Brief title
55
+ - ADR-002 — Brief title
56
+
57
+ ### Research (.worklog/adrs/)
58
+ - topic-research.md
59
+
60
+ ### Reports (.worklog/reports/)
61
+ - investigation-report.md
62
+
63
+ ### Research Notes (.worklog/research/)
64
+ - audit-notes.md
65
+ ```
66
+
67
+ ---
68
+
69
+ ## `/worklog-docs read <keyword>`
70
+
71
+ Find and read a doc by keyword or topic name.
72
+
73
+ 1. Search all doc locations for files matching the keyword (filename or title):
74
+ - `find .worklog/adrs .worklog/reports .worklog/research docs -name "*.md" | grep -i <keyword>`
75
+ - Also scan `.worklog/decisions.md` for matching ADR titles
76
+ 2. If multiple matches: list them, ask which to open
77
+ 3. If one match: read and display the file
78
+ 4. If none: search file contents — `grep -rl "<keyword>" .worklog/ docs/adr-*.md`
79
+
80
+ ---
81
+
82
+ ## `/worklog-docs new report <title>`
83
+
84
+ Create a new formal report in `.worklog/reports/`.
85
+
86
+ 1. Derive filename from title: lowercase, spaces → underscores, e.g. `performance_audit.md`
87
+ 2. Ask / infer: Is this a sub-topic of an existing report folder? If so, place under that subfolder.
88
+ 3. Write the file with this template:
89
+
90
+ ```markdown
91
+ # <Title>
92
+
93
+ **Generated:** YYYY-MM-DD
94
+ **Scope:** <one-sentence scope>
95
+
96
+ ---
97
+
98
+ ## 1. <Section>
99
+
100
+ ...
101
+
102
+ ## 2. <Section>
103
+
104
+ ...
105
+ ```
106
+
107
+ 4. Confirm: `Created .worklog/reports/<filename>.md`
108
+
109
+ ---
110
+
111
+ ## `/worklog-docs new research <title>`
112
+
113
+ Create a new research/audit note in `.worklog/research/`.
114
+
115
+ 1. Derive filename: lowercase-with-dashes, e.g. `auth-flow-audit.md`
116
+ 2. Write with template:
117
+
118
+ ```markdown
119
+ # <Title>
120
+
121
+ _Date: YYYY-MM-DD_
122
+ _Scope: <one sentence>_
123
+
124
+ ---
125
+
126
+ ## Findings
127
+
128
+ ...
129
+
130
+ ## Open Questions
131
+
132
+ ...
133
+ ```
134
+
135
+ 3. Confirm: `Created .worklog/research/<filename>.md`
136
+
137
+ ---
138
+
139
+ ## `/worklog-docs new adr <title>`
140
+
141
+ Create a new **formal** ADR in `docs/`.
142
+
143
+ 1. Read `docs/` to find the highest existing `adr-NNN-*.md` number; increment
144
+ 2. Derive filename: `adr-NNN-<kebab-title>.md`
145
+ 3. Write with this template:
146
+
147
+ ```markdown
148
+ # ADR-NNN — <Title>
149
+
150
+ **Status:** Accepted
151
+ **Date:** YYYY-MM-DD
152
+ **Deciders:** [author]
153
+
154
+ ---
155
+
156
+ ## Context
157
+
158
+ <Why did this decision come up? What problem does it solve?>
159
+
160
+ ## Decision
161
+
162
+ <What was decided?>
163
+
164
+ ## Alternatives Considered
165
+
166
+ | Option | Reason rejected |
167
+ |---|---|
168
+ | <alt> | <reason> |
169
+
170
+ ## Consequences
171
+
172
+ **Positive:**
173
+ - ...
174
+
175
+ **Negative / Risks:**
176
+ - ...
177
+
178
+ ## References
179
+
180
+ - [link]()
181
+ ```
182
+
183
+ 4. Add a reference line to `docs/architecture.md` if that file exists and the ADR affects architecture.
184
+ 5. Confirm: `Created docs/adr-NNN-<title>.md`
185
+
186
+ ---
187
+
188
+ ## `/worklog-docs new research-adr <title>`
189
+
190
+ Create a deep technical research doc in `.worklog/adrs/` (not a decision — a knowledge dump).
191
+
192
+ 1. Derive filename: `<kebab-title>.md`
193
+ 2. Write with template:
194
+
195
+ ```markdown
196
+ # <Title> — Research
197
+
198
+ _Researched: YYYY-MM-DD_
199
+
200
+ ---
201
+
202
+ ## 1. Findings
203
+
204
+ ...
205
+
206
+ ## 2. Recommended Approach
207
+
208
+ ...
209
+
210
+ ## 3. Key API / Code Patterns
211
+
212
+ ```
213
+
214
+ 3. Confirm: `Created .worklog/adrs/<filename>.md`
215
+
216
+ ---
217
+
218
+ ## Notes
219
+
220
+ - Formal ADRs in `docs/` should be committed and treated as permanent record.
221
+ - Lightweight ADRs in `.worklog/decisions.md` are session-local context that doesn't need a full file.
222
+ - When recording a major decision, use the formal ADR path if the decision will affect future sessions or new contributors.
223
+ - Use `/worklog-decide` for small, quick decisions that don't warrant a full ADR file.
224
+ - The `.worklog/adrs/` folder holds research (pre-decision knowledge), not decisions — don't confuse it with `docs/adr-*.md` formal ADRs.
@@ -0,0 +1,78 @@
1
+ ---
2
+ name: worklog-todo
3
+ description: Manage the cross-session todo list in .worklog/todos.json. Use when the user wants to add, complete, list, or edit todos. Args: "list" (default), "add <title>", "done <id>", "drop <id>".
4
+ ---
5
+
6
+ # Worklog — Todo Management
7
+
8
+ Manages `.worklog/todos.json`.
9
+
10
+ ## Schema
11
+
12
+ ```json
13
+ {
14
+ "version": 1,
15
+ "todos": [
16
+ {
17
+ "id": "NNN",
18
+ "title": "...",
19
+ "status": "open | done | dropped",
20
+ "priority": "high | medium | low",
21
+ "created": "YYYY-MM-DD",
22
+ "closed": "YYYY-MM-DD",
23
+ "notes": "optional context or file references"
24
+ }
25
+ ]
26
+ }
27
+ ```
28
+
29
+ ---
30
+
31
+ ## `/worklog-todo` or `/worklog-todo list`
32
+
33
+ 1. Read `.worklog/todos.json`
34
+ 2. Print open items grouped by priority (high first), then a count of done/dropped items
35
+
36
+ ```
37
+ ### Open TODOs
38
+
39
+ [high] 001 — Description
40
+ Created 2026-06-20 | Notes: ...
41
+
42
+ [medium] 002 — ...
43
+
44
+ --- 1 done, 0 dropped ---
45
+ ```
46
+
47
+ ---
48
+
49
+ ## `/worklog-todo add <title>`
50
+
51
+ 1. Read `.worklog/todos.json`
52
+ 2. Generate next ID (max existing ID + 1, zero-padded to 3 digits)
53
+ 3. Ask priority if not obvious from context (default: medium)
54
+ 4. Append new todo with `"status": "open"`, today's date
55
+ 5. Write file
56
+ 6. Confirm: `Added TODO-NNN: <title>`
57
+
58
+ ---
59
+
60
+ ## `/worklog-todo done <id>`
61
+
62
+ 1. Read `.worklog/todos.json`
63
+ 2. Find item with matching id
64
+ 3. Set `"status": "done"`, add `"closed": "YYYY-MM-DD"`
65
+ 4. Write file
66
+ 5. Confirm: `Marked TODO-NNN done: <title>`
67
+
68
+ ---
69
+
70
+ ## `/worklog-todo drop <id>`
71
+
72
+ Same as `done` but sets `"status": "dropped"` and `"closed": "YYYY-MM-DD"`. Use when a todo is no longer relevant.
73
+
74
+ ---
75
+
76
+ ## `/worklog-todo note <id> <text>`
77
+
78
+ Appends to the `notes` field of an existing todo.