Skip to content

Commit b17e020

Browse files
Merge pull request #12 from shadowdevcode/feat/linear-workflow-sync
feat(workflow): add linear utility commands and workflow docs
2 parents 78c2f7a + a117952 commit b17e020

26 files changed

+1304
-41
lines changed

.claude/commands/linear-bind.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Read and execute the full command protocol from commands/linear-bind.md.
2+
This is a utility command — it can run anytime, outside the sequential pipeline.
3+
Read project-state.md and the active issue before executing.
4+
Activate the Linear Agent from agents/linear-agent.md.

.claude/commands/linear-brief.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Read and execute the full command protocol from commands/linear-brief.md.
2+
This is a utility command — it can run anytime, outside the sequential pipeline.
3+
Read project-state.md and the current Linear binding before executing.
4+
Activate the Linear Agent from agents/linear-agent.md.

.claude/commands/linear-close.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Read and execute the full command protocol from commands/linear-close.md.
2+
This is a utility command — it can run anytime, outside the sequential pipeline.
3+
Read project-state.md, the active issue, and closeout artifacts before executing.
4+
Activate the Linear Agent from agents/linear-agent.md.

.claude/commands/linear-sync.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Read and execute the full command protocol from commands/linear-sync.md.
2+
This is a utility command — it can run anytime, outside the sequential pipeline.
3+
Read project-state.md, the active issue, and relevant artifacts for the selected sync mode before executing.
4+
Activate the Linear Agent from agents/linear-agent.md.

.github/workflows/pr-auto-review.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ jobs:
3333
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
3434
run: |
3535
claude --dangerously-skip-permissions \
36-
-p "/assign-reviewers ${{ github.event.pull_request.html_url }}"
36+
-p "Read commands/assign-reviewers.md and execute the full protocol for this PR: ${{ github.event.pull_request.html_url }}"

AGENTS.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ Each agent has a dedicated definition file in `/agents/` with full role instruct
2828

2929
## Utility Agents
3030

31-
| Agent | Role | Definition |
32-
| ------------- | --------------------------------------------------- | ------------------------------------- |
33-
| Documentation | Maintains clear documentation (CODEBASE-CONTEXT.md) | [docs-agent.md](agents/docs-agent.md) |
31+
| Agent | Role | Definition |
32+
| ------------- | --------------------------------------------------- | ----------------------------------------- |
33+
| Documentation | Maintains clear documentation (CODEBASE-CONTEXT.md) | [docs-agent.md](agents/docs-agent.md) |
34+
| Linear | Syncs repo workflow state into Linear for PM use | [linear-agent.md](agents/linear-agent.md) |
3435

3536
---
3637

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
# Changelog
22

3+
## 2026-04-01 — Linear PM Layer (Retroactive Sync + Auto-Bind)
4+
5+
**What:** Full Linear integration layer added as a PM-facing workflow mirror. The repo remains the source of truth; Linear reflects state for stakeholder visibility.
6+
7+
- Created `commands/linear-bind.md` — binds active repo issue to a Linear team and project; creates `experiments/linear-sync/issue-<NNN>.json` sync map; writes `linear_enabled: true` and all binding fields to `project-state.md`
8+
- Created `commands/linear-sync.md` — mirrors repo artifacts into Linear in 4 modes: `issue` (brief), `plan` (document snapshot + child issues from manifest), `status` (stage labels + blockers), `release` (PR/deployment links)
9+
- Created `commands/linear-brief.md` — read-only summary of current Linear view; compares repo stage against Linear status; identifies mismatches
10+
- Created `commands/linear-close.md` — finalizes Linear project after `/learning`; sets project to `completed`, root issue to `Done`, creates closeout snapshot document
11+
- Created `agents/linear-agent.md` — Linear Agent role definition (product operations specialist); idempotent sync behavior; repo-as-source-of-truth constraint
12+
- Created `knowledge/linear-operations.md` — shared runtime rules: sync map schema, naming conventions, label taxonomy (`AI Product OS` parent + 7 children), status mapping, failure policy
13+
- Registered all 4 commands as `.claude/commands/` stubs
14+
- Added Linear PM Layer section to `CLAUDE.md` with recommended sync checkpoints
15+
- Updated `commands/create-issue.md` to auto-bind Linear at the end of every new issue creation (no manual `/linear-bind` step required going forward)
16+
- Retroactively synced issues 002–006 and 008 to Linear as `Completed`
17+
18+
**Why:** Pipeline had no PM-facing visibility layer. Issues were built, shipped, and archived with zero Linear record. Linear now mirrors all 6 completed projects with closeout snapshots, enabling portfolio visibility and cycle velocity tracking.
19+
20+
**Pipeline isolation:** Linear commands are utility-only. They do not alter stage progression, do not interact with `experiments/` artifact content, and cannot block or unblock pipeline stages.
21+
22+
**Files:** `commands/linear-bind.md` (new), `commands/linear-sync.md` (new), `commands/linear-brief.md` (new), `commands/linear-close.md` (new), `agents/linear-agent.md` (new), `knowledge/linear-operations.md` (new), `.claude/commands/linear-*.md` (4 new stubs), `CLAUDE.md` (updated), `commands/create-issue.md` (updated), `experiments/linear-sync/issue-{002,003,004,005,006,008}.json` (new)
23+
24+
---
25+
326
## 2026-03-31 — Assign PR Reviewers (Automated Risk-Based Review Routing)
427

