@atollhq/skill-codex 0.4.25 → 0.4.26

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,139 @@
1
+ # Strategy and heartbeat
2
+
3
+ Read this reference for goals, KPIs, initiatives, targets, heartbeat signals, autonomous prioritization, and strategy-linked execution workflows.
4
+
5
+ ## The Heartbeat Loop
6
+
7
+ The primary pattern for autonomous agents. Prefer `atoll heartbeat --json` when the CLI is available; it wraps `GET /api/orgs/{id}/heartbeat` and returns the same computed briefing:
8
+
9
+ - **Goal status** with days remaining
10
+ - **KPI pace**: `pace_needed` vs `pace_actual`, trend (`accelerating`/`decelerating`/`flat`), staleness
11
+ - **Initiative progress**: total/completed/stalled/blocked issue counts, expected KPI impacts, and initiative targets
12
+ - **Assigned work** for this agent
13
+ - **Project context**: relevant board columns, including optional descriptions that explain stage criteria for agents. Project-scoped guests receive every explicitly accessible board while idle; personal agents retain relevant inherited-project context.
14
+ - **Signals** sorted by severity — the agent's prioritized to-do list
15
+ - **Attention items**: direct current-member notifications such as mentions, assignments, assignee comments, and creator-visible status changes, with an `ack_endpoint` to call after handling
16
+ - **Recommended action**: one deterministic strategy-backed next action when Atoll has enough evidence (`create_work`, `start_work`, `escalate_blocker`, `refresh_metric`, or `investigate`), including why-now, expected impact, first step, success criteria, quality warnings, and any suggested write. An investigation can use `suggested_write.operation: "none"` when heartbeat lacks enough detail for a safe write.
17
+
18
+ Recommendation ordering keeps blockers and urgent initiative targets first, followed by executable work for off-pace KPIs and in-progress work linked to stale KPIs. Signal-backed assigned work (an `issue_stale` signal on the issue or a `milestone_overdue` signal on its milestone) is compared with critical standalone overdue milestones by urgency; the stronger execution or recovery case wins. When a critical milestone wins without assigned work, Atoll recommends investigation before stale-metric maintenance. A stale KPI refresh still precedes creating a new bet, beginning initiative work whose only trigger is KPI staleness and that is not yet underway, or unrelated assigned work.
19
+
20
+ Heartbeat is org-scoped, but project-bound payload details are filtered by the caller's project access. Owners/admins receive full org context; members/guests only receive project-bound strategy, work health, assigned work, milestone signals, and board context for accessible projects. Project-scoped guests receive every explicitly accessible board while idle; personal agents retain relevant inherited-project context. Non-guest members can also see unprojected org-level strategy. Shared initiatives can appear with counts and signals based only on accessible work.
21
+
22
+ Signal types: `kpi_off_pace`, `kpi_stale`, `issue_stale`, `issue_blocked`, `milestone_overdue`, `initiative_stalled`, `initiative_target_due_soon`, `initiative_target_overdue`, `initiative_target_blocked`, `webhook_failing`. Severity: `info`, `warning`, `critical`.
23
+
24
+ Targets under initiatives are commitments, not business KPIs. KPIs measure business outcomes such as MRR, traffic, paying customers, or onboarding success. Use progress targets for initiative outputs such as "publish 10 comparison posts." Use gate targets for launch prerequisites such as "get 5 retailers live by July 5." Gate targets emit stateful due/blocked messages and should not be converted into fractional KPI pace such as "0.07 retailers/day."
25
+
26
+ Useful CLI forms:
27
+
28
+ ```bash
29
+ atoll heartbeat
30
+ atoll heartbeat --signals-only
31
+ atoll heartbeat --severity critical
32
+ atoll heartbeat --json
33
+ ```
34
+
35
+ **The agent loop:**
36
+ 1. Call heartbeat
37
+ 2. Handle direct `attention_items` that need a reply, task update, or blocker follow-up
38
+ 3. Call each handled item's `ack_endpoint`
39
+ 4. Read remaining signals (highest severity first)
40
+ 5. Reason about highest-leverage action given direct attention, gate targets, KPI pace, and initiative state
41
+ 6. Execute (unblock issues, update KPIs, create work, report progress)
42
+ 7. Repeat
43
+
44
+ ## Other Common Workflows
45
+
46
+ ### Pick up and complete a task
47
+
48
+ ```bash
49
+ atoll heartbeat --signals-only # orient first
50
+ atoll issue list --status todo --assignee self --json # find assigned work
51
+ atoll issue update ATOLL-42 --status in_progress --comment-body "Starting because the linked KPI is off pace." # start work with durable context
52
+ atoll comment add ATOLL-42 --body "Progress update…" # report progress
53
+ atoll issue update ATOLL-42 --status done # complete
54
+ ```
55
+
56
+ ### Set up the strategy chain
57
+
58
+ 1. `POST /api/orgs/{id}/goals` -- create goal with `target_date`
59
+ 2. `POST /api/orgs/{id}/kpis` -- attach KPI with `goal_id`, `target_value`, `target_direction`; for launch-style goals you can use `source_type: "formula"` with `source_config.formula: "goal_linked_issue_completion"` to calculate done directly linked and milestone-linked tasks over total linked tasks
60
+ 3. `POST /api/orgs/{id}/kpis/{kpiId}/snapshots` -- record measurement (auto-updates `current_value`)
61
+ 4. `POST /api/orgs/{id}/initiatives` -- create initiative linked to goal
62
+ 5. `POST /api/orgs/{id}/initiatives/{id}/kpi-impacts` -- declare expected KPI impact
63
+ 6. `POST /api/orgs/{id}/initiatives/{id}/targets` -- create progress or gate targets for initiative commitments
64
+ 7. Link issues and milestones to the initiative and to specific targets when the work exists to satisfy that target
65
+
66
+ CLI equivalent:
67
+
68
+ ```bash
69
+ atoll goal create --title "Reach 100 paying customers by Q2" --target-date 2026-06-30
70
+ atoll kpi create --name paying_customers --goal "Reach 100 paying customers by Q2" --unit count --target 100 --current 34
71
+ atoll initiative create --title "Content pipeline" --goal "Reach 100 paying customers by Q2" --status active
72
+ atoll initiative kpi link "Content pipeline" paying_customers --impact "+30 customers/mo"
73
+ atoll initiative target create "Content pipeline" --title "Publish 10 comparison posts" --mode progress --target 10 --current 0 --unit count --unit-label posts
74
+ atoll initiative target create "Retailer coverage" --title "Get 5 retailers live by July 5" --mode gate --target 5 --current 0 --unit count --unit-label retailers --target-date 2026-07-05 --due-soon-days 7
75
+ atoll kpi snapshot add paying_customers --value 42 --initiative "Content pipeline" --issue ATOLL-42 --note "End-of-week Stripe check"
76
+ atoll kpi snapshot list paying_customers --include-attribution --json
77
+ ```
78
+
79
+ Project-scoped agent profiles apply their default project to `atoll initiative list` and `atoll initiative create`. Use `--project <id-or-slug>` to override that project, or `--org-wide` to intentionally suppress the default project. API callers can pass `project_id` or `projectId` on create, and `?project_id=...` on list; guest/project-scoped callers must use a project they can access, and create requires edit/admin project access. Projectless organization-wide initiative creation requires an organization owner/admin.
80
+
81
+ Project-linked initiative reads require access to at least one linked project.
82
+ The authoritative set includes explicit project links and projects inferred
83
+ from direct issue/milestone links. Updating an initiative or mutating its issue,
84
+ milestone, or target links requires edit/admin access to every linked project;
85
+ a requested issue or milestone project must already be linked when it is
86
+ project-bound. Eligible non-guests may link and unlink writable projectless
87
+ issues; projectless milestones are unsupported. KPI-impact reads omit
88
+ unreadable KPIs; linking or unlinking a KPI impact requires write access to the
89
+ initiative and read access to the same-org KPI, but not KPI Strategy write
90
+ access.
91
+ The initiative issue-link and initiative-target issue-link POST bodies accept
92
+ issue UUIDs, bare numbers, `#number`, `ATOLL-number`, `TSK-number`, or
93
+ unambiguous project-derived prefixes. The initiative-level milestone-link POST
94
+ body accepts a milestone UUID or exact name; target milestone links remain
95
+ UUID-addressed. These changed routes persist canonical UUIDs and return stable
96
+ `400` invalid, `404` concealed/out-of-scope, `409` ambiguous, or `500` resolver
97
+ errors.
98
+ Goal reads are available to organization members; creating, updating, and deleting goals requires owner/admin Strategy access.
99
+ Projectless initiative writes require an organization owner/admin.
100
+ Treat `404` as concealed absence or unreadable scope and `403` as insufficient
101
+ write access to a readable initiative.
102
+
103
+ KPIs are organization-wide Strategy resources. Owners/admins may read and
104
+ write; other non-guest organization members may read values, snapshots, and
105
+ redacted per-KPI sync metadata but cannot create, update, delete, or record
106
+ snapshots. Guest/project-scoped agents receive `403` for the collection and
107
+ concealed `404` responses for direct KPI, snapshot, and per-KPI sync
108
+ read/draft routes. Verify the active profile's organization-wide role before
109
+ running KPI commands.
110
+
111
+ Every KPI snapshot can be attributed to an initiative or issue, building a record of *what actually moved the numbers*. Keep KPI-to-initiative impact links separate from snapshot attribution: an initiative link means the initiative is expected to move the KPI, while snapshot attribution records the source of one measurement. Heartbeat reports one canonical status per KPI and can explain a KPI with `atoll heartbeat --explain-kpi <kpi> --json`.
112
+
113
+ ### Audit and improve the strategy
114
+
115
+ Use the audit to review the strategy chain visible to the caller at a high level and fix structural problems — the common one being initiatives created without a goal.
116
+
117
+ ```bash
118
+ atoll strategy audit # human-readable, grouped by severity
119
+ atoll strategy audit --json # findings[] for programmatic remediation
120
+ ```
121
+
122
+ `GET /api/orgs/{id}/strategy/audit` returns `findings[]` (each with a `type`, `severity`, the relevant entity id, and a concrete `suggested_fix`) plus `summary` counts. It diagnoses; you remediate with the normal write endpoints. Typical loop:
123
+
124
+ The audit follows the caller's project access. Owners/admins receive
125
+ organization-wide execution evidence. Other non-guests receive project-bound
126
+ issues, milestones, target links, and target findings only for readable
127
+ projects. A restricted caller with no readable projects receives no issue or
128
+ target execution evidence. Guests cannot run the audit.
129
+
130
+ 1. `atoll strategy audit --json` to get findings.
131
+ 2. For each finding, apply its `suggested_fix`, e.g.:
132
+ - `initiative_orphaned` → `atoll initiative update "<initiative>" --goal "<goal>"` (or `PATCH .../initiatives/{id} { goal_id }`)
133
+ - `goal_missing_kpi` → `atoll kpi create --goal "<goal>" --name ... --target ...`
134
+ - `kpi_missing_target` → `atoll kpi update <kpi> --target ... --direction increase`
135
+ - `kpi_unrecorded` / `kpi_stale` → `atoll kpi snapshot add <kpi> --value ...`
136
+ - `initiative_missing_impact` → `atoll initiative kpi link "<initiative>" <kpi> --impact "..."`
137
+ 3. Re-run the audit to confirm the findings cleared.
138
+
139
+ This is the structural-health lens (is the strategy well-formed?), complementary to `heartbeat`, which is the operational lens (what should I do today?).