nobrainer-tech-flow 0.0.0-stage → 2.4.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.
Files changed (149) hide show
  1. package/.agents/plugins/marketplace.json +20 -0
  2. package/.claude-plugin/marketplace.json +18 -0
  3. package/.claude-plugin/plugin.json +21 -0
  4. package/.codex-plugin/plugin.json +47 -0
  5. package/.opencode/INSTALL.md +37 -0
  6. package/.opencode/plugins/nobrainer-tech-skills.js +66 -0
  7. package/.pi/extensions/nobrainer-tech-skills.js +64 -0
  8. package/AGENTS.md +204 -0
  9. package/CLAUDE.md +204 -0
  10. package/CONTRIBUTING.md +70 -0
  11. package/GEMINI.md +1 -0
  12. package/LICENSE +21 -0
  13. package/README.md +658 -2
  14. package/SECURITY.md +33 -0
  15. package/adapters/bootstrap.md +27 -0
  16. package/assets/nobrainer-tech-logo.svg +1 -0
  17. package/assets/nobrainer-workflow.svg +155 -0
  18. package/assets/plugin-logo.png +0 -0
  19. package/bin/nobrainer-tech-flow.mjs +48 -0
  20. package/docs/BOUNDED_RUNNER.md +60 -0
  21. package/docs/CHAT_PLUGINS.md +29 -0
  22. package/docs/COMPATIBILITY.md +371 -0
  23. package/docs/INSTALL.md +626 -0
  24. package/docs/MIGRATION_TO_FLOW.md +117 -0
  25. package/docs/NAMING.md +39 -0
  26. package/docs/PRIVACY.md +9 -0
  27. package/docs/SESSION_RESTART.md +70 -0
  28. package/docs/SKILL_CURATION.md +124 -0
  29. package/docs/TESTING.md +232 -0
  30. package/docs/TRY_IT.md +109 -0
  31. package/docs/releases/v1.0.0.md +81 -0
  32. package/docs/releases/v1.1.0.md +85 -0
  33. package/docs/releases/v1.10.0.md +34 -0
  34. package/docs/releases/v1.11.0-publication-readback.md +25 -0
  35. package/docs/releases/v1.11.0.md +42 -0
  36. package/docs/releases/v1.12.0.md +30 -0
  37. package/docs/releases/v1.13.0.md +46 -0
  38. package/docs/releases/v1.14.0.md +43 -0
  39. package/docs/releases/v1.14.1.md +21 -0
  40. package/docs/releases/v1.2.0.md +87 -0
  41. package/docs/releases/v1.2.1.md +92 -0
  42. package/docs/releases/v1.3.0-publication-readback.md +69 -0
  43. package/docs/releases/v1.3.0.md +66 -0
  44. package/docs/releases/v1.3.1-publication-readback.md +76 -0
  45. package/docs/releases/v1.3.1.md +59 -0
  46. package/docs/releases/v1.4.0-publication-readback.md +81 -0
  47. package/docs/releases/v1.4.0.md +43 -0
  48. package/docs/releases/v1.5.0-publication-readback.md +76 -0
  49. package/docs/releases/v1.5.0.md +54 -0
  50. package/docs/releases/v1.6.0.md +64 -0
  51. package/docs/releases/v1.6.1-publication-readback.md +53 -0
  52. package/docs/releases/v1.6.1.md +82 -0
  53. package/docs/releases/v1.7.0.md +42 -0
  54. package/docs/releases/v1.7.1-publication-readback.md +64 -0
  55. package/docs/releases/v1.7.1.md +49 -0
  56. package/docs/releases/v1.8.0.md +63 -0
  57. package/docs/releases/v1.8.1.md +32 -0
  58. package/docs/releases/v1.9.0.md +33 -0
  59. package/docs/releases/v2.0.0-candidate.md +28 -0
  60. package/docs/releases/v2.0.0.md +53 -0
  61. package/docs/releases/v2.0.1.md +135 -0
  62. package/docs/releases/v2.0.2.md +189 -0
  63. package/docs/releases/v2.1.0.md +64 -0
  64. package/docs/releases/v2.1.1.md +43 -0
  65. package/docs/releases/v2.2.0.md +64 -0
  66. package/docs/releases/v2.2.1.md +11 -0
  67. package/docs/releases/v2.3.0.md +97 -0
  68. package/docs/releases/v2.3.1.md +71 -0
  69. package/docs/releases/v2.3.2.md +242 -0
  70. package/docs/releases/v2.4.0.md +126 -0
  71. package/gemini-extension.json +6 -0
  72. package/hooks/claude-hooks.json +17 -0
  73. package/hooks/hooks-cursor.json +10 -0
  74. package/hooks/run-hook.cmd +36 -0
  75. package/hooks/session-start +38 -0
  76. package/package.json +69 -4
  77. package/plugin.json +51 -0
  78. package/scripts/build_plugin.py +50 -0
  79. package/scripts/check_flow_update.py +18 -0
  80. package/scripts/check_public_commit.py +86 -0
  81. package/scripts/fetch_public_refs.py +69 -0
  82. package/scripts/install.py +600 -0
  83. package/scripts/install.sh +1392 -0
  84. package/scripts/install_guards.py +279 -0
  85. package/scripts/install_personalization.py +527 -0
  86. package/scripts/install_skills.py +951 -0
  87. package/scripts/npm_install.py +85 -0
  88. package/scripts/recommend_flow_setup.py +1522 -0
  89. package/scripts/validate_skills.py +465 -0
  90. package/skills/nobrainer-auto-fine-tune/SKILL.md +79 -0
  91. package/skills/nobrainer-auto-fine-tune/references/capacity-audit.md +49 -0
  92. package/skills/nobrainer-autoimprove/SKILL.md +212 -0
  93. package/skills/nobrainer-autoimprove/scripts/count_words.py +22 -0
  94. package/skills/nobrainer-browser/SKILL.md +234 -0
  95. package/skills/nobrainer-browser/references/cdp-profile-restart.md +93 -0
  96. package/skills/nobrainer-build/SKILL.md +173 -0
  97. package/skills/nobrainer-codex-context/SKILL.md +111 -0
  98. package/skills/nobrainer-codex-context/scripts/codex_context.py +175 -0
  99. package/skills/nobrainer-decide/SKILL.md +198 -0
  100. package/skills/nobrainer-dispatcher/SKILL.md +256 -0
  101. package/skills/nobrainer-dispatcher/agents/openai.yaml +4 -0
  102. package/skills/nobrainer-rca/SKILL.md +163 -0
  103. package/skills/nobrainer-research/SKILL.md +131 -0
  104. package/skills/nobrainer-review/SKILL.md +195 -0
  105. package/skills/nobrainer-security/SKILL.md +166 -0
  106. package/skills/nobrainer-sessions/SKILL.md +223 -0
  107. package/skills/nobrainer-sessions/references/evidence-receipt.md +55 -0
  108. package/skills/nobrainer-sessions/references/protocol.md +337 -0
  109. package/skills/nobrainer-sessions/references/session-restart.md +255 -0
  110. package/skills/nobrainer-sessions/scripts/evidence_receipt.py +373 -0
  111. package/skills/nobrainer-sessions/scripts/restart_gate.py +140 -0
  112. package/skills/nobrainer-sessions/scripts/run_bounded.py +390 -0
  113. package/skills/nobrainer-sessions/scripts/session_title.py +43 -0
  114. package/skills/nobrainer-skill-doctor/SKILL.md +149 -0
  115. package/skills/nobrainer-skill-doctor/references/astra.md +19 -0
  116. package/skills/nobrainer-skill-doctor/scripts/audit.py +100 -0
  117. package/skills/nobrainer-skill-doctor/scripts/context_candidates.py +133 -0
  118. package/skills/nobrainer-spec-driven-development/SKILL.md +132 -0
  119. package/skills/nobrainer-spec-driven-development/references/spec-template.md +114 -0
  120. package/skills/nobrainer-team/SKILL.md +165 -0
  121. package/skills/nobrainer-team/references/team-plan.md +64 -0
  122. package/skills/nobrainer-tech-flow/SKILL.md +239 -0
  123. package/skills/nobrainer-tech-flow/VERSION +1 -0
  124. package/skills/nobrainer-tech-flow/references/autopilot.md +72 -0
  125. package/skills/nobrainer-tech-flow/references/codex-routing.md +21 -0
  126. package/skills/nobrainer-tech-flow/references/communication.md +108 -0
  127. package/skills/nobrainer-tech-flow/references/correction-hooks.md +110 -0
  128. package/skills/nobrainer-tech-flow/references/daily-update.md +28 -0
  129. package/skills/nobrainer-tech-flow/references/delivery.md +243 -0
  130. package/skills/nobrainer-tech-flow/references/idea-to-delivery.md +82 -0
  131. package/skills/nobrainer-tech-flow/references/long-run-state.md +209 -0
  132. package/skills/nobrainer-tech-flow/references/model-routing.md +83 -0
  133. package/skills/nobrainer-tech-flow/references/optional-decisions.md +83 -0
  134. package/skills/nobrainer-tech-flow/references/project-start.md +22 -0
  135. package/skills/nobrainer-tech-flow/references/routing.md +125 -0
  136. package/skills/nobrainer-tech-flow/references/setup.md +180 -0
  137. package/skills/nobrainer-tech-flow/references/worktrees.md +138 -0
  138. package/skills/nobrainer-tech-flow/scripts/check_flow_update.py +298 -0
  139. package/skills/nobrainer-tech-flow/scripts/cleanup_worktree.py +327 -0
  140. package/skills/nobrainer-tech-flow/scripts/decision_config.py +107 -0
  141. package/skills/nobrainer-tech-flow/scripts/flow_guard.py +252 -0
  142. package/skills/nobrainer-tech-flow/scripts/typed_decisions.py +210 -0
  143. package/skills/nobrainer-wiki/SKILL.md +164 -0
  144. package/skills/nobrainer-wiki/references/setup.md +88 -0
  145. package/skills/nobrainer-writing/SKILL.md +272 -0
  146. package/skills/nobrainer-writing/agents/openai.yaml +4 -0
  147. package/skills/nobrainer-writing/references/brief-artifacts.md +357 -0
  148. package/skills/nobrainer-writing/references/plain-technical-english.md +76 -0
  149. package/skills/nobrainer-writing/references/research.md +86 -0