528
**What:** New standalone utility command `/assign-reviewers` that assesses PR risk from the actual code diff and routes accordingly.

CLAUDE.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ The system operates through sequential slash commands that activate specialized
3737
- `/explain` - Targeted learning session: understand a concept, pattern, or error via 80/20 rule
3838
- `/eval` - Score a completed issue's pipeline output against its spec using assertion-based grading
3939
- `/assign-reviewers` - Risk-based PR reviewer routing (standalone utility, no pipeline role)
40+
- `/linear-bind` - Bind the active repo issue to a Linear team and project
41+
- `/linear-sync` - Sync repo artifacts and workflow state into Linear
42+
- `/linear-brief` - Read the current Linear view for the active issue
43+
- `/linear-close` - Close the Linear project after repo workflow completion
4044

4145
### Quality Gate System
4246

@@ -70,6 +74,28 @@ The system operates through sequential slash commands that activate specialized
7074
5. **Load app context** (for engineering commands `/execute-plan`, `/deslop`, `/review`, `/peer-review`, `/qa-test`, `/docs`):
7175
- `apps/<project_name>/CODEBASE-CONTEXT.md` (if exists)
7276

77+
### Linear PM Layer
78+
79+
Linear is optional and PM-facing only.
80+
81+
Rules:
82+
83+
- The repo remains the source of truth
84+
- `project-state.md` remains canonical for workflow state
85+
- `experiments/linear-sync/issue-<NNN>.json` stores durable Linear ids for idempotent re-syncs
86+
- Linear utility commands may read and write Linear only after reading repo state
87+
- Linear commands must never silently skip failed writes
88+
- Existing pipeline commands remain valid even if Linear is unavailable
89+
90+
Recommended checkpoints:
91+
92+
- **`/create-issue` auto-binds Linear**`/linear-bind` + root issue creation run automatically at the end of every `/create-issue`. No manual bind step required.
93+
- After `/create-issue`: `/linear-sync issue` (brief already bound; sync the description)
94+
- After `/create-plan`: `/linear-sync plan`
95+
- After `/review`, `/peer-review`, `/qa-test`: `/linear-sync status`
96+
- After `/deploy-check`: `/linear-sync release`
97+
- After `/learning`: `/linear-close`
98+
7399
**Never use hard-coded template examples.** All outputs must reference the active project context.
74100

75101
### State Management
@@ -82,6 +108,13 @@ After every command execution, update `project-state.md`:
82108
- Set quality gate status (pass/fail) for review stages
83109
- Append key decisions to the Decisions Log
84110

111+
For Linear utility commands:
112+
113+
- Update only the Linear metadata fields
114+
- Persist durable Linear ids in `experiments/linear-sync/issue-<NNN>.json`
115+
- Never change pipeline stage progression as a side effect of a Linear command
116+
- Record explicit sync failures instead of silently ignoring them
117+
85118
**Blocked State Rule**: If a quality gate fails, set `status` to `blocked` and add the blocker to the Blockers section. Do not proceed until resolved.
86119

87120
---

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ The OS enforces a sequential pipeline with quality gates. A stage cannot start u
6767

6868
- `/docs` — Generate `CODEBASE-CONTEXT.md` for the active app
6969
- `/explain` — Deep-dive on a concept, pattern, or error
70+
- `/linear-bind` — Bind the active repo issue to a Linear team/project
71+
- `/linear-sync` — Sync repo artifacts and workflow status into Linear
72+
- `/linear-brief` — Summarize the current Linear state for the active issue
73+
- `/linear-close` — Close the Linear project after the repo workflow completes
7074

7175
---
7276

@@ -85,6 +89,38 @@ Every agent reads the knowledge base before executing — preventing the same cl
8589

8690
---
8791

92+
## Linear PM Layer
93+
94+
Linear is an optional PM-facing layer on top of the repo workflow.
95+
96+
The source of truth remains in this repository:
97+
98+
- `project-state.md` is the canonical workflow state
99+
- `experiments/` contains the canonical issue, exploration, plan, and result artifacts
100+
- `experiments/linear-sync/` stores durable Linear sync identities per issue
101+
- `commands/` defines the execution contracts
102+
103+
Linear exists to improve:
104+
105+
- prioritization
106+
- roadmap visibility
107+
- blocker communication
108+
- task tracking from execution manifests
109+
- release and closeout visibility
110+
111+
Recommended usage:
112+
113+
1. Run `/linear-bind` after `/create-issue`
114+
2. Run `/linear-sync issue` after the issue brief exists
115+
3. Run `/linear-sync plan` after `/create-plan` to publish plan artifacts and child tasks
116+
4. Run `/linear-sync status` after review gates to reflect blockers or approvals
117+
5. Run `/linear-sync release` after `/deploy-check`
118+
6. Run `/linear-close` after `/learning`
119+
120+
If Linear is unavailable, the Linear utility command should fail explicitly. The 12-step pipeline remains usable because Linear is not the workflow engine.
121+
122+
---
123+
88124
## Getting Started (Forking This Repo)
89125

90126
1. **Check the current state** — read [`project-state.md`](project-state.md) to see what stage the system is at and which issue is active

agents/linear-agent.md

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# Linear Agent
2+
3+
Role:
4+
You are a product operations specialist responsible for keeping Linear aligned with the AI Product OS.
5+
6+
Your job is to reflect the repo's workflow state into Linear without changing the repo's role as the source of truth.
7+
8+
You think like:
9+
10+
product operations manager
11+
program manager
12+
technical chief of staff
13+
14+
Your priority is workflow clarity, idempotent sync behavior, and accurate status communication.
15+
16+
---
17+
18+
# Responsibilities
19+
20+
1 Bind the active repo issue to a Linear team and project
21+
2 Sync repo artifacts into Linear issues, projects, and comments
22+
3 Reflect blocked states and quality gate outcomes in Linear
23+
4 Attach execution artifacts such as plan docs, manifests, PRs, and postmortems
24+
5 Close Linear work cleanly after the repo workflow completes
25+
26+
You must never invent product direction, scope changes, or engineering decisions.
27+
28+
---
29+
30+
# Inputs
31+
32+
You will receive:
33+
34+
project-state.md
35+
issue brief
36+
exploration output
37+
plan output
38+
manifest JSON
39+
quality gate results
40+
deployment links
41+
postmortem artifacts
42+
43+
---
44+
45+
# Process
46+
47+
Follow this sequence.
48+
49+
---
50+
51+
## 1 Resolve Repo Context
52+
53+
Read the active repo issue and determine:
54+
55+
issue number
56+
project name
57+
current stage
58+
status
59+
relevant artifact links
60+
61+
If required repo context is missing, raise an explicit error.
62+
63+
---
64+
65+
## 2 Resolve Linear Target
66+
67+
Determine the destination:
68+
69+
team
70+
project
71+
cycle if provided
72+
existing issue or child issues if already synced
73+
74+
Never create duplicates when an existing Linear object can be updated.
75+
76+
---
77+
78+
## 3 Upsert Linear State
79+
80+
Create or update only the objects required by the requested command.
81+
82+
Examples:
83+
84+
bind active issue to project
85+
create child issues from manifest tasks
86+
post blocker summaries after failed quality gates
87+
attach release links after deploy-check
88+
89+
---
90+
91+
## 4 Preserve Source Of Truth
92+
93+
The repo remains canonical.
94+
95+
Rules:
96+
97+
- Never treat Linear as authoritative over repo files
98+
- Never overwrite repo intent based on Linear edits alone
99+
- Never silently skip a failed Linear write
100+
101+
If Linear is unavailable, raise an explicit error with operation context.
102+
103+
---
104+
105+
# Output Format
106+
107+
Return output using this structure.
108+
109+
---
110+
111+
Operation
112+
113+
Repo Context
114+
115+
Linear Target
116+
117+
Actions Taken
118+
119+
Sync Result
120+
121+
Next Recommended Command
122+
123+
---
124+
125+
# Rules
126+
127+
Be idempotent.
128+
129+
Prefer updates over creation.
130+
131+
Use repo issue numbers as the stable foreign key across systems.
132+
133+
Do not add workflow steps to the 12-stage pipeline.

0 commit comments

Comments
 (0)