<!-- Authored per the the-loop:writing skill. -->
Tasks: a pull request is tracked because the-loop recorded it
The last spec artifact (requirements → design → testing plan → tasks). A DAG of implementation tasks derived from the approved design and testing plan.
Task list
[x] 1. The poller stops inferring a pull request's owner
cli/the_loop/poller/poller.py:_resolve_ownerdrops the third question (the router's linkage on the listed item); the docstring states the two recorded sources and the "it is the work item" default- Depends on: none
- Requirements: R1.1, R1.2
- Test: T1, T2 (red→green)
[x] 2. Delivery routing proven untouched
cli/tests/test_poller_integration.py: a Gherkin-docstring scenario that a comment on an inferred-linkage pull request still reaches the work item's session- Depends on: 1
- Requirements: R1.3
- Test: T3
[x] 3.
work-item-state.jsongets one writercli/the_loop/graphlink.py:on_pr_linkedloseslinked_byand always records"session"cli/the_loop/webhook/dispatcher.py:_record_pr_bindingwrites the registry endpoint onlycli/the_loop/graph/state.py:link_prdefaults to"session";PR_LINKED_BYdocumented as the read vocabulary that keeps"event"for files written before this change- Depends on: none
- Requirements: R2.1, R2.2, R2.3
- Test: T4, T5, T6 (red→green)
[x] 4. the-loop stops asking GitHub which pull requests relate to a work item
cli/the_loop/graph/integrations/github.py: removelinked-pullsfromOPERATIONS, both transports and the GraphQL query constant- Depends on: none
- Requirements: R3.1
- Test: T7 (red→green)
[x] 5. The review brief pre-fills from what the-loop recorded
cli/the_loop/graph/hooks/review.py:_detected_pullsreadswork-item-state.json'spullRequests[]thenpr-loops/, deduplicated; the provider call is gone and the module docstring says what the two sources are- Depends on: 4
- Requirements: R3.2, R3.3
- Test: T8 (red→green)
[x] 6. The link is recorded by a hook, not by the model
hooks/the-loop-link-pr.py: new stdlib-onlyPostToolUsewrapper — extract the pull request from the tool response (gh pr createURL, MCPcreate_pull_request), resolve the work item (THE_LOOP_WORK_ITEM→ registry by harness session id → registry by cwd), runthe-loop sessions link-pr, always exit 0hooks/hooks.json: thePostToolUseentry and its matcher- Depends on: none
- Requirements: R4.1, R4.2, R4.3, R4.4
- Test: T9, T10, T11, T13, T15 (red→green)
[x] 7. A spawned session knows its work item
cli/the_loop/runner.py:WORK_ITEM_ENV_VAR, injected throughnew-session -ebesideTHE_LOOP_INSTANCE, behind the same tmux-version probe, for every spawn that has a work item- Depends on: none
- Requirements: R5.1, R5.2
- Test: T12 (red→green)
[x] 10. A pull request that IS the work item is recorded like any other
cli/the_loop/graph/state.py:PullRequest.is_self, serialized asself: trueand absent otherwise; a marked row carries nostateDirand a hand-written one is refused;link_pr(..., is_self=True)is the only way the self ref is acceptedcli/the_loop/graphlink.py:_armed_on_its_own_pull_request(read off the arming event) and_record_self_pull_request, called fromon_armandon_spawn- Depends on: 3
- Requirements: R7.1–R7.5
- Test: T18, T19 (red→green)
- Owner ruling: PR #372 — "the-loop should add the PR in the same way it links the PR to any other work item"
[x] 8. Documentation
docs/capabilities/webhook-triggers.md,docs/capabilities/process-graph.md,docs/capabilities/cli.md,docs/capabilities/distribution.md: the new rule, with a history row per docdocs/cli/state.md,docs/cli/commands/sessions.md: the user-facing pagesskills/the-loop/reference/automation.md: the hook is the primary path, the command is the fallbackdocs/decisions/decision-129.md: the tracking/delivery split this work item rules on- Depends on: 1, 3, 4, 5, 6, 7
- Requirements: R6.1, R6.2
- Test: T14
[x] 9. Gates
make lint format-check typecheckand the full suite; evidence underdocs/specs/issue-370/evidence/(self-review, critic-review, security-review, documentation, final-validation, pull-requests)- Depends on: 1–8
- Requirements: all
- Test: T1–T15