@@ -0,0 +1,212 @@
1
+ ---
2
+ name: nobrainer-autoimprove
3
+ description: "Use when the owner says nb-autoimprove, deep-autoresearch, code-autoresearch, nobrainer-capture-lesson, or nobrainer-continuous-improvement; asks to improve a skill or prompt; or wants a measurable bounded baseline-variant-evaluation loop instead of one subjective rewrite."
4
+ ---
5
+
6
+ # NoBrainer Autoimprove
7
+
8
+ Improve one artifact only when a frozen evaluation proves a candidate better.
9
+ This independent adaptation applies Andrej Karpathy's
10
+ [autoresearch](https://github.com/karpathy/autoresearch) measure-change-keep loop
11
+ to skills, prompts, instructions and other reviewable artifacts; it is not an
12
+ official Karpathy project.
13
+
14
+ ## Route the smallest fix
15
+
16
+ Fix an obvious typo, dead link or deterministic defect directly and cover it
17
+ with the normal test. Do not start an experiment when the objective cannot be
18
+ measured, target/evaluator isolation is impossible, or the change needs an
19
+ unapproved production, credential, publishing, safety or irreversible action.
20
+
21
+ Treat owner correction as evidence, not permission for a global rewrite:
22
+
23
+ - task-local clarification stays in the task;
24
+ - a repeatable behavior gap becomes a regression scenario;
25
+ - a verified durable fact or preference follows `LEARNING_WRITE_POLICY`:
26
+ `AUTO_SCOPED` writes one minimal sourced rule to one canonical store, `ASK`
27
+ prepares one exact diff, and `OFF` keeps it task-local: do not create a durable
28
+ diff in `AGENTS.md`, `tasks/lessons.md` or a wiki.
29
+
30
+ On `AGENT_ERROR_CORRECTED`, preserve the failing scenario and error fingerprint,
31
+ fix the active result first, then test the smallest reusable prevention. One
32
+ anecdote never justifies a broad user trait or unrelated write.
33
+
34
+ ## Frame before mutation
35
+
36
+ Freeze this contract before changing the target:
37
+
38
+ ```text
39
+ TARGET: <one artifact and allowed write scope>
40
+ OBJECTIVE: <one observable improvement>
41
+ BASELINE_VERSION: <commit/hash/copy>
42
+ DEVELOPMENT_EVAL: <representative iteration cases>
43
+ HOLDOUT_EVAL: <unseen promotion cases>
44
+ HARD_GATES: <format, safety and deterministic checks>
45
+ SCORE: <criteria, aggregation, direction and meaningful delta>
46
+ EVAL_INTEGRITY: <separate owners, access and calibration controls>
47
+ SCORE_RECEIPT: <append-only trial identity, provenance, raw evidence and decision>
48
+ NOISE_POLICY: <paired repetitions, dispersion and retry rule>
49
+ BUDGET: <finite variants, rounds, repetitions, retries, time and resources>
50
+ PLATEAU: <minimum delta and dry rounds>
51
+ ROLLBACK: <retained baseline, restore and readback>
52
+ OWNER_GATES: <action, owner and recorded evidence>
53
+ ```
54
+
55
+ Preserve the baseline in an isolated copy, branch or worktree. One coordinator
56
+ owns the champion and log; candidates never race on the same file.
57
+
58
+ ## Return a complete initial plan
59
+
60
+ An initial plan comes from a completed experiment contract, not a summary of
61
+ this skill. Resolve every field internally; the owner-facing plan need not mirror
62
+ internal labels. Never omit a hard gate or replace exact evidence with
63
+ "immutable receipt", "bounded budget" or similar shorthand.
64
+
65
+ The plan must operationalize:
66
+
67
+ - an observable access boundary: candidate write scope excludes evaluator
68
+ inputs, labels, logic, extractor, cases and holdout;
69
+ - ordinary positive, known-bad and tailored deceptive controls for the literal
70
+ gaming, omission and unsafe-abstention risks;
71
+ - fixed baseline/candidate identity, exact paired run count, blind or shuffled
72
+ presentation, seeds or sampling rule, dispersion, score math and threshold;
73
+ - the complete per-trial receipt fields, not a mutable aggregate;
74
+ - a disjoint holdout frozen before tuning, opened once, never reused for
75
+ iteration, with measurable primary delta, uncertainty rule and protected
76
+ usefulness, safety or regression guardrails;
77
+ - every supplied ceiling or an explicit stricter one, honest terminal states,
78
+ and each named owner's approval identity, scope, timestamp/evidence and next
79
+ gate. An experiment win grants no live or durable authority.
80
+
81
+ A ceiling needs a concrete quantity and unit; a label or promise to predeclare
82
+ one later is not a ceiling.
83
+
84
+ Unless the owner supplies another terminal, end plan-only output with
85
+ `STATUS: READY_FOR_OWNER_REVIEW | BLOCKED` and `EXECUTION: NOT_STARTED`. Pending
86
+ future gates normally mean ready for review. Use `BLOCKED` only when a missing
87
+ fact, boundary or decision prevents a valid proposal. Never imply that
88
+ calibration, trials or approval ran. Any owner-defined exact terminal values,
89
+ including experiment-result terminals, suppress canonical status and execution.
90
+
91
+ `STRICT_CAP` makes the owner's word limit a hard gate. Before applying either
92
+ formula, if `limit <= 40` with a counter or `limit <= 50` without one, skip the
93
+ reserved-offset formula and use the owner's actual cap for a minimal complete
94
+ answer. Return `BLOCKED` within the cap only when required facts cannot fit;
95
+ small limits alone are not a blocker. Otherwise apply the existing formula. At 250 words or
96
+ fewer, budget the draft to `min(limit - 40, 140)` words in at most six nonblank lines.
97
+ With a counter, compress until the owner limit passes; without one, target
98
+ `min(limit - 50, 130)` and never claim an exact count. Print no heading, blank
99
+ line, internal form, rollback explanation or duplicate terminal. Group only:
100
+ access; sets/controls; trials/receipt; holdout/decision; limits/stops; gates.
101
+ Preserve exact numbers, owners and negations; invent no optional mechanism.
102
+ Treat scope and timing qualifiers, closed field sets and terminal value domains as
103
+ non-compressible: reuse their literal wording instead of a plausible synonym.
104
+ When a qualifier applies to each role or item, repeat it for each; collective
105
+ shorthand is not equivalent.
106
+ If the owner gives a word range or minimum, its lower bound is also a hard gate
107
+ and overrides the compact budget. For an exact range, count the final draft with
108
+ an available whitespace counter and adjust once. Without one, target the range
109
+ midpoint and tally whitespace-delimited words before sending. For a bare minimum,
110
+ leave at least 10% headroom. Never exceed a stated maximum.
111
+ Count exact final text. For a serialized draft, pipe it through the bundled
112
+ `scripts/count_words.py --escaped-newlines`; a raw `%s` count is invalid evidence.
113
+
114
+ Run `CAP_AUDIT` before compact output: preserve disjoint one-time holdout and
115
+ open-once semantics; reproduce an exact receipt field list with no additions;
116
+ retain `immediately` when stops are immediate; and when the owner defines exact
117
+ terminal values, append no canonical status or execution field. If required
118
+ facts cannot fit, return `BLOCKED` within the cap rather than omitting them.
119
+ Scan the complete draft once more: no later duty may contradict a role's `only`
120
+ boundary, and every closed value domain retains its literal `only` or `no other`
121
+ qualifier.
122
+
123
+ ## Protect evaluator integrity
124
+
125
+ The evaluator owner and candidate owner must be separate. Candidate write scope
126
+ excludes the rubric, development/holdout cases, score extractor and acceptance
127
+ harness; keep them read-only and outside the candidate workspace when possible.
128
+ A prompt-only prohibition is insufficient when the generator can mutate the
129
+ score path. Record weaker isolation and do not promote a gameable result.
130
+
131
+ Before baseline scoring, calibrate the complete path on ordinary positive,
132
+ known-good, known-bad and tailored deceptive controls. It must rank good above
133
+ bad, reject deceptive metric gaming, and self-test score extraction and hard
134
+ failures. Trace every rubric requirement to the frozen request; a hidden
135
+ judge-only requirement invalidates the evaluator. Missing ground truth or failed
136
+ calibration is `BLOCKED`.
137
+
138
+ Bind every score to an append-only immutable receipt containing: experiment and
139
+ round ID; candidate ID and target hash; case-set, evaluator, rubric and extractor
140
+ hashes; judge version/settings; seed or sampling policy and call order;
141
+ input/data snapshot and configuration; timestamp, repetition ID, environment and
142
+ budget identity; raw evidence; criterion vector, hard gates, inclusion,
143
+ retry/error/stop and resulting decision; aggregation formula, inputs, math and
144
+ aggregate. Content-address it and forbid post-hoc edits. Changed provenance makes
145
+ results non-comparable: re-baseline instead of carrying a score forward.
146
+
147
+ Predeclare at least three paired repetitions under identical conditions and
148
+ compare aggregated gain with measured dispersion. Forbid cherry-picking and
149
+ favorable retries. Retry only one predeclared transient failure; receipt and
150
+ count it, never retry to change a result. A calibrated deterministic evaluator
151
+ may run once when its receipt proves determinism.
152
+
153
+ Production deployment, credentials, publishing, security or system changes,
154
+ external contact, spend, destructive actions, durable policy, lessons or wiki
155
+ writes remain named owner gates. Record the owner, decision and evidence
156
+ reference before action; experiment success grants none of them.
157
+
158
+ ## Run the bounded loop
159
+
160
+ `FRAME -> CALIBRATE -> BASELINE -> GENERATE -> HARD_GATE -> DEV_SCORE -> SELECT -> FINAL_HOLDOUT -> PROMOTE_OR_REVERT`
161
+
162
+ Use development cases for common, edge, adversarial and non-trigger behavior.
163
+ Prefer one behavioral change per round and three to six genuinely different
164
+ candidate hypotheses. Run deterministic, public-clean and security gates before
165
+ judge spend. A hard-gate failure, missing receipt or failed calibration is
166
+ disqualified, not averaged down.
167
+
168
+ Score on the unchanged development eval. Select only beyond measured noise; on
169
+ a near-tie keep the simpler, shorter, lower-risk artifact. One optional graft may
170
+ combine distinct strengths from a losing candidate, then rerun every gate.
171
+
172
+ Open the sealed holdout exactly once for the unchanged baseline and champion.
173
+ Promotion requires all hard gates, the predeclared meaningful primary gain, no
174
+ protected regression, target-workflow review when subjective, retained baseline
175
+ and tested rollback. A holdout loss is `REVERTED`; never tune on that holdout.
176
+ Any next attempt needs a new holdout, new baseline and new experiment record.
177
+
178
+ When nested under `nobrainer-tech-flow`, update its one canonical TODO after each
179
+ auditable round and final holdout; do not create a second status owner.
180
+
181
+ ## Stop the experiment, not the outcome
182
+
183
+ Stop the current experiment on its predeclared decision, failed evidence or
184
+ safety anomaly, configured dry rounds, practical score ceiling, exhausted
185
+ budget, converged candidates, hard-gate regression, holdout loss, or changed
186
+ target/constraints/authorization. A null result retains the baseline.
187
+
188
+ These stops do not close a still-open owner outcome. If proved improvement is
189
+ still required, diagnose frozen evidence once, choose the smallest high-leverage
190
+ change and start a fresh bounded experiment. Never reuse a failed holdout or
191
+ substitute blind retries. Apply Pareto discipline: remove the largest observed
192
+ failure before polishing lower-impact criteria. Close only when DoD passes or a
193
+ concrete authority, access, budget or distinct-hypothesis blocker is reported.
194
+
195
+ ## Final report
196
+
197
+ Return winner/baseline identity, development and holdout scores, criterion
198
+ vectors, hard-gate output, noise/dispersion, calibrated evaluator status, budget,
199
+ stop reason, diff, rollback and uncertainty. End with:
200
+
201
+ ```text
202
+ PROMOTION: PROMOTED | NO_CHANGE | REVERTED | BLOCKED
203
+ CHAMPION: <version/ref or BASELINE>
204
+ HOLDOUT_RESULT: PASS | FAIL | NOT_RUN
205
+ EVALUATOR_STATUS: CALIBRATED | FAILED | UNVERIFIED
206
+ SCORE_RECEIPT: <immutable receipt ref or NONE>
207
+ NOISE_RESULT: <replications, dispersion and comparable delta or NOT_APPLICABLE>
208
+ ```
209
+
210
+ Use `NO_CHANGE` when no candidate proves better, `REVERTED` after holdout loss,
211
+ and `BLOCKED` when a gate prevents a valid experiment. Never claim `PROMOTED`
212
+ without paired comparable scores and a successful holdout.
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env python3
2
+ """Count whitespace-delimited words in raw or newline-escaped text."""
3
+
4
+ from __future__ import annotations
5
+
6
+ import argparse
7
+ import sys
8
+
9
+
10
+ def main() -> int:
11
+ parser = argparse.ArgumentParser()
12
+ parser.add_argument("--escaped-newlines", action="store_true")
13
+ args = parser.parse_args()
14
+ text = sys.stdin.read()
15
+ if args.escaped_newlines:
16
+ text = text.replace("\\r\\n", "\n").replace("\\n", "\n").replace("\\r", "\n")
17
+ print(len(text.split()))
18
+ return 0
19
+
20
+
21
+ if __name__ == "__main__":
22
+ raise SystemExit(main())
@@ -0,0 +1,234 @@
1
+ ---
2
+ name: nobrainer-browser
3
+ description: "Use when the owner says nb-browser or nobrainer-browser, asks to inspect or operate a rendered website, attach to an existing approved Chrome/Edge session, restart an approved non-default Chromium profile for loopback CDP, reproduce a browser flow, run Playwright tests, or record and analyze a Playwright trace. Prefer a current Playwright CLI with an explicit version readback; do not set up MCP or extra browser plugins by default."
4
+ ---
5
+
6
+ # NoBrainer Browser
7
+
8
+ Choose the browser path from the active client and the operation the task needs.
9
+ In Codex desktop, prefer its built-in browser for ordinary rendered-site work;
10
+ use Playwright CLI for repository browser tests, repeatable automation and trace
11
+ analysis. Do not add a second browser framework merely because one exists.
12
+
13
+ ## Route the task
14
+
15
+ | Need | Default |
16
+ |---|---|
17
+ | In Codex desktop, inspect or operate a rendered website or local app | Codex built-in browser (`@Browser`) when the active host exposes it |
18
+ | In Codex desktop, use an already approved regular Chrome session | `@Chrome` through the approved browser extension when available; otherwise use the explicit CDP attach path below only when requested and approved |
19
+ | In other clients, inspect or operate a rendered page | That client's documented native browser capability; do not assume Codex or Playwright features exist |
20
+ | Run or debug repository tests | the repository's `npx playwright test` |
21
+ | Record or inspect failure evidence | Playwright trace + `show-trace` |
22
+ | Plain static content already available without a browser | use the cheaper read path |
23
+
24
+ ### Codex browser preference and capability
25
+
26
+ On the first browser task in a Codex desktop task/session, check for an explicit
27
+ browser preference in the current instructions or earlier owner choice. If none
28
+ is recorded, tell the owner briefly: "I'll use Codex's built-in browser by
29
+ default; tell me if you'd prefer an already approved Chrome session." Continue
30
+ with the built-in browser without waiting for a reply when it exposes the
31
+ operation needed. Do not ask again in the same task/session after a preference
32
+ is known. A preference stated for one task applies to that task; change the
33
+ default only when the owner says it is a lasting preference. Record and reuse a
34
+ lasting choice through the client's supported personalization mechanism only
35
+ when authorized; report when the client provides no such mechanism instead of
36
+ claiming it was saved.
37
+
38
+ The Codex desktop built-in browser can open pages and interact with rendered
39
+ state, including clicks, typing, screenshots and result verification. Invoke
40
+ or reference it as `@Browser` when the active Codex host supports browser use.
41
+ It uses a separate browser profile and does not automatically inherit regular
42
+ Chrome tabs, logins or session state. Ask for a preference when an existing
43
+ authenticated session might matter, but keep the question non-blocking when the
44
+ built-in browser can safely do the task. Use the approved Chrome extension path
45
+ (`@Chrome`) when the owner chooses their regular browser session and that
46
+ capability is available. Use CDP attach only under the existing-session rules
47
+ below. Never copy cookies or profile data between browsers.
48
+
49
+ Confirm the required operation is actually exposed before selecting a route.
50
+ An `open_in_codex` browser-panel/display capability can show a URL or browser
51
+ tab in the Codex UI; by itself it does not provide browser automation, page
52
+ inspection, user approval or proof of a side effect. Do not treat it as an
53
+ `@Browser` interaction capability. If the native browser is unavailable or
54
+ cannot perform the needed operation, state the exact missing capability and
55
+ use an available, authorized alternative (such as the Playwright CLI) only when
56
+ it satisfies the task's login and safety needs. If no safe capable route is
57
+ available, stop and report the limitation.
58
+
59
+ For clients other than Codex, inspect that client's live/documented native
60
+ browser support first. This preference rule does not make `@Browser`, `@Chrome`
61
+ or Codex panel tools portable to other clients.
62
+
63
+ Do not install MCP when the CLI covers the task. Do not install a browser
64
+ plugin as the default path. Reuse an already configured MCP only when the
65
+ current harness cannot perform the required operation and the MCP has fresh
66
+ capability readback.
67
+
68
+ ## Capability and install gate
69
+
70
+ First inspect local capabilities independently and keep the interactive and
71
+ repository-test CLIs distinct:
72
+
73
+ ```bash
74
+ global_cli_status=none
75
+ local_test_cli_status=none
76
+
77
+ if command -v playwright-cli >/dev/null 2>&1 &&
78
+ playwright-cli --version >/dev/null 2>&1; then
79
+ global_cli_status=usable
80
+ fi
81
+
82
+ if [ -f package.json ] &&
83
+ [ -x node_modules/.bin/playwright ] &&
84
+ node_modules/.bin/playwright --version >/dev/null 2>&1; then
85
+ local_test_cli_status=usable
86
+ fi
87
+
88
+ printf 'global_cli=%s\n' "$global_cli_status"
89
+ printf 'local_test_cli=%s\n' "$local_test_cli_status"
90
+
91
+ if [ "$global_cli_status" = usable ] ||
92
+ [ "$local_test_cli_status" = usable ]; then
93
+ printf 'some_playwright_capability=available\n'
94
+ else
95
+ printf 'some_playwright_capability=none\n' >&2
96
+ exit 1
97
+ fi
98
+ ```
99
+
100
+ Use `global_cli=usable` for interactive `playwright-cli` work. Use
101
+ `local_test_cli=usable` only for the repository's standard Playwright test CLI;
102
+ it does not prove that interactive `playwright-cli` commands such as `attach`,
103
+ `snapshot`, `click` or `fill` are available. If the capability required by the
104
+ request is not usable and setup is not in scope, stop with the exact missing
105
+ capability and one remediation; do not query npm or install.
106
+
107
+ When setup is explicitly in scope and the required local capability is not
108
+ available, use the current npm channel only to discover a version, then pin
109
+ that exact version for execution and record the readback:
110
+
111
+ ```bash
112
+ PLAYWRIGHT_CLI_VERSION="$(npm view @playwright/cli version)"
113
+ test -n "$PLAYWRIGHT_CLI_VERSION"
114
+ npm install -g "@playwright/cli@$PLAYWRIGHT_CLI_VERSION"
115
+ playwright-cli --version
116
+ playwright-cli --help
117
+ playwright-cli --help attach
118
+ ```
119
+
120
+ Package installation is a machine write. Perform it only when setup is within
121
+ scope, and do not claim success until the binary readback passes. For a test
122
+ repository, prefer its lockfile and package scripts over changing dependencies.
123
+
124
+ The CLI also offers `playwright-cli install --skills`. Do not run it by default
125
+ while `nobrainer-browser` owns browser routing: that would add another skill
126
+ owner with overlapping triggers. Read the live CLI help instead. If the owner
127
+ chooses the upstream Playwright skills, reconcile to one browser-skill owner
128
+ rather than keeping both active.
129
+
130
+ ## Restart an approved profile for CDP attach
131
+
132
+ Use this flow only when the owner explicitly approves closing the target browser
133
+ and the target is an existing, dedicated Chromium user-data directory. It is
134
+ not a way to make a daily/default Chrome profile remotely debuggable. Read the
135
+ [bounded CDP profile restart reference](references/cdp-profile-restart.md)
136
+ before any process or profile action; it separates identity readback, stopping,
137
+ loopback launch, endpoint verification and CLI attach.
138
+
139
+ ## Existing-session attach
140
+
141
+ Use attach when the owner needs the actual approved session, login or open tab:
142
+
143
+ ```bash
144
+ playwright-cli attach --cdp=chrome
145
+ playwright-cli attach --cdp=http://127.0.0.1:9222
146
+ # Example for a separately configured Edge debugging endpoint:
147
+ playwright-cli attach --cdp=http://127.0.0.1:9333
148
+ ```
149
+
150
+ The current CLI accepts a supported channel such as `chrome` or an actual CDP
151
+ endpoint URL; verify the live `attach` help because this interface can change.
152
+ CDP attach is Chromium-only. Confirm the exact browser, profile, endpoint and
153
+ write scope before acting. The CLI also exposes extension attach, but that is
154
+ not the default because it requires a browser extension. If attach is
155
+ unavailable, say so; do not bypass a saved browser permission block, copy or
156
+ mirror a profile, extract cookies, reuse credentials, or silently launch a
157
+ look-alike authenticated session. A request to inspect does not authorize form
158
+ submission, purchase, publication, message sending, deletion or account
159
+ changes.
160
+
161
+ If no existing login is required, a disposable session is simpler:
162
+
163
+ ```bash
164
+ playwright-cli open https://example.com
165
+ ```
166
+
167
+ ## Inspect and operate
168
+
169
+ Take a fresh snapshot before using element references, and refresh it after a
170
+ navigation or substantial DOM change:
171
+
172
+ ```bash
173
+ playwright-cli snapshot
174
+ playwright-cli find "Settings"
175
+ playwright-cli click e4
176
+ playwright-cli fill e7 "value"
177
+ playwright-cli eval "el => el.textContent" e4
178
+ ```
179
+
180
+ Prefer semantic refs and visible state over brittle coordinates. For each
181
+ material action, verify the resulting URL, visible state or downloaded artifact
182
+ instead of trusting command exit alone.
183
+
184
+ ## Tests and traces
185
+
186
+ Use the repository's existing script/config first. Narrow the test target and
187
+ record a trace when reproduction or evidence matters:
188
+
189
+ ```bash
190
+ npx playwright test path/to/spec --trace on
191
+ REPORT_PORT=9324 # replace with an available explicit port
192
+ npx playwright show-report --port "$REPORT_PORT"
193
+ npx playwright show-trace trace.zip
194
+ ```
195
+
196
+ For a live CLI flow:
197
+
198
+ ```bash
199
+ playwright-cli tracing-start
200
+ playwright-cli snapshot
201
+ # perform the bounded steps
202
+ playwright-cli tracing-stop
203
+ ```
204
+
205
+ Locate the actual trace artifact, preserve its path and open it. Review Actions,
206
+ DOM snapshots, Network, Console and Source; a green status without the expected
207
+ side effect is not proof. Use an available explicit report port; do not assume
208
+ that `--port 0` selects an ephemeral port across CLI versions. Treat traces as
209
+ sensitive artifacts: they may contain cookies, headers, form values, URLs,
210
+ payloads and private page content. Keep them in a project-ignored or temporary
211
+ path, inspect and redact before sharing, and never commit them as routine
212
+ evidence. Do not edit project trace policy merely to inspect one failure when a
213
+ CLI flag is sufficient.
214
+
215
+ ## Failure and closeout
216
+
217
+ - If the CLI, target session or required permission is unavailable, stop with
218
+ the exact failed probe and one remediation.
219
+ - If a trace cannot reproduce the issue, report `NOT_REPRODUCED`; do not invent
220
+ a cause.
221
+ - For an attached external session use `playwright-cli detach`; never close it.
222
+ Restart or close an existing profile only through the explicit pre-attach flow
223
+ above. Close only a disposable session owned by this CLI run.
224
+ - Report the exact CLI version, browser/session mode, pages or tests inspected,
225
+ trace/report paths, observed result, side effects, uncertainty and cleanup.
226
+
227
+ Sources: [Codex and built-in browser](https://learn.chatgpt.com/docs/browser),
228
+ [ChatGPT browser extension](https://learn.chatgpt.com/docs/chrome-extension),
229
+ [Playwright attach](https://playwright.dev/agent-cli/commands/attach),
230
+ [Playwright `connectOverCDP`](https://playwright.dev/docs/api/class-browsertype),
231
+ [Playwright test CLI](https://playwright.dev/docs/test-cli),
232
+ [Trace Viewer](https://playwright.dev/docs/trace-viewer),
233
+ [Chrome remote-debugging security changes](https://developer.chrome.com/blog/remote-debugging-port),
234
+ and [`@playwright/cli` on npm](https://www.npmjs.com/package/@playwright/cli).
@@ -0,0 +1,93 @@
1
+ # Restart an approved profile for CDP attach
2
+
3
+ Use this reference only when the owner explicitly approves closing the target
4
+ browser and the target is an existing, dedicated Chromium user-data directory.
5
+ The shell examples are POSIX; use the platform equivalent for process readback
6
+ and graceful exact-PID stopping on another operating system.
7
+
8
+ ## Resolve and preflight
9
+
10
+ Resolve these values without printing secrets or persisting the profile path:
11
+
12
+ ```text
13
+ BROWSER_EXECUTABLE: <approved Chrome, Chromium or Edge binary>
14
+ BROWSER_PID: <exact numeric PID read back from that executable and profile>
15
+ BROWSER_USER_DATA_DIR: <existing, approved non-default user-data directory>
16
+ BROWSER_PROFILE: <profile directory inside that user-data directory>
17
+ CDP_PORT: <unused local port>
18
+ PLAYWRIGHT_CLI_SESSION: <named CLI session>
19
+ ```
20
+
21
+ Read the exact process identity and arguments, confirm the executable and data
22
+ directory match, and check for unsaved work. Continue only when the readback is
23
+ `PROCESS_MATCH=PASS`, `PROFILE_MATCH=PASS` and `UNSAVED_WORK=NONE`. Run the
24
+ preflight and stop as separate invocations:
25
+
26
+ ```bash
27
+ test -n "$BROWSER_PID"
28
+ case "$BROWSER_PID" in
29
+ ''|*[!0-9]*) printf '%s\n' 'BROWSER_STOP_BLOCKED'; exit 1 ;;
30
+ esac
31
+ ps -p "$BROWSER_PID" -o pid=,comm=,args=
32
+ ```
33
+
34
+ If any preflight match is missing, return `BROWSER_STOP_BLOCKED` and stop. Do
35
+ not use a broad process matcher. A force stop requires a fresh identity readback
36
+ and a second explicit owner approval for that exact PID.
37
+
38
+ ## Stop and relaunch
39
+
40
+ After the pass readback, stop the exact process in a separate invocation:
41
+
42
+ ```bash
43
+ kill -TERM "$BROWSER_PID"
44
+ ```
45
+
46
+ After a bounded grace period, re-read the process list and profile lock. Require
47
+ `BROWSER_PID=GONE` and `PROFILE_LOCK=GONE` before continuing. If the process
48
+ remains or the profile is locked, return `BROWSER_STOP_BLOCKED` and stop; never
49
+ continue against a locked profile.
50
+
51
+ Start the same approved profile with CDP bound to loopback only:
52
+
53
+ ```bash
54
+ "$BROWSER_EXECUTABLE" \
55
+ --remote-debugging-address=127.0.0.1 \
56
+ --remote-debugging-port="$CDP_PORT" \
57
+ --user-data-dir="$BROWSER_USER_DATA_DIR" \
58
+ --profile-directory="$BROWSER_PROFILE" \
59
+ about:blank &
60
+ BROWSER_LAUNCH_PID=$!
61
+ ```
62
+
63
+ Chrome 136 and newer requires `--user-data-dir` to point to a non-default data
64
+ directory when remote debugging is enabled. Do not point this flow at the
65
+ daily/default directory, copy or mirror a profile, extract cookies, add a
66
+ permissive remote-origin wildcard, or bind CDP to a non-loopback address. If the
67
+ only available session is the daily/default profile, use the approved extension
68
+ attach path or a disposable/Chrome-for-Testing profile instead.
69
+
70
+ ## Verify and attach
71
+
72
+ Read back the endpoint before attaching. If it does not respond, return
73
+ `BROWSER_ATTACH_BLOCKED` and stop; do not silently switch to another profile or
74
+ endpoint:
75
+
76
+ ```bash
77
+ curl --fail --silent --show-error "http://127.0.0.1:${CDP_PORT}/json/version"
78
+ playwright-cli attach --cdp="http://127.0.0.1:${CDP_PORT}" --session="$PLAYWRIGHT_CLI_SESSION"
79
+ playwright-cli --session="$PLAYWRIGHT_CLI_SESSION" list
80
+ playwright-cli --session="$PLAYWRIGHT_CLI_SESSION" snapshot
81
+ ```
82
+
83
+ The endpoint, page list and snapshot prove connectivity only; they do not
84
+ authorize form submission, publication or other external side effects. Confirm
85
+ the expected browser, profile and tab before operating. Record the exact CLI
86
+ version, browser/session mode and observed pages, but redact the profile path,
87
+ cookies, headers and private page data.
88
+
89
+ If the CLI created the browser itself, `playwright-cli close-all` or
90
+ `playwright-cli kill-all` may be used only for those CLI-owned sessions after a
91
+ fresh `playwright-cli list`. Do not use either command to close an externally
92
+ attached profile. After an external attach, use `playwright-cli detach`; never
93
+ close the attached browser from the CLI.