workflow: project-driven agent workflow (docs-first, TODO/ROADMAP tracking, verify-before-done)
ci / check (macos-latest) (push) Canceled after 0s
ci / check (ubuntu-latest) (push) Canceled after 0s
ci / check (windows-latest) (push) Canceled after 0s

- system prompt gains a Project workflow block when the repo tracks its own
  progress (TODO.md/ROADMAP.md/docs): read the task list first and keep it
  current, spec-first for non-trivial work, complete unit tests, verify before
  declaring done
- TODO.md + ROADMAP.md loaded as 'Project tracker' instruction blocks, capped
  tighter than AGENTS.md so the agent sees the shape without drowning in it
- one soft nudge per session when a turn writes files without touching the
  task list; suppressed when todo_write was called; never a gate
- /workflow command + panel showing TODO/ROADMAP/docs presence, line/file
  counts, nudge state
- config: workflow.enabled (default true), workflow.docsDir (default docs)
- prompt-cache version key extended with wf: so toggling the workflow busts
  the cached system prompt
- docs: docs/workflow.md, configuration table row, ROADMAP + TODO entries
- tests: test/workflow.test.ts (9 tests)

830 tests pass, typecheck clean, build green, live headless demo verified
This commit is contained in:
asepharyana
2026-09-09 19:00:22 +07:00
parent e709737df1
commit a3739eb628
14 changed files with 652 additions and 10 deletions
+83
View File
@@ -0,0 +1,83 @@
# Project-driven agent workflow
Shiro Neko treats a repository the way this project treats itself: progress
tracked in TODO.md and ROADMAP.md, docs-driven development, spec-first plans,
complete unit tests, and verify-before-done. When the repo keeps those files,
the agent's system prompt carries a short workflow policy and the session
tracks whether the workflow is being followed.
## What the agent sees
When the session starts in a git repo that has any of:
- `TODO.md` at the git root
- `ROADMAP.md` at the git root
- a `docs/` directory (configurable with `workflow.docsDir`)
the system prompt gains a "Project workflow" block:
- read TODO.md (the task list) before starting and keep it current as you go
- keep ROADMAP.md current when a milestone ships
- write a short plan first (spec-first) for anything non-trivial
- add tests alongside code; the project expects complete unit tests
- verify with the project's check commands (tests/typecheck/build) before
declaring done
Bare repos (no TODO, ROADMAP, or docs) get no such block — the policy only
renders when the project itself tracks progress, so a throwaway directory does
not collect noise.
TODO.md and ROADMAP.md are also loaded into the conversation like instruction
files (`Project tracker (...)`), capped tighter than AGENTS.md so the agent
sees the shape of the work without filling its context. This mirrors the
existing `AGENTS.md` / `CLAUDE.md` / `.shiro.md` loading: outermost first, git
root down to cwd.
## The nudge
After a turn that wrote files (edit_file, write_file, apply_patch, ...) but
never called `todo_write`, the session emits one soft notice:
```
reminder: you modified files without updating the project task list (TODO.md).
Keep it current: mark what you did.
```
Design constraints:
- **Once per session.** Repeating a nag trains the model to ignore it.
- **Not a gate.** The agent stays in control; this is guidance, not a block.
- **Only when the repo has a TODO/ROADMAP.** A repo that tracks nothing gets
no reminder.
- Suppressed when the turn already called `todo_write` — the task list is
current, nothing to say.
## Configuration
```yaml
workflow:
enabled: true # master switch; default true
docsDir: docs # where the project keeps developer docs; default 'docs'
```
`workflow.enabled: false` disables both the prompt policy and the nudge.
## /workflow
`/workflow` renders a panel with the project's tracking state and the
session's behaviour:
| row | meaning |
|---|---|
| `workflow` | on/off from config |
| `TODO.md` | present? line count |
| `ROADMAP.md` | present? line count |
| `docs dir` | present? file count (bounded at 200) |
| `reminders sent` | whether this session nudged (once, ever) |
## Relationship to AGENTS.md
AGENTS.md-style files are standing orders from the user and override the
agent's defaults. The workflow policy is a default that documents what a
repo tracking its own progress expects. When the two conflict, AGENTS.md
wins — the workflow feature is a floor, not a ceiling.