@picoai/tickets 0.1.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/.tickets/spec/AGENTS_EXAMPLE.md +16 -0
- package/.tickets/spec/TICKETS.md +469 -0
- package/.tickets/spec/version/20260205-tickets-spec.md +34 -0
- package/.tickets/spec/version/PROPOSED-tickets-spec.md +15 -0
- package/LICENSE +201 -0
- package/README.md +228 -0
- package/bin/tickets.js +5 -0
- package/package.json +39 -0
- package/src/cli.js +1488 -0
- package/src/lib/constants.js +7 -0
- package/src/lib/listing.js +85 -0
- package/src/lib/repair.js +338 -0
- package/src/lib/util.js +146 -0
- package/src/lib/validation.js +482 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
This file is an example for agent harnesses. Rename or copy it to `AGENTS.md` if your tooling reads it.
|
|
2
|
+
|
|
3
|
+
The purpose of this bootstrap is to ensure an agent loads the canonical workflow from `TICKETS.md` before doing any work.
|
|
4
|
+
|
|
5
|
+
## Ticketing Workflow
|
|
6
|
+
|
|
7
|
+
### Required Behavior
|
|
8
|
+
- First action: open and read `TICKETS.md` (canonical ticket workflow and rules).
|
|
9
|
+
- First response: briefly confirm understanding of the ticketing system described in `TICKETS.md` before starting any implementation work.
|
|
10
|
+
- Use the repo-local CLI (`npx @picoai/tickets`) as the integration surface for tickets and logs.
|
|
11
|
+
- Before performing work on a ticket, validate it: run `npx @picoai/tickets validate` (or `npx @picoai/tickets validate --issues` + `npx @picoai/tickets repair`).
|
|
12
|
+
- When logging via the CLI: use `npx @picoai/tickets log --machine` so logs are strictly structured.
|
|
13
|
+
- Respect `assignment.mode` and any `agent_limits` in the ticket/config.
|
|
14
|
+
|
|
15
|
+
### Bootstrapping TICKETS.md
|
|
16
|
+
- If `.tickets/` or `TICKETS.md` are missing, run `npx @picoai/tickets init`.
|
|
@@ -0,0 +1,469 @@
|
|
|
1
|
+
# TICKETS.md - Agent-First In-Repo Ticketing
|
|
2
|
+
|
|
3
|
+
This document defines the agent-first in-repo ticketing workflow with explicit ownership boundaries.
|
|
4
|
+
|
|
5
|
+
## Ownership Boundaries
|
|
6
|
+
|
|
7
|
+
- About TICKETS.md (may be overwritten): content inside `@picoai/tickets:managed` markers.
|
|
8
|
+
- This is where canonical, interoperable system rules live.
|
|
9
|
+
- `npx @picoai/tickets init --apply` may replace this section (marker-scoped update).
|
|
10
|
+
- User-Owned Extensions (safe to customize): content inside `@picoai/tickets:user` markers.
|
|
11
|
+
- This is where teams add local policy, integrations, and reusable preferences.
|
|
12
|
+
- Tooling should not overwrite this section.
|
|
13
|
+
|
|
14
|
+
## Init and Apply Behavior
|
|
15
|
+
|
|
16
|
+
- `init`:
|
|
17
|
+
- creates missing repo assets (including root `TICKETS.md`).
|
|
18
|
+
- `init --apply`:
|
|
19
|
+
- replaces the managed section only (no heading-level merge across the full document),
|
|
20
|
+
- preserves user-owned content.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
<!-- @picoai/tickets:managed:start -->
|
|
25
|
+
## About TICKETS.md (May Be Overwritten by `init --apply`)
|
|
26
|
+
|
|
27
|
+
_This section mirrors current canonical `TICKETS.md` content to preserve behavior and compatibility._
|
|
28
|
+
|
|
29
|
+
This repository uses a repo-native ticketing system designed for **parallel, long-running agentic work** and normal human collaboration, without relying on external services or internet access.
|
|
30
|
+
|
|
31
|
+
**TICKETS.md ** explains the workflow, file formats, and required tool usage for both humans and agents. If there is ever a conflict between this file and other docs, follow this file.
|
|
32
|
+
|
|
33
|
+
## Spec version
|
|
34
|
+
- `version`: 1
|
|
35
|
+
- `version_url`: `version/20260205-tickets-spec.md`
|
|
36
|
+
- Local file: `/.tickets/spec/version/20260205-tickets-spec.md`
|
|
37
|
+
|
|
38
|
+
Version definitions live under `/.tickets/spec/version/`. Each spec file is self-contained and ends with a diff from the previous version.
|
|
39
|
+
|
|
40
|
+
## What this system is
|
|
41
|
+
- A lightweight, Markdown-first ticket format stored under `/.tickets/`.
|
|
42
|
+
- A merge-friendly history model: **append-only JSONL run logs**, one file per run, per ticket.
|
|
43
|
+
- A repo-local CLI (`npx @picoai/tickets`) that is the **single integration surface** for humans, agents, and IDE/agentic tooling.
|
|
44
|
+
|
|
45
|
+
## What this is trying to do
|
|
46
|
+
Parallel, long-running agentic work fails in predictable ways:
|
|
47
|
+
- Agents lose context across runs/sandboxes.
|
|
48
|
+
- Ticket “state” can drift across branches before merge (eventual consistency).
|
|
49
|
+
- Shared mutable log files are merge-conflict hotspots.
|
|
50
|
+
- Agents can loop without clear “done” criteria or verification steps.
|
|
51
|
+
|
|
52
|
+
This system addresses those problems with stable `ticket.md` files, merge-friendly per-run logs, and explicit acceptance + verification + bounded iteration guidance.
|
|
53
|
+
|
|
54
|
+
## Non-negotiables (for merge safety and auditability)
|
|
55
|
+
- **Keep `ticket.md` stable and human-readable.** Put history in run logs.
|
|
56
|
+
- **Append-only logs.** Never rewrite or delete log lines.
|
|
57
|
+
- **Use the repo-local CLI for automation.** Don’t invent parallel formats.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Quickstart (humans and agents)
|
|
62
|
+
|
|
63
|
+
### Initialize
|
|
64
|
+
Create the repo structure and templates (idempotent):
|
|
65
|
+
- `npx @picoai/tickets init`
|
|
66
|
+
- Add `--examples` to generate example tickets (7 sample tickets with required/optional fields, relationships, and logs).
|
|
67
|
+
- Add `--apply` to upsert/create the managed `## Ticketing Workflow` block in `AGENTS.md` from `AGENTS_EXAMPLE.md` (without creating `AGENTS_EXAMPLE.md` in the target repo).
|
|
68
|
+
- With `--apply`, `TICKETS.md` updates are marker-scoped: the managed block is replaced and metadata refreshed, while user-owned sections remain unchanged.
|
|
69
|
+
|
|
70
|
+
Default `init` creates (if missing): `/.tickets/`, `TICKETS.md`, `AGENTS_EXAMPLE.md`, and `/.tickets/spec/version/`.
|
|
71
|
+
|
|
72
|
+
### Create a ticket
|
|
73
|
+
- `npx @picoai/tickets new --title "Short title"` (defaults: `status: todo`, `created_at: now`)
|
|
74
|
+
- Optional flags to set front matter at creation:
|
|
75
|
+
- `--status todo|doing|blocked|done|canceled`
|
|
76
|
+
- `--priority low|medium|high|critical`
|
|
77
|
+
- `--label <label>` (repeatable)
|
|
78
|
+
- `--assignment-mode human_only|agent_only|mixed`
|
|
79
|
+
- `--assignment-owner <@user|team:...|agent:...>`
|
|
80
|
+
- `--dependency <ticket-id>` `--block <ticket-id>` `--related <ticket-id>` (repeatable)
|
|
81
|
+
- `--iteration-timebox-minutes <int>` `--max-iterations <int>` `--max-tool-calls <int>` `--checkpoint-every-minutes <int>`
|
|
82
|
+
- `--verification-command "<cmd>"` (repeatable)
|
|
83
|
+
- `--created-at <ISO8601 UTC>`
|
|
84
|
+
|
|
85
|
+
This prints the new ticket ID (a lowercase UUIDv7) and creates:
|
|
86
|
+
- `/.tickets/<ticket-id>/ticket.md`
|
|
87
|
+
- `/.tickets/<ticket-id>/logs/`
|
|
88
|
+
|
|
89
|
+
### Validate, then work
|
|
90
|
+
- `npx @picoai/tickets validate`
|
|
91
|
+
- Add `--all-fields` to also validate optional front-matter (priority, labels, assignment.owner, verification.commands) and include those in `--issues` reports.
|
|
92
|
+
|
|
93
|
+
If validation fails and you want a complete report + repair plan:
|
|
94
|
+
- `npx @picoai/tickets validate --issues --all-fields > issues.yaml`
|
|
95
|
+
- `npx @picoai/tickets repair --issues-file issues.yaml --all-fields --non-interactive`
|
|
96
|
+
|
|
97
|
+
### Log your work (human or agent)
|
|
98
|
+
Use the CLI to write logs whenever possible (merge-friendly, structured, and tooling-validated).
|
|
99
|
+
|
|
100
|
+
Agentic tools (including human-invoked tools like Cursor/Windsurf/Codex CLI/Claude Code) SHOULD log with `--machine`:
|
|
101
|
+
- `npx @picoai/tickets log --ticket <id> --actor-type agent --actor-id "cursor (human:@alice)" --summary "Implemented validator." --machine`
|
|
102
|
+
|
|
103
|
+
Humans can log without machine marker:
|
|
104
|
+
- `npx @picoai/tickets log --ticket <id> --actor-type human --actor-id "@alice" --summary "Investigated failing test; will retry tomorrow."`
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Repository layout
|
|
109
|
+
- Canonical workflow guide: `TICKETS.md`
|
|
110
|
+
- Ticket storage root: `/.tickets/`
|
|
111
|
+
- One ticket per directory: `/.tickets/<ticket-id>/`
|
|
112
|
+
- Ticket definition: `/.tickets/<ticket-id>/ticket.md`
|
|
113
|
+
- Run logs: `/.tickets/<ticket-id>/logs/<run_started>-<run_id>.jsonl`
|
|
114
|
+
|
|
115
|
+
Notes:
|
|
116
|
+
- `<ticket-id>` is a **lowercase UUIDv7** string.
|
|
117
|
+
- Tooling MUST NOT require the directory name to match the `id` in front matter (convention only).
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Ticket definition (`ticket.md`)
|
|
122
|
+
Ticket files are Markdown documents with YAML front matter and a Markdown body.
|
|
123
|
+
|
|
124
|
+
### YAML front matter
|
|
125
|
+
Front matter MUST start at the first line and be enclosed by `---`.
|
|
126
|
+
|
|
127
|
+
#### Required fields
|
|
128
|
+
- `id`: lowercase UUIDv7 string
|
|
129
|
+
- `version`: format version (integer)
|
|
130
|
+
- `version_url`: path to the definition for this version (repo-local, relative to `.tickets/spec/`)
|
|
131
|
+
- `title`: string
|
|
132
|
+
- `status`: `todo|doing|blocked|done|canceled`
|
|
133
|
+
- `created_at`: ISO 8601 timestamp in UTC (use `Z`)
|
|
134
|
+
|
|
135
|
+
Example:
|
|
136
|
+
|
|
137
|
+
```md
|
|
138
|
+
---
|
|
139
|
+
id: 0191c2d3-4e5f-7a8b-9c0d-1e2f3a4b5c6d
|
|
140
|
+
version: 1
|
|
141
|
+
version_url: "version/20260205-tickets-spec.md"
|
|
142
|
+
title: "Add tickets validate --issues"
|
|
143
|
+
status: todo
|
|
144
|
+
created_at: 2026-01-29T18:42:10Z
|
|
145
|
+
---
|
|
146
|
+
# Ticket
|
|
147
|
+
...
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
#### Optional fields
|
|
151
|
+
**Assignment and mode**
|
|
152
|
+
```yaml
|
|
153
|
+
assignment:
|
|
154
|
+
mode: mixed # human_only | agent_only | mixed
|
|
155
|
+
owner: null # "@alice", "team:core", "agent:codex"
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**Priority and labels**
|
|
159
|
+
```yaml
|
|
160
|
+
priority: medium # low | medium | high | critical
|
|
161
|
+
labels: ["bug", "docs"]
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
**Relationships (the only ones written in v1)**
|
|
165
|
+
```yaml
|
|
166
|
+
dependencies: [] # ticket IDs this ticket depends on
|
|
167
|
+
blocks: [] # ticket IDs this ticket blocks
|
|
168
|
+
related: [] # ticket IDs related to this ticket
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
**Agent limits (hard limits for agents)**
|
|
172
|
+
```yaml
|
|
173
|
+
agent_limits:
|
|
174
|
+
iteration_timebox_minutes: 20
|
|
175
|
+
max_iterations: 6
|
|
176
|
+
max_tool_calls: 80
|
|
177
|
+
checkpoint_every_minutes: 5
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
**Verification commands**
|
|
181
|
+
```yaml
|
|
182
|
+
verification:
|
|
183
|
+
commands:
|
|
184
|
+
- "npm test"
|
|
185
|
+
- "npx @picoai/tickets validate"
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Important:
|
|
189
|
+
- Other relationship views (parent/child rollups, duplicates, supersedes, reverse edges, etc.) are computed by tooling and MUST NOT be persisted in `ticket.md`.
|
|
190
|
+
- There is no `updated_at`. “Last updated” is derived from log timestamps (`ts`).
|
|
191
|
+
|
|
192
|
+
**Custom fields (namespaced)**
|
|
193
|
+
```yaml
|
|
194
|
+
custom:
|
|
195
|
+
my_org_priority: "P1"
|
|
196
|
+
upstream_ref: "RFC-42"
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Custom fields MUST live under `custom` to avoid collisions. Tooling should ignore unknown keys under `custom`.
|
|
200
|
+
Extensions are repo-local; use a clear prefix for keys and avoid introducing new top-level extension fields.
|
|
201
|
+
|
|
202
|
+
### Versioning
|
|
203
|
+
- `version` is an integer format version (current: `1`).
|
|
204
|
+
- `version_url` must point to the repo-local definition for that version.
|
|
205
|
+
- Version files live under `/.tickets/spec/version/` and end with a diff from the previous version.
|
|
206
|
+
- New tooling must read older versions. If `version` is missing, tools may assume `1` and warn.
|
|
207
|
+
- Bumps are rare and only when a change cannot be expressed additively.
|
|
208
|
+
|
|
209
|
+
### Ticket body sections (required)
|
|
210
|
+
The ticket body MUST include these sections (at least the headings):
|
|
211
|
+
- `# Ticket`
|
|
212
|
+
- `## Description`
|
|
213
|
+
- `## Acceptance Criteria` (checkable list)
|
|
214
|
+
- `## Verification` (commands or steps)
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## Status model
|
|
219
|
+
Status values: `todo`, `doing`, `blocked`, `done`, `canceled`.
|
|
220
|
+
|
|
221
|
+
Recommended transitions:
|
|
222
|
+
- `todo` -> `doing` | `canceled`
|
|
223
|
+
- `doing` -> `blocked` | `done` | `canceled`
|
|
224
|
+
- `blocked` -> `doing` | `canceled`
|
|
225
|
+
- `done` and `canceled` are immutable unless explicitly reopened by a human (set to `doing` and log why).
|
|
226
|
+
|
|
227
|
+
Status updates:
|
|
228
|
+
- `npx @picoai/tickets status --ticket <id> --status doing --log`
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## Run logs (append-only JSONL)
|
|
233
|
+
Every ticket directory has `logs/`. Logs are where history lives; they are designed to be merge-friendly under parallel work.
|
|
234
|
+
|
|
235
|
+
### File naming: `<run_started>-<run_id>.jsonl`
|
|
236
|
+
- `run_started` is the run start time (UTC). It is a *hint* for processing order (tools may process newer runs first by sorting filenames).
|
|
237
|
+
- Tools SHOULD emit `run_started` in ISO 8601 **basic** form for filenames, e.g. `20260129T184210.123Z`.
|
|
238
|
+
- `run_id` is an identifier for the run (tool-generated unless provided).
|
|
239
|
+
|
|
240
|
+
Example filename:
|
|
241
|
+
- `/.tickets/<id>/logs/20260129T184210.123Z-0191c2d3-....jsonl`
|
|
242
|
+
|
|
243
|
+
### `ts` vs `run_started`
|
|
244
|
+
- `run_started` is constant for a given run file (and appears on every line so each JSON object is self-contained).
|
|
245
|
+
- `ts` is per entry (the moment that particular log entry was written).
|
|
246
|
+
- “Last updated” is derived from the newest `ts` across all logs, not from filenames.
|
|
247
|
+
|
|
248
|
+
### Log entry schema (one JSON object per line)
|
|
249
|
+
Required fields:
|
|
250
|
+
- `version`: format version (integer)
|
|
251
|
+
- `version_url`: path to the definition for this version (repo-local, relative to `.tickets/spec/`)
|
|
252
|
+
- `ts`: ISO 8601 UTC timestamp for the entry
|
|
253
|
+
- `run_started`: ISO 8601 UTC timestamp (same for all entries in the file)
|
|
254
|
+
- `actor_type`: `human|agent`
|
|
255
|
+
- `actor_id`: string identifier (freeform)
|
|
256
|
+
- `summary`: short summary string
|
|
257
|
+
- `context`: `[...]` (bullets capturing the context relevant to this run; when splitting, include copied/adapted inputs from the parent)
|
|
258
|
+
|
|
259
|
+
Optional structured fields (recommended):
|
|
260
|
+
- `changes`: `{files: [...], commits: [...], prs: [...]}`
|
|
261
|
+
- `verification`: `{commands: [...], results: "pass|fail|explain why not run"}`
|
|
262
|
+
- `tickets_created`: `[...]` (ticket IDs created during this run)
|
|
263
|
+
- `created_from`: string (parent ticket ID when created by splitting)
|
|
264
|
+
- `decisions`, `next_steps`, `blockers`: lists of strings
|
|
265
|
+
- `custom`: `{...}` (namespaced custom data)
|
|
266
|
+
|
|
267
|
+
Machine marker:
|
|
268
|
+
- If a log entry is written by the `tickets` CLI with `--machine`, it MUST include a machine marker:
|
|
269
|
+
- `written_by: "tickets"` or `machine: true`
|
|
270
|
+
|
|
271
|
+
Validation strictness:
|
|
272
|
+
- Machine-marked entries are validated strictly.
|
|
273
|
+
- Non-machine entries are validated best-effort (warnings by default), so humans can jot notes without breaking the system.
|
|
274
|
+
|
|
275
|
+
Example machine-written entry:
|
|
276
|
+
```json
|
|
277
|
+
{"version":1,"version_url":"version/20260205-tickets-spec.md","ts":"2026-01-29T18:50:00Z","run_started":"20260129T184210.123Z","actor_type":"agent","actor_id":"codex-cli (human:@alice)","summary":"Implemented tickets validate --issues.","context":["Inputs: AC from ticket, API schema v2"],"verification":{"commands":["npx @picoai/tickets validate"],"results":"pass"},"written_by":"tickets"}
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
Merge conflict rule (rare):
|
|
281
|
+
- If a `.jsonl` file conflicts, keep all lines from both sides; do not “clean up” history.
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
## Required tool usage (agents and automation)
|
|
286
|
+
To keep state consistent and merge-friendly, agents and agentic tools SHOULD use the CLI for ticket operations:
|
|
287
|
+
- Create tickets: `npx @picoai/tickets new`
|
|
288
|
+
- Validate: `npx @picoai/tickets validate` (or `--issues` for a full report)
|
|
289
|
+
- Repair: `npx @picoai/tickets repair --issues-file ...`
|
|
290
|
+
- Status changes: `npx @picoai/tickets status --log`
|
|
291
|
+
- Work logs: `npx @picoai/tickets log` (use `--machine` when the entry is tooling-written)
|
|
292
|
+
- Listing/triage: `npx @picoai/tickets list` (use `--json` for automation)
|
|
293
|
+
|
|
294
|
+
Humans may edit `ticket.md` directly (it is designed for that), but logs should be appended via the CLI whenever feasible.
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
## Agent task assignment at launch time
|
|
299
|
+
|
|
300
|
+
### Principle
|
|
301
|
+
Agents SHOULD NOT choose tickets autonomously by default. In this system, a human or orchestrator assigns a specific ticket (or a small set of tickets) to each agent run. This avoids duplicate work when multiple agents operate from the same repo snapshot and cannot coordinate live.
|
|
302
|
+
|
|
303
|
+
### Required inputs for any agent run
|
|
304
|
+
Every agent run MUST be given, in its initial instructions (prompt, task description, CLI args, PR comment, IDE task, etc.):
|
|
305
|
+
|
|
306
|
+
1. Ticket locator
|
|
307
|
+
- A ticket ID, which maps to the ticket definition at:
|
|
308
|
+
- `/.tickets/<ticket-id>/ticket.md`
|
|
309
|
+
|
|
310
|
+
2. Task scope
|
|
311
|
+
- A short statement of what the agent is expected to do on that ticket (for example: "implement acceptance criteria", "fix failing tests", "investigate and report").
|
|
312
|
+
|
|
313
|
+
3. Run limits
|
|
314
|
+
- The run's execution limits (timebox / max tool calls / max iterations), if the ticket defines them. Agents must treat these as hard stop conditions.
|
|
315
|
+
|
|
316
|
+
### Standard instruction template
|
|
317
|
+
When launching an agent, use the following template (adapt as needed to the agent tool, but keep the semantics):
|
|
318
|
+
|
|
319
|
+
- Ticket: `<ticket-id>`
|
|
320
|
+
- Ticket file: `/.tickets/<ticket-id>/ticket.md`
|
|
321
|
+
- Scope: `<what to do>`
|
|
322
|
+
- Limits: follow `agent_limits` in the ticket (or repo defaults if not present)
|
|
323
|
+
- Stop behavior: on limit hit, stop work and write a run log entry to:
|
|
324
|
+
- `/.tickets/<ticket-id>/logs/<run_started>-<run_id>.jsonl`
|
|
325
|
+
|
|
326
|
+
### Mandatory agent procedure (vendor-agnostic)
|
|
327
|
+
Given a ticket assignment, an agent must:
|
|
328
|
+
|
|
329
|
+
1. Open the ticket file at `/.tickets/<ticket-id>/ticket.md`.
|
|
330
|
+
2. Identify acceptance criteria and verification steps from the ticket.
|
|
331
|
+
3. Plan minimally: determine the smallest change set that satisfies the acceptance criteria.
|
|
332
|
+
4. Implement within limits.
|
|
333
|
+
5. Verify using the ticket's verification steps (or reasonable defaults if absent).
|
|
334
|
+
6. Log the run:
|
|
335
|
+
- Write progress and outcomes to a per-run log file:
|
|
336
|
+
- `/.tickets/<ticket-id>/logs/<run_started>-<run_id>.jsonl`
|
|
337
|
+
- Include a `context` field capturing the relevant context for this run (copied/adapted inputs, decisions carried in, and any subticket handoff details).
|
|
338
|
+
- If the agent cannot write files, it must output the log content in its final response so a human/tool can persist it.
|
|
339
|
+
|
|
340
|
+
### What to do if the ticket is missing or invalid
|
|
341
|
+
If the assigned ticket file cannot be found, or is missing required sections:
|
|
342
|
+
- The agent must not proceed with implementation.
|
|
343
|
+
- The agent must log the issue and request clarification, or propose a minimal ticket fix as its output.
|
|
344
|
+
|
|
345
|
+
### Multi-ticket assignments (rare)
|
|
346
|
+
If an agent is assigned more than one ticket in a single run:
|
|
347
|
+
- The run instructions must list ticket IDs in priority order.
|
|
348
|
+
- The agent must work on only one ticket at a time, logging separately under each ticket’s logs directory.
|
|
349
|
+
- Prefer splitting work into separate runs for clarity.
|
|
350
|
+
|
|
351
|
+
### Human responsibility
|
|
352
|
+
Humans (or an orchestrator) are responsible for:
|
|
353
|
+
- selecting which tickets are assigned to which agents
|
|
354
|
+
- ensuring two agents are not intentionally assigned the same ticket unless parallel exploration is desired
|
|
355
|
+
|
|
356
|
+
---
|
|
357
|
+
|
|
358
|
+
## Agent workflow (recommended protocol)
|
|
359
|
+
Agents MUST:
|
|
360
|
+
- Read the ticket before starting work.
|
|
361
|
+
- Respect `assignment.mode` (do not work tickets marked `human_only`).
|
|
362
|
+
- Respect hard limits in `agent_limits`; if a limit is reached, stop and write a log entry.
|
|
363
|
+
- At the end of an iteration (success or failure), write a log entry that includes the `context` for that iteration and verification results (or why verification was not run).
|
|
364
|
+
- If `max_iterations` is reached without completion, stop and log a recommendation (tighten criteria, split subtickets, or request a human decision).
|
|
365
|
+
|
|
366
|
+
Humans using agentic coding tools can follow the same protocol; use `--machine` logging with `actor_type: agent` and an `actor_id` that names the tool and the human (e.g., `cursor (human:@alice)`).
|
|
367
|
+
|
|
368
|
+
---
|
|
369
|
+
|
|
370
|
+
## Splitting tickets (subtickets) in parallel workflows
|
|
371
|
+
If an agent discovers a ticket is too large or should be parallelized:
|
|
372
|
+
1) Create subtickets with `npx @picoai/tickets new`.
|
|
373
|
+
2) Link with `related` (and only use `dependencies`/`blocks` when there is a real ordering constraint).
|
|
374
|
+
3) Log the split on the original ticket and include `tickets_created`.
|
|
375
|
+
4) Ensure each new ticket is executable in isolation by copying/adapting the minimum required context into the child `ticket.md`, and writing a first child log entry that includes `created_from` and `context` (the carried-over bullets).
|
|
376
|
+
|
|
377
|
+
Avoid maintaining an authoritative “subtickets list” by frequently editing the parent `ticket.md` (it’s a merge-conflict hotspot). Prefer derived views and logs.
|
|
378
|
+
|
|
379
|
+
---
|
|
380
|
+
|
|
381
|
+
## Validation, issues reports, and repair
|
|
382
|
+
- `npx @picoai/tickets validate`:
|
|
383
|
+
- exit `0`: ok
|
|
384
|
+
- exit `1`: validation errors
|
|
385
|
+
- exit `2`: tooling/IO errors
|
|
386
|
+
- Add `--all-fields` to validate optional front-matter (priority, labels, assignment.owner, verification.commands) and include corresponding repairs in `--issues` output.
|
|
387
|
+
|
|
388
|
+
- `npx @picoai/tickets validate --issues` emits a machine-readable report with:
|
|
389
|
+
- all `issues` (errors and warnings), and
|
|
390
|
+
- a `repairs` section that can be edited and consumed by `tickets repair` in `--non-interactive` mode.
|
|
391
|
+
- Use `--all-fields` with `validate` and `repair` when you want optional front-matter fields to be checked and fixed.
|
|
392
|
+
- Use `--interactive` with `repair` to step through each fix, see what’s expected, and supply values (include `--all-fields` to cover optional fields too).
|
|
393
|
+
|
|
394
|
+
Minimal shape (example):
|
|
395
|
+
```yaml
|
|
396
|
+
schema_version: 1
|
|
397
|
+
tool: "tickets"
|
|
398
|
+
generated_at: "2026-01-29T00:00:00Z"
|
|
399
|
+
issues: []
|
|
400
|
+
repairs:
|
|
401
|
+
- id: "R0001"
|
|
402
|
+
enabled: false
|
|
403
|
+
safe: true
|
|
404
|
+
action: "add_sections"
|
|
405
|
+
ticket_path: "/.tickets/<id>/ticket.md"
|
|
406
|
+
params: {}
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
- `npx @picoai/tickets repair --issues-file <path>` applies enabled repairs:
|
|
410
|
+
- Safe repairs can be non-interactive.
|
|
411
|
+
- Disruptive repairs (like changing `id`) must have explicit decisions filled in (or require interactive mode).
|
|
412
|
+
|
|
413
|
+
---
|
|
414
|
+
|
|
415
|
+
## Safety & hygiene
|
|
416
|
+
- Do not write secrets into tickets or logs.
|
|
417
|
+
- Avoid pasting large environment dumps into logs.
|
|
418
|
+
- Prefer minimal diffs; avoid unrelated refactors.
|
|
419
|
+
- When in doubt, add a log entry with decisions and next steps, and hand off.
|
|
420
|
+
<!-- @picoai/tickets:managed:end -->
|
|
421
|
+
|
|
422
|
+
---
|
|
423
|
+
|
|
424
|
+
<!-- @picoai/tickets:user:start -->
|
|
425
|
+
## User-Owned Extensions (Safe to Customize)
|
|
426
|
+
|
|
427
|
+
This section is intended for ongoing team customization and expansion.
|
|
428
|
+
|
|
429
|
+
### Working Agreements (Reusable Preferences)
|
|
430
|
+
|
|
431
|
+
Use this section for reusable team preferences agents should apply by default.
|
|
432
|
+
|
|
433
|
+
Examples:
|
|
434
|
+
- decomposition preference (smaller tickets vs milestone-oriented tickets)
|
|
435
|
+
- required human checkpoints for risky changes
|
|
436
|
+
- default verification evidence format
|
|
437
|
+
- branch/PR naming conventions
|
|
438
|
+
- handoff expectations for agent-to-human and agent-to-agent transitions
|
|
439
|
+
|
|
440
|
+
### External System Mapping (Product/Design/Engineering + Agent Teams)
|
|
441
|
+
|
|
442
|
+
Document how external systems map to in-repo tickets.
|
|
443
|
+
|
|
444
|
+
Recommended fields to document:
|
|
445
|
+
- source systems (Jira/Linear/Notion/Figma/etc.)
|
|
446
|
+
- external state -> canonical `status` mapping
|
|
447
|
+
- assignment and ownership boundaries (human teams vs agent teams/swarms)
|
|
448
|
+
- synchronization rules and conflict resolution approach
|
|
449
|
+
|
|
450
|
+
### Local Custom Policy
|
|
451
|
+
|
|
452
|
+
Use this area for repo-specific policy that should not be overwritten.
|
|
453
|
+
|
|
454
|
+
Examples:
|
|
455
|
+
- additional review gates before moving ticket status to `done`
|
|
456
|
+
- rules for high-risk or production-impacting changes
|
|
457
|
+
- release-note and changelog policy
|
|
458
|
+
|
|
459
|
+
### Optional Team Metadata Conventions
|
|
460
|
+
|
|
461
|
+
If teams need additional metadata, prefer `custom.*` namespaced keys in ticket front matter and logs.
|
|
462
|
+
|
|
463
|
+
Examples:
|
|
464
|
+
- `custom.external.ticket_id`
|
|
465
|
+
- `custom.external.state`
|
|
466
|
+
- `custom.routing.queue`
|
|
467
|
+
- `custom.design.figma_url`
|
|
468
|
+
|
|
469
|
+
<!-- @picoai/tickets:user:end -->
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Ticket Format Spec (Version 1)
|
|
2
|
+
|
|
3
|
+
- Version: 1
|
|
4
|
+
- Version URL: `version/20260205-tickets-spec.md`
|
|
5
|
+
- Released: 2026-02-05
|
|
6
|
+
- Status: current
|
|
7
|
+
|
|
8
|
+
## Definition (format only)
|
|
9
|
+
This version defines the ticket and log formats used by this repo. It does not define workflow policy; see `TICKETS.md` for full workflow.
|
|
10
|
+
|
|
11
|
+
### Ticket front matter (required)
|
|
12
|
+
- `id`: lowercase UUIDv7 string
|
|
13
|
+
- `version`: format version (integer)
|
|
14
|
+
- `version_url`: path to this definition (repo-local, relative to `.tickets/spec/`)
|
|
15
|
+
- `title`: string
|
|
16
|
+
- `status`: `todo|doing|blocked|done|canceled`
|
|
17
|
+
- `created_at`: ISO 8601 UTC timestamp
|
|
18
|
+
|
|
19
|
+
### Log entry (required)
|
|
20
|
+
- `version`: format version (integer)
|
|
21
|
+
- `version_url`: path to this definition (repo-local, relative to `.tickets/spec/`)
|
|
22
|
+
- `ts`: ISO 8601 UTC timestamp
|
|
23
|
+
- `run_started`: ISO 8601 UTC timestamp
|
|
24
|
+
- `actor_type`: `human|agent`
|
|
25
|
+
- `actor_id`: string
|
|
26
|
+
- `summary`: short string
|
|
27
|
+
- `context`: `[...]` (bullets capturing run context)
|
|
28
|
+
|
|
29
|
+
### Extensions
|
|
30
|
+
- Extensions are repo-local and must live under the `custom` key.
|
|
31
|
+
- Tools should ignore unknown keys under `custom`.
|
|
32
|
+
|
|
33
|
+
## Diff from previous version
|
|
34
|
+
- Initial version (no previous version).
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Proposed Ticket Format Spec (Draft)
|
|
2
|
+
|
|
3
|
+
**Status: Draft — not published.**
|
|
4
|
+
|
|
5
|
+
This file is for in-repo discussion and iteration only. Do not reference it from `version_url`.
|
|
6
|
+
|
|
7
|
+
## Intended version
|
|
8
|
+
- Version: (set when ready)
|
|
9
|
+
- Target date: (YYYYMMDD)
|
|
10
|
+
|
|
11
|
+
## Definition (format only)
|
|
12
|
+
(fill in)
|
|
13
|
+
|
|
14
|
+
## Diff from previous version
|
|
15
|
+
(fill in)
|