plate-core 0.7.2__py3-none-any.whl

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.
Files changed (115) hide show
  1. plate_core/__init__.py +21 -0
  2. plate_core/agent_guidance.py +303 -0
  3. plate_core/autonomy.py +539 -0
  4. plate_core/baseline_catalog.py +457 -0
  5. plate_core/bootstrap.py +368 -0
  6. plate_core/cli.py +1245 -0
  7. plate_core/contemplation.py +391 -0
  8. plate_core/context_map.py +134 -0
  9. plate_core/costs.py +204 -0
  10. plate_core/curiosity/__init__.py +1 -0
  11. plate_core/curiosity/answers.py +354 -0
  12. plate_core/data/baseline_catalog.yml +688 -0
  13. plate_core/data/plate_extensions.yml +20 -0
  14. plate_core/data/template_payload_inventory.json +475 -0
  15. plate_core/data/template_payload_manifest.yml +29 -0
  16. plate_core/discussions.py +186 -0
  17. plate_core/epics.py +223 -0
  18. plate_core/features.py +154 -0
  19. plate_core/github_client.py +171 -0
  20. plate_core/health.py +256 -0
  21. plate_core/inventory.py +47 -0
  22. plate_core/markers.py +346 -0
  23. plate_core/mcp/__init__.py +1 -0
  24. plate_core/mcp/audit_tools.py +332 -0
  25. plate_core/mcp/curiosity_tools.py +674 -0
  26. plate_core/mcp/tools.py +369 -0
  27. plate_core/mcp_server.py +1478 -0
  28. plate_core/migration.py +169 -0
  29. plate_core/plate_config.py +570 -0
  30. plate_core/pr_babysit.py +604 -0
  31. plate_core/release.py +1382 -0
  32. plate_core/skills_surface.py +218 -0
  33. plate_core/template_payload/AGENTS.md +651 -0
  34. plate_core/template_payload/CHANGELOG.md +28 -0
  35. plate_core/template_payload/CONTRIBUTING.md +69 -0
  36. plate_core/template_payload/README.md +126 -0
  37. plate_core/template_payload/SPEC.md +69 -0
  38. plate_core/template_payload/VISION.md +29 -0
  39. plate_core/template_payload/docs/README.md +173 -0
  40. plate_core/template_payload/docs/adr/0000-template.md +32 -0
  41. plate_core/template_payload/docs/audits/audit-report-template.md +33 -0
  42. plate_core/template_payload/docs/bootstrap/new-repository-checklist.md +62 -0
  43. plate_core/template_payload/docs/current/README.md +3 -0
  44. plate_core/template_payload/docs/design/README.md +67 -0
  45. plate_core/template_payload/docs/design/conversation-to-issue-graph.md +503 -0
  46. plate_core/template_payload/docs/design/default-questions.md +41 -0
  47. plate_core/template_payload/docs/design/epic-planning-dialogue-flow.md +491 -0
  48. plate_core/template_payload/docs/design/extension-repository.md +326 -0
  49. plate_core/template_payload/docs/design/goals-wiki-page-convention.md +103 -0
  50. plate_core/template_payload/docs/design/onboarding-questions.md +161 -0
  51. plate_core/template_payload/docs/design/playwright-ci-design.md +868 -0
  52. plate_core/template_payload/docs/marketing/experiments.md +5 -0
  53. plate_core/template_payload/docs/marketing/launch-checklist.md +9 -0
  54. plate_core/template_payload/docs/marketing/marketing-site-brief.md +22 -0
  55. plate_core/template_payload/docs/migration/baseline.md +3 -0
  56. plate_core/template_payload/docs/migration/charter.md +3 -0
  57. plate_core/template_payload/docs/migration/completion-report.md +3 -0
  58. plate_core/template_payload/docs/migration/enforcement-plan.md +5 -0
  59. plate_core/template_payload/docs/migration/exceptions.md +5 -0
  60. plate_core/template_payload/docs/migration/inventory.md +5 -0
  61. plate_core/template_payload/docs/playwright-e2e-guide.md +537 -0
  62. plate_core/template_payload/docs/research/README.md +54 -0
  63. plate_core/template_payload/docs/research/automatic-epic-creation.md +243 -0
  64. plate_core/template_payload/docs/research/custom-agent-packaging.md +110 -0
  65. plate_core/template_payload/docs/research/epic-intent-detection.md +266 -0
  66. plate_core/template_payload/docs/research/gif-generation-spike.md +375 -0
  67. plate_core/template_payload/docs/research/information-goals.md +155 -0
  68. plate_core/template_payload/docs/research/interactive-planning-ux.md +335 -0
  69. plate_core/template_payload/docs/research/openspec-evaluation.md +128 -0
  70. plate_core/template_payload/docs/research/playwright-asset-strategy.md +81 -0
  71. plate_core/template_payload/docs/research/playwright-gif-generation.md +64 -0
  72. plate_core/template_payload/docs/vision/README.md +5 -0
  73. plate_core/template_payload/docs/wiki/Automatic-Epic-Creation.md +41 -0
  74. plate_core/template_payload/docs/wiki/Goals.md +43 -0
  75. plate_core/template_payload/docs/wiki/Home.md +15 -0
  76. plate_core/template_payload/package.json +16 -0
  77. plate_core/template_payload/playwright.config.ts +82 -0
  78. plate_core/template_payload/scripts/BootstrapGitHub.ps1 +283 -0
  79. plate_core/template_payload/scripts/CheckToolchain.ps1 +58 -0
  80. plate_core/template_payload/scripts/QuestionBatch.ps1 +10 -0
  81. plate_core/template_payload/scripts/README.md +428 -0
  82. plate_core/template_payload/scripts/ValidatePlateRepo.ps1 +67 -0
  83. plate_core/template_payload/scripts/bootstrap_github.sh +264 -0
  84. plate_core/template_payload/scripts/check_toolchain.sh +54 -0
  85. plate_core/template_payload/scripts/dev-server.js +59 -0
  86. plate_core/template_payload/scripts/e2e-record.ps1 +256 -0
  87. plate_core/template_payload/scripts/e2e-record.sh +230 -0
  88. plate_core/template_payload/scripts/gif-from-video.ps1 +270 -0
  89. plate_core/template_payload/scripts/gif-from-video.sh +212 -0
  90. plate_core/template_payload/scripts/question_batch.sh +11 -0
  91. plate_core/template_payload/scripts/validate_plate_repo.sh +180 -0
  92. plate_core/template_payload/tests/README.md +37 -0
  93. plate_core/template_payload/tests/e2e/README.md +63 -0
  94. plate_core/template_payload/tests/e2e/fixtures/README.md +14 -0
  95. plate_core/template_payload/tests/e2e/fixtures/gifs/README.md +168 -0
  96. plate_core/template_payload/tests/e2e/fixtures/gifs/homepage-demo.gif +0 -0
  97. plate_core/template_payload/tests/e2e/pages/base-page.ts +51 -0
  98. plate_core/template_payload/tests/e2e/pages/login-page.ts +38 -0
  99. plate_core/template_payload/tests/e2e/specs/example.spec.ts +37 -0
  100. plate_core/template_payload/tests/e2e/specs/failing-example.spec.ts +20 -0
  101. plate_core/template_payload/tests/spike-videos/TEST_RESULTS.md +258 -0
  102. plate_core/template_payload/tests/spike-videos/test-10s.webm +0 -0
  103. plate_core/template_payload/tests/spike-videos/test-high.gif +0 -0
  104. plate_core/template_payload/tests/spike-videos/test-low.gif +0 -0
  105. plate_core/template_payload/tests/spike-videos/test-medium.gif +0 -0
  106. plate_core/template_payload/tests/spike-videos/test-trimmed-5s-low.gif +0 -0
  107. plate_core/template_payload/tests/spike-videos/test-trimmed-5s.gif +0 -0
  108. plate_core/template_payload.py +155 -0
  109. plate_core/version_sync.py +145 -0
  110. plate_core-0.7.2.dist-info/METADATA +270 -0
  111. plate_core-0.7.2.dist-info/RECORD +115 -0
  112. plate_core-0.7.2.dist-info/WHEEL +5 -0
  113. plate_core-0.7.2.dist-info/entry_points.txt +2 -0
  114. plate_core-0.7.2.dist-info/licenses/LICENSE +38 -0
  115. plate_core-0.7.2.dist-info/top_level.txt +1 -0
plate_core/__init__.py ADDED
@@ -0,0 +1,21 @@
1
+ """plate_core runtime package."""
2
+
3
+ __version__ = "0.7.2"
4
+
5
+ # Core subsystems
6
+ from . import markers # PLATES-CORE marker parsing, validation, and safe upstream sync (Issue #130)
7
+ from . import inventory # Canonical methodology asset inventory (support for migration #131, health, etc.)
8
+
9
+ # Public marker API (for CLI, MCP, template sync, and extensions)
10
+ from .markers import (
11
+ MarkerParser,
12
+ MarkerParseError,
13
+ MarkerSection,
14
+ )
15
+
16
+ __all__ = [
17
+ "markers",
18
+ "MarkerParser",
19
+ "MarkerParseError",
20
+ "MarkerSection",
21
+ ]
@@ -0,0 +1,303 @@
1
+ """Agent guidance and prompting strategies for PLATE development."""
2
+
3
+ from __future__ import annotations
4
+
5
+
6
+ PLAYWRIGHT_E2E_GUIDANCE = """
7
+ ## Playwright E2E Testing
8
+
9
+ PLATE repos have built-in Playwright E2E support for testing UI features.
10
+
11
+ ### Workflow: Implementing a UI Feature
12
+
13
+ When implementing a UI feature, follow these steps:
14
+
15
+ 1. **Write or update Playwright test** in `tests/e2e/specs/`
16
+ - Use the existing test structure and page objects in `tests/e2e/pages/`
17
+ - Run: `npm run test:e2e` to validate tests locally
18
+
19
+ 2. **Record a demo with headed mode**
20
+ - Run: `npm run test:e2e:headed` to see the test in action
21
+ - Or use: `npm run record:e2e <feature-name>` to record and generate GIF
22
+
23
+ 3. **Generate GIF and commit**
24
+ - The GIF is generated in `tests/e2e/fixtures/gifs/`
25
+ - Commit the GIF to track visual changes
26
+ - Reference in CURRENT.md with embed + test link
27
+
28
+ 4. **Update CURRENT.md**
29
+ - Embed the GIF: `![Feature Demo](tests/e2e/fixtures/gifs/feature-name.gif)`
30
+ - Link to test: `[View test](tests/e2e/specs/feature-name.spec.ts)`
31
+ - Document the feature behavior
32
+
33
+ 5. **Push and create PR**
34
+ - PR will include visual demo and linked test
35
+
36
+ ### Available Commands
37
+
38
+ - `npm run test:e2e` — Run all tests headless
39
+ - `npm run test:e2e:watch` — Watch mode for development
40
+ - `npm run test:e2e:headed` — Run with visible browser
41
+ - `npm run test:e2e:debug` — Debug mode
42
+ - `npm run record:e2e <name>` — Record test and generate GIF
43
+
44
+ ### MCP Tools
45
+
46
+ Use these MCP tools when implementing E2E tests:
47
+
48
+ - `@copilot init-playwright` — Scaffold Playwright setup if missing
49
+ - `@copilot record-e2e-gif` — Record and generate demo GIF for a test
50
+ - `@copilot validate_e2e_tests` — Verify Playwright setup is correct
51
+
52
+ ### Documentation
53
+
54
+ See [Playwright E2E Guide](../docs/playwright-e2e-guide.md) for detailed setup and patterns.
55
+ """
56
+
57
+
58
+ QANDA_CURIOSITY_GUIDANCE = """
59
+ ## Curiosity / Q&A Mode and Informational Goals
60
+
61
+ PLATE supports a Curiosity-driven workflow where informational goals are tracked as `Question` issues and surfaced through Q&A mode.
62
+
63
+ ### When to use Q&A mode
64
+ - The user explicitly invokes `/qanda`, "answer open questions", or similar.
65
+ - You detect multiple open `Question` issues relevant to the current Epic or task.
66
+ - You need structured user input to unblock work or seed new work.
67
+
68
+ ### How to present questions (critical preference)
69
+ - **Inside GitHub Copilot CLI (primary interface):** Strongly prefer using any *native* TUI, form, or interactive questioning primitives provided directly by the Copilot CLI itself. Only fall back to a custom terminal TUI if native capabilities are unavailable or insufficient for the question.
70
+ - **Direct `gh plate qanda` usage or fallback:** Use lightweight custom TUI tools (e.g. gum/huh) or simple prompts.
71
+ - The goal is the most seamless possible experience for the user in their primary interface.
72
+
73
+ ### Enforcement and follow-through for PLATE Q&A
74
+ - **Mandatory use of native TUI forms for Q&A in PLATE contexts:** Agents must *consistently default to or use* Grok Build native TUI interactive configurator (arrow-key forms) via ask_user_question (or host native TUI) for interactive Q&A; include detection/fallback note; do not require user reminders. Do not use raw text prompts unless native is unavailable.
75
+ - **Enforcement of Q&A option follow-through:** After answers, explicitly create/update artifacts (issues, fragments, docs) per Answer signal checklist and contemplation contract. Use explicit checklist in turns or session state to ensure complete follow-through without mid-stream corrections. Offer *only* options/actions in ask_user_question whose full follow-through (artifacts + execution) will be completed in this turn before any further progress or new Q&A; do not declare done or offer next until prior chosen option is fully executed. If a choice promises "review the PR", "babysit", "address feedback", or similar, the agent *must* fully execute that work using the dedicated pr-babysit skill (or MCP), isolated worktree, push to the *existing* PR branch, resolve addressed threads, before offering the next question or declaring progress/done. Never merge or advance with unaddressed feedback. (Addresses #503, #517.)
76
+
77
+ ### Question handling flow
78
+ 1. Use available MCP tools (or future equivalents such as `plate_list_questions`, `plate_get_question`) to discover and prioritize open Questions.
79
+ 2. Present the question using the native preference above.
80
+ 3. When the user provides an answer, capture it with full provenance (see Answer Model).
81
+ 4. Trigger contemplation logic (via MCP tools or rules) and produce a Contemplation Log.
82
+ 5. Create forward progress (new issues, artifact updates) as defined in the Contemplation contract.
83
+ 6. Treat the Question body's `Answer signal` as checklist-style markdown criteria. A Question is only ready to close when every checklist item is backed by explicit citations or links in the effective answer history; revised answers can invalidate previously satisfied items until new cited evidence exists.
84
+ 7. For hard informational obstacles during other work, create a blocking `Question` issue (with a clear structured information dump) as a deliberate last resort, post a status on the original Issue, and pause work on it.
85
+ 8. When a blocking Question is later answered, offer to merge the new information back into the original Issue and resume the blocked work.
86
+
87
+ ### Blocking / informational obstacle pattern (Feature #147 / Epic #139)
88
+ **Decision procedure (invoke ONLY as deliberate last resort):**
89
+ 1. You have performed internal reasoning + used available tools/MCP calls (reads, searches, contemplation on prior answers, etc.) and still cannot safely proceed without risking incorrect work or violating requirements/scope.
90
+ 2. The blocker is informational (ambiguity, missing context, human judgment needed on tradeoffs/risks/users, conflicting signals) — not a simple implementation detail you can experiment on.
91
+ 3. Continuing would violate "never lose information" or "create forward progress" invariants, or risk significant rework.
92
+ 4. No open Question already covers this exact need.
93
+
94
+ When criteria met:
95
+ - Call `plate_create_blocking_question` (MCP) with:
96
+ - original_issue_number (the blocked task)
97
+ - blockage_point (exact sentence/requirement/step where stuck)
98
+ - missing_info (what human must clarify)
99
+ - suggested_questions (2-5 crisp questions for the human; this becomes the Question title/body focus)
100
+ - partial_work (what you have done/understood so far — never lose this)
101
+ - extra_context (links to artifacts, prior answers, etc.)
102
+ - The tool creates the Question (with structured PLATE-BLOCKING-DUMP per Answer Model style), posts a standardized pause status on the original Issue with bidirectional link, and returns the new Question #.
103
+ - Surface the new Question # to the user (mention in chat, or use Q&A mode).
104
+ - **Discontinue** further work on the original Issue in this session. Hand off cleanly.
105
+ - Later (after human answers): see Resumption pattern below + #148.
106
+
107
+ This is the concrete last-resort escape hatch. Over-use is a risk — prefer reasoning first. Document the decision in your reasoning trace.
108
+
109
+ ### Resumption pattern (Feature #148 / Epic #139)
110
+ When you (or a future session) detect that a previously blocking Question (one containing PLATE-BLOCKING-DUMP or explicit "blocking" marker + link to original Issue) has been answered:
111
+ 1. Use `plate_get_question` + `plate_get_answers` (or record_answer path) to fetch the full answer + provenance from the blocking Question.
112
+ 2. Identify the original blocked Issue from the dump/block (or Question body links).
113
+ 3. Perform structured merge:
114
+ - Post a clear, human/machine-readable "**Unblocked by answer to Question #N**" report comment on the original (key excerpts, provenance, link back, actions taken).
115
+ - Update the original Issue body/sections/comments with the new info where it changes scope/understanding (append-only where possible).
116
+ - Create any follow-on artifacts or child issues warranted by the new information (via normal contemplation rules).
117
+ 4. Resume or hand off work on the original Issue (or mark it ready for next agent).
118
+ 5. Close the blocking Question only if its answer_signal is met (normal contemplation closure).
119
+
120
+ **MCP integration**: The `plate_record_answer` (source=\"blocking\") + contemplation path, or a dedicated `plate_resume_from_blocking_question` tool (to be added), triggers the above. Always produce auditable unblock report. Preserve full bidirectional traceability. No data loss.
121
+
122
+ This completes the loop started by #147 creation. Dogfood the full create → answer → resume in this repo.
123
+
124
+ ### Related MCP tools (examples)
125
+ - Future tools for listing/synthesizing Questions, recording answers, triggering contemplation, and managing blocking/resumption flows.
126
+ - Always prefer the most native user experience the host environment (Copilot CLI) can provide.
127
+ """
128
+
129
+ TASK_MANAGEMENT_GUIDANCE = """
130
+ ## Task Management for Complex Multi-Step Work
131
+
132
+ For **any** PLATE work with 3 or more steps — including babysit/"get PR green"/address feedback sessions (multiple gates/threads/tests/re-inspects), interactive Q&A or contemplation/refinement rounds, delegation or subagent flows, information audits, autonomy cycles, or release ceremonies — **immediately** use the `todo_write` tool (or host equivalent) at the start of the effort.
133
+
134
+ Rules (mandatory per plate persona):
135
+ - Call `todo_write` with a list of structured todos (each with id, content, status: "pending" | "in_progress" | "completed").
136
+ - **Mark items completed as soon as the atomic step is done.** Do not batch multiple completions before marking.
137
+ - Use it to track progress visibly for the user, surface blockers (e.g. "need:human-review before merge"), and prevent skipping steps or losing context across turns.
138
+
139
+ Examples:
140
+ - Babysit a PR to green: todos for "ci-diagnosis + list all gates", "address actionable review threads via helpers", "targeted test fix if needed", "babysit re-inspect to CLEAN", "merge + release reset".
141
+ - Q&A refinement: ["present question via ask_user_question", "capture answer + provenance", "create/update artifacts per ACs", "follow-through on chosen option before next"].
142
+
143
+ See AGENTS.md (new Task Management section + work loop examples), the host system prompt, and the `todo_write` tool contract. (Addresses #515.)
144
+ """
145
+
146
+ def get_agent_guidance_sections() -> dict[str, str]:
147
+ """Return guidance sections for agents."""
148
+ return {
149
+ "playwright_e2e": PLAYWRIGHT_E2E_GUIDANCE,
150
+ "qanda_curiosity": QANDA_CURIOSITY_GUIDANCE,
151
+ "information_audit": INFORMATION_AUDIT_GUIDANCE,
152
+ "quiet_operations": QUIET_OPERATIONS_GUIDANCE,
153
+ "task_management": TASK_MANAGEMENT_GUIDANCE,
154
+ }
155
+
156
+
157
+ INFORMATION_AUDIT_GUIDANCE = """
158
+ ## Information Audits and Goals Page
159
+
160
+ PLATE supports structured Information Audits (Epic #218 / #221, cross-cutting beta roadmap) to keep SPEC.md aligned with implemented state (release fragments as durable evidence, working tests as strong signal, code/docs/wiki as supporting).
161
+
162
+ - Evidence hierarchy and owner-vision intake (via Q&A where needed).
163
+ - Auditable reports: stale claims, undocumented implementation, vision/reality gaps, with per-finding confidence (high/medium/low).
164
+ - Generates follow-on artifacts (Question/Research/Design/Feature/Bug/Doc) with provenance; supports draft SPEC patches (insertion-first).
165
+ - Exposed via `plate_perform_information_audit` (CLI + MCP), health signals, and `plate_what_next` prioritization when findings exist.
166
+ - Human approval boundaries preserved for public claims/vision/SPEC changes.
167
+
168
+ Use when drift is suspected or after landing beta Epics. See docs/research/ and the 257/221 fragments for details. Ties into Goals page bootstrap (#224) and extension goals.
169
+ """
170
+
171
+
172
+ QUIET_OPERATIONS_GUIDANCE = """
173
+ ## Quiet Operations, Brevity, and Comment Discipline (Long-Running / Looped Agents)
174
+
175
+ PLATE supports long-running autonomous operation (e.g. Copilot CLI `/every`, Grok Build `/loop`, babysit watch, repeated what_next cycles). The default posture must be quiet: protect both the human reader's attention and every agent's context window.
176
+
177
+ ### Terminal / loop turn summaries (highest priority)
178
+ - When operating in any looped or long-running session, your *final visible response* (the part the /loop orchestrator, watch mode, or human tailing the terminal will see) **MUST** be a bullet-point list.
179
+ - Each bullet is **one brief sentence**.
180
+ - No introductory paragraphs, no "Summary of this turn:", no "I did X because...", no closing zinger or sign-off.
181
+ - If the turn produced multiple observations, use 1-5 (max ~7) bullets.
182
+ - Pure no-op / monitoring example (clean babysit turn):
183
+ - Babysit PR #123: 0 actionable threads, base branch in sync (UP TO DATE).
184
+ - No GitHub comment posted (quiet rule: only on meaningful forward progress).
185
+ - Used MCP plate_pr_babysit for structured data; any CLI output was collapsed internally.
186
+ - True nothing example: "- No-op turn: state unchanged, 0 progress items."
187
+ - Prefer MCP surfaces (plate_pr_babysit, plate_health, plate_epic_status, plate_what_next, etc.) that return clean dicts. When you must invoke a CLI command that produces multi-line human output, collapse or ignore the raw text and emit only the terse bullets.
188
+
189
+ ### GitHub comments on Issues, PRs, and Questions
190
+ - Post a comment **only** when the turn produces verifiable forward progress that creates or updates a durable repository artifact, resolves a blocker, or satisfies a defined human checkpoint.
191
+ - Progress examples (allowed/encouraged):
192
+ - Code change committed locally and pushed to the PR branch.
193
+ - Review thread resolved via `plate_resolve_review_thread` (or equivalent GraphQL).
194
+ - New or updated `.agentic/releases/unreleased/*.json` fragment, wiki source, or other required artifact.
195
+ - New child issue (Feature/Research/Design/Question) created from contemplation that advances Epic scope.
196
+ - Blocking Question created as a deliberate last resort (#147), with pause status on the original.
197
+ - Unblock report posted on an original issue after a blocking Question is answered (#148).
198
+ - Answer that newly satisfies one or more Answer signal checklist items, making the Question PR-ready (the closure report with usage block is the required artifact).
199
+ - Do-not examples (forbidden in loops / routine turns):
200
+ - Pure monitoring: babysit_pr report shows 0 actionable_threads and no sync change.
201
+ - Routine contemplation: evaluated Answer signal, no new criteria satisfied, no artifacts created.
202
+ - "Re-checked health / release status / epic status."
203
+ - Status updates or "still working" notes in a watch/loop.
204
+ - The engine's own PLATE-ANSWER / PLATE-CONTEMPLATION / PLATE-BLOCKING-DUMP markers and required usage-report blocks on closure are **exempt** (they are the auditable record per Issue Artifact Rules). Do not add your own prose comments around routine ones.
205
+ - Human checkpoints remain (e.g. "Post a summary comment on the Epic issue when all child issues are resolved"). These are explicit, not routine.
206
+
207
+ ### Q&A / Curiosity question presentation
208
+ - When invoking native interactive primitives (ask_user_question or host TUI forms) or falling back: transmit **only** the question text, the Answer signal checklist (if present), and the absolute minimum options or context required for the decision.
209
+ - Omit all front matter except when the question is *itself about* process rationale or vision: no "As the PLATE agent working on Epic #N...", no "To make progress toward the Goals page...", no "Per the QANDA_CURIOSITY_GUIDANCE...".
210
+ - The host session already carries full context (current Epic, recent artifacts, prior answers). Extra framing wastes human attention and inflates context for any agent that later reads the transcript.
211
+
212
+ ### General rules
213
+ - Briefer is better for humans *and* for any downstream agent or orchestrator that ingests this turn's output.
214
+ - "Update the artifact, not chat history" (echoes copilot-instructions and layered context design).
215
+ - Resource consciousness (AGENTS.md) + Atomic PR discipline still apply; quiet rules make them practical for overnight / multi-hour autonomous runs.
216
+ - These rules are enforced primarily through the plate persona, catalog constraints on delegated agents, and what_next / delegation prompt segments. See also AGENTS.md §Resource consciousness, §Human checkpoints, §Issue Artifact Rules, and the babysit / Curiosity sections.
217
+
218
+ ### Long-running command / background task protocol
219
+ When using or encountering backgrounded commands (e.g. `run_terminal_command(..., background=true)`, host-initiated long pytest in worktree, babysit repro, or any long-running verification):
220
+ - **Immediately record the task_id** (or identifier) returned by the backgrounding call or system reminder.
221
+ - **Schedule proactive polling**: do not wait for system reminders. Explicitly plan and invoke `get_command_or_subagent_output` (or the `monitor` tool) at intervals (e.g., after 30s, 2m, 5m, 10m) to surface partial output, progress, and early failures in your (terse) responses. At each poll, emit a terse one-bullet status update to the user (e.g., "still running after 2m, last output: ...") to close the visibility loop. Consider using or defining a lightweight "monitor" helper that the agent can invoke to handle scheduling and reporting for background tasks.
222
+ - If the task is killed by the system (e.g. SIGTERM / signal 15 after hours, timeout, OOM), or exceeds a practical threshold (e.g. >10min for verification), **treat the kill as data, not "the end"**:
223
+ - Immediately retrieve the final/partial output via the get/monitor tool.
224
+ - Analyze it (often the useful work/failure was completed before the kill).
225
+ - Switch *immediately* to a cheap, targeted fallback (e.g. `pytest -k "exact failing test from CI log or partial output" --tb=line`, single file, or the minimal repro from the original CI job). Never blindly re-background a full expensive suite.
226
+ - In "pr-babysit", "get CI passing", "reproduce the failure (in worktree)", or equivalent flows: **default to cheap, CI-log-driven reproduction first** (use `gh run view` on the specific failing job to extract the exact -k filter, file, or error; run only that). Reserve broad backgrounded commands for last resort, and always with the monitoring + fallback plan above.
227
+ - The pr-babysit skill, "reproduce failure in worktree" guidance, and any verification instructions must encode this preference for log-first, kill-aware, cheap fallbacks over expensive long runs.
228
+
229
+ This protocol prevents wasted compute and ensures partial results from killed tasks are acted upon quickly. Agents must proactively use `get_command_or_subagent_output` / `monitor` rather than reacting to reminders.
230
+
231
+ ### Guidance architecture for persona byte limits and churn reduction (#569)
232
+ The shipped `plugin/agents/plate.agent.md` (and .plugin/ mirror) is intentionally a *thin high-level summary + routing table* (default persona, special modes for Q&A/babysit, key "MUST" rules like release status first).
233
+ Detailed protocols, loops, and examples live here in agent_guidance.py (QUIET_OPERATIONS_GUIDANCE, QANDA..., Release Status Protocol, etc.) and in AGENTS.md.
234
+ Tests should assert *key phrases or section headers* (e.g. "Full PR Green / Make Mergeable Loop", "CI Diagnosis First Protocol") rather than long verbatim multi-sentence blocks. This eliminates repeated trim/sync/re-test churn when guidance is extended.
235
+ Persona size limits (if any in host) are respected by keeping the .md file focused on invocation, not full docs.
236
+ See also: tests/test_pr_babysit.py (guidance/persona assertions), AGENTS.md §Agent-specific naming guardrail and Task Management.
237
+
238
+ ### CI Diagnosis First Protocol (before expensive local verification or repro)
239
+ When the high-level instruction is "get CI passing", "reproduce the failure (in worktree)", "fix the red checks", "address feedback", or any verification/babysit task that might involve local commands (especially broad pytest in worktrees):
240
+
241
+ - **Always begin with cheap, precise GitHub-side diagnosis *before* launching any broad or long-running local command.** Never default to `python -m pytest ...` or similar without first knowing the exact current failure from CI.
242
+
243
+ 1. Run `gh pr checks <pr-number>` (or use MCP `plate_pr_babysit` / `gh plate pr babysit`) to see the full current set of gates and which are red (labels, feedback-resolution, test jobs, etc.).
244
+
245
+ 2. Identify the *specific failing job/run*: use `gh run list --branch <pr-head-branch> --limit 5` (or the equivalent from babysit report).
246
+
247
+ 3. Fetch the exact failure details with `gh run view <run-id> --job <job-id> --log-failed` (or `--log` for full; add `--json` for structured parsing). This shows the *real* error (often "missing Bug label", "unresolved threads from owner", or a specific test assertion), not an old/stale one.
248
+
249
+ - Only *after* the precise diagnosis (e.g. "the failure is the labels check, not the tests"), decide the minimal repro scope if local work is needed at all: targeted `pytest -k "exact-test-name"`, single file, or just the metadata fix. Prefer cheap one-liners over multi-hour full suites.
250
+
251
+ - Use (or document) common one-liners/helpers for the gh run view flags so they don't have to be memorized each time.
252
+
253
+ - Cross-reference the "Full PR Green / Make Mergeable Loop" (inspect all gates including these) and the long-running protocol (cheap fallback, record task_id if backgrounding any repro).
254
+
255
+ This is the primary way to avoid wasted expensive local runs and delayed diagnosis. The pr-babysit skill and "reproduce failure" guidance must encode "CI diagnosis first" as the mandatory starting step.
256
+
257
+ ### Verification Strategy (local test runs, reproduction, and check-work)
258
+ When the task involves local verification, reproducing a failure in the worktree, or running tests:
259
+ - Start narrow: use the `check-work` skill (or equivalent) for self-verification when available; otherwise use the most targeted command possible (specific test files, `pytest -k "exact-failing-test-or-module" --tb=line`, or single module from CI log). Never default to a full `python -m pytest` or broad suite.
260
+ - For anything expected to take >5-10 minutes: explicitly warn the user before starting ("This may take 10-60+ minutes; ok to proceed?").
261
+ - Combine with long-running protocol (background + proactive polling with get_/monitor, cheap fallback on kill) and CI Diagnosis First (always start with `gh pr checks` + `gh run view ... --log-failed` before any local command).
262
+ - Prefer skills/MCP surfaces over raw shell commands for reproducibility and structure.
263
+
264
+ This prevents long-running waste, improves responsiveness, and ensures the user has visibility.
265
+
266
+ ### Full PR Green / Make Mergeable Loop (for "get CI passing", babysit, address feedback)
267
+ When given a *single high-level instruction* like "get this PR green", "make mergeable", "address all feedback", or "resolve CI" (not category-by-category prompting), treat it as an atomic "complete babysit / turn green" flow the *agent owns*:
268
+
269
+ 1. At the start and after *every* push, comprehensively inspect *all* current failing gates using available surfaces (MCP plate_pr_babysit or `gh plate pr babysit` + plate_get_actionable_review_threads, `gh pr checks`, labels, mergeStateStatus, title/doc checks, etc.). **Review thread listing and resolution must use the encapsulated helpers (get_actionable_review_threads / plate_get_actionable_review_threads + plate_resolve_review_thread / resolve_review_thread); the skill handles GraphQL pagination, databaseId, body, author matching, and mutation internally. Do not hand-roll raw GraphQL, jq, mktemp, sed/NO_COLOR ANSI stripping, or the resolveReviewThread mutation.** Build and maintain an internal model of the "current failing gates" (do not rely on user to diagnose the next one). (Addresses #516.)
270
+
271
+ 2. Address everything the agent can autonomously in the worktree in one comprehensive pass (conflicts, labels, threads, tests, etc.):
272
+ - Base sync / merge conflicts (rebase or request copilot update per strategy, using isolated worktree). **Always verify with `verify_worktree_is_isolated()` (or `git rev-parse --show-toplevel`) before edits/rebase; call `cleanup_git_locks()` before git ops in worktree flows (pr-babysit helpers). Never edit main checkout; cleanup on exit. (Addresses #514.)**
273
+ - Apply safe code suggestions from reviews.
274
+ - Fix labels, title, or other metadata issues within scope (e.g. correct type + area:* + risk:*).
275
+ - Resolve review threads that have been addressed (via the encapsulated `plate_resolve_review_thread` / `resolve_review_thread` + `plate_get_actionable_review_threads` for discovery; for *all* unresolved after addressing. Never raw commands).
276
+ - Reproduce and fix test/CI failures that are locally actionable (prefer cheap targeted runs per verification strategy + long-running protocol; use check-work skill where possible).
277
+ - (and any other gate surfaced by the comprehensive inspection at step 1)
278
+
279
+ 3. Push all changes to the *existing* PR branch (never open a new PR for feedback response).
280
+
281
+ 4. Re-inspect all gates.
282
+
283
+ 5. Repeat the inspect-fix-push-reinspect cycle until no more agent-actionable items remain (only human-judgment items remain, e.g. credentials, high-risk decisions, or owner CHANGES_REQUESTED).
284
+
285
+ 6. Only then produce the one-sentence summary for the human of what is left + current state. Use terse quiet output for loops.
286
+
287
+ For any PR health / conflict / feedback / 'get green' work, start by using the dedicated pr-babysit skill (gh plate pr babysit or plate_pr_babysit MCP) rather than hand-rolling raw git + gh commands. Use the dedicated `gh plate pr babysit` (or MCP `plate_pr_babysit` + get_pr_merge_gates) surface by default. Escalate with `need:human-review` label + blocking comment for judgment items. This gives the agent ownership of the full "mergeable" state from a single high-level prompt instead of sequential single-category fixes waiting for user diagnosis. (Addresses #519, #528, #526, etc.)
288
+
289
+ The pr-babysit skill should support (or be used in) a "until green" / comprehensive make-mergeable flow with the above loop, appropriate quiet reporting, and clear human escalation points.
290
+
291
+ Use this section for any monitoring, babysitting, contemplation, or repeated what_next work. The goal is dramatically less noise in Issues and terminals while preserving every required traceable artifact.
292
+
293
+ ### Release Status Protocol (mandatory first step for any PR/branch/targeting work)
294
+ Before *any* branch targeting, PR creation (`gh pr create`), base edit, rebase decision, or determining integration target for Bug/Feature work (or babysit on a PR):
295
+
296
+ - Run `gh plate release status` (or equivalent MCP/CLI surface) *immediately as the very first action*.
297
+ - Use the output to discover the correct --base (`release` for legacy; `release-major`/`release-minor`/`release-patch` for multi-track), pending unreleased fragments, active Next Release #, extension checks, and on-hold Epics.
298
+ - This must be *proactive* (not after deciding the branch or after creating the PR). Defaulting to `main` or guessing is forbidden for ongoing work and will require manual re-targeting.
299
+ - In babysit or PR health flows (per #513), confirm the PR context aligns before proceeding with fixes.
300
+ - Enhance pr-babysit and planning surfaces to surface/release status output and the determined base automatically where possible.
301
+
302
+ See AGENTS.md §Branch Model and Ceremonies, §Documentation Rules, Feature/Bug work loops. (Addresses #513.)
303
+ """