@matyah00/openpi 0.1.2

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 (98) hide show
  1. package/README.md +117 -0
  2. package/agents/agent-chain.yaml +113 -0
  3. package/agents/backend.md +13 -0
  4. package/agents/basher.md +27 -0
  5. package/agents/builder.md +14 -0
  6. package/agents/code-searcher.md +27 -0
  7. package/agents/context-pruner.md +29 -0
  8. package/agents/directory-lister.md +25 -0
  9. package/agents/documenter.md +13 -0
  10. package/agents/editor.md +27 -0
  11. package/agents/file-picker.md +27 -0
  12. package/agents/frontend.md +14 -0
  13. package/agents/glob-matcher.md +25 -0
  14. package/agents/librarian.md +27 -0
  15. package/agents/loop-controller.md +41 -0
  16. package/agents/pi-pi/agent-expert.md +97 -0
  17. package/agents/pi-pi/cli-expert.md +41 -0
  18. package/agents/pi-pi/config-expert.md +63 -0
  19. package/agents/pi-pi/ext-expert.md +43 -0
  20. package/agents/pi-pi/keybinding-expert.md +134 -0
  21. package/agents/pi-pi/pi-orchestrator.md +57 -0
  22. package/agents/pi-pi/prompt-expert.md +70 -0
  23. package/agents/pi-pi/skill-expert.md +42 -0
  24. package/agents/pi-pi/theme-expert.md +40 -0
  25. package/agents/pi-pi/tui-expert.md +85 -0
  26. package/agents/plan-reviewer.md +22 -0
  27. package/agents/planner.md +14 -0
  28. package/agents/problem-architect.md +55 -0
  29. package/agents/red-team.md +13 -0
  30. package/agents/reviewer.md +14 -0
  31. package/agents/rule-verifier.md +35 -0
  32. package/agents/scout.md +14 -0
  33. package/agents/security-auditor.md +35 -0
  34. package/agents/ship-guard.md +34 -0
  35. package/agents/spec-reviewer.md +41 -0
  36. package/agents/teams.yaml +73 -0
  37. package/agents/tester.md +27 -0
  38. package/agents/thinker.md +26 -0
  39. package/agents/worker.md +27 -0
  40. package/damage-control-rules.yaml +277 -0
  41. package/extensions/agent-chain.ts +293 -0
  42. package/extensions/agent-team.ts +312 -0
  43. package/extensions/audit-tools.ts +260 -0
  44. package/extensions/commands.ts +169 -0
  45. package/extensions/damage-control-continue.ts +243 -0
  46. package/extensions/lib/packagePaths.ts +13 -0
  47. package/extensions/minimal.ts +34 -0
  48. package/extensions/openpi.ts +255 -0
  49. package/extensions/pure-focus.ts +24 -0
  50. package/extensions/purpose-gate.ts +84 -0
  51. package/extensions/search-tools.ts +277 -0
  52. package/extensions/state-tools.ts +276 -0
  53. package/extensions/system-select.ts +120 -0
  54. package/extensions/theme-cycler.ts +181 -0
  55. package/extensions/themeMap.ts +145 -0
  56. package/extensions/tool-counter-widget.ts +68 -0
  57. package/extensions/tool-counter.ts +102 -0
  58. package/extensions/workflow.ts +642 -0
  59. package/package.json +60 -0
  60. package/prompts/blueprint.md +66 -0
  61. package/prompts/clarify.md +26 -0
  62. package/prompts/compress.md +23 -0
  63. package/prompts/debate.md +23 -0
  64. package/prompts/deep.md +36 -0
  65. package/prompts/deps.md +24 -0
  66. package/prompts/explore.md +22 -0
  67. package/prompts/ghost-test.md +22 -0
  68. package/prompts/goal.md +26 -0
  69. package/prompts/parallel.md +42 -0
  70. package/prompts/plan-team.md +31 -0
  71. package/prompts/prime.md +17 -0
  72. package/prompts/review.md +23 -0
  73. package/prompts/sentinel.md +29 -0
  74. package/prompts/ship.md +30 -0
  75. package/prompts/snapshot.md +26 -0
  76. package/prompts/spec.md +58 -0
  77. package/prompts/test.md +13 -0
  78. package/prompts/validate.md +19 -0
  79. package/skills/bowser/SKILL.md +114 -0
  80. package/skills/env-scanner/SKILL.md +25 -0
  81. package/skills/security-guard/SKILL.md +24 -0
  82. package/skills/session-continuity/SKILL.md +20 -0
  83. package/skills/spec-driven/SKILL.md +25 -0
  84. package/skills/test-first/SKILL.md +23 -0
  85. package/skills/ultrathink/SKILL.md +27 -0
  86. package/themes/catppuccin-mocha.json +86 -0
  87. package/themes/cyberpunk.json +81 -0
  88. package/themes/dracula.json +81 -0
  89. package/themes/everforest.json +82 -0
  90. package/themes/gruvbox.json +80 -0
  91. package/themes/midnight-ocean.json +76 -0
  92. package/themes/nord.json +84 -0
  93. package/themes/ocean-breeze.json +83 -0
  94. package/themes/rose-pine.json +82 -0
  95. package/themes/synthwave.json +82 -0
  96. package/themes/tokyo-night.json +83 -0
  97. package/tsconfig.json +15 -0
  98. package/types/pi-shims.d.ts +102 -0
@@ -0,0 +1,66 @@
1
+ ---
2
+ description: Create an implementation blueprint before risky work
3
+ category: planning
4
+ aliases:
5
+ - plan
6
+ ---
7
+
8
+ Create a concise implementation blueprint for:
9
+
10
+ $ARGUMENTS
11
+
12
+ Use `/add` for straightforward work. Use this blueprint when the change touches several files, changes contracts, changes data, has unclear risk, or needs approval before editing.
13
+
14
+ If the request contains `--deep`, apply ultrathink mode:
15
+
16
+ - gather more evidence before deciding
17
+ - consider 2-3 approaches
18
+ - trace downstream effects across APIs, data, tests, and UX
19
+ - spend extra effort on parallel-safety and coupling analysis
20
+
21
+ Process:
22
+
23
+ 1. If this is vague, switch to `/clarify` behavior first.
24
+ 2. If a spec is supplied, use `spec-reviewer` before planning.
25
+ 3. Use `env_scan`, `project_tree`, and `code_search_batch` to map impact.
26
+ 4. Identify files likely to change and tests likely to prove the change.
27
+ 5. Use `parallel_safety_check` when the plan has multiple independent milestones.
28
+ 6. Use `problem-architect` or `plan-reviewer` for high-risk plans.
29
+
30
+ Output:
31
+
32
+ ```text
33
+ Blueprint: {title}
34
+ Risk: low | medium | high - {why}
35
+
36
+ Goal:
37
+ Non-goals:
38
+
39
+ Evidence:
40
+ - file:line - why it matters
41
+
42
+ Approaches:
43
+ 1.
44
+ 2.
45
+ 3.
46
+
47
+ Chosen approach:
48
+
49
+ Milestones:
50
+ 1. {file:line or path} - {change} - {verification}
51
+
52
+ Parallel waves:
53
+ - Wave 1:
54
+ - Wave 2:
55
+
56
+ Risks:
57
+ - {risk} - mitigation
58
+
59
+ Verification:
60
+ - {command or manual check}
61
+
62
+ Approval gate:
63
+ Await explicit approval before editing.
64
+ ```
65
+
66
+ Do not edit files until the plan is clear.
@@ -0,0 +1,26 @@
1
+ ---
2
+ description: Resolve ambiguity before planning or coding
3
+ category: planning
4
+ aliases:
5
+ - clear
6
+ ---
7
+
8
+ Clarify this request before planning or implementation:
9
+
10
+ $ARGUMENTS
11
+
12
+ Work in read-only mode. Do not edit files.
13
+
14
+ Process:
15
+
16
+ 1. Identify the goal, user, success state, and what is already specified.
17
+ 2. Use `env_scan`, `project_tree`, or `code_search_batch` only if project context is needed to ask better questions.
18
+ 3. Ask at most five unresolved questions, grouped by:
19
+ - goal
20
+ - scope boundary
21
+ - acceptance criteria
22
+ - failure modes
23
+ - constraints
24
+ 4. Do not ask implementation-detail questions unless they change user-visible behavior.
25
+
26
+ Return a concise clarification brief with draft acceptance criteria and explicit open questions.
@@ -0,0 +1,23 @@
1
+ ---
2
+ description: Compress current task context into a continuation brief
3
+ category: context
4
+ aliases:
5
+ - prune
6
+ ---
7
+
8
+ Compress the current task context into a continuation brief.
9
+
10
+ Focus:
11
+
12
+ 1. Current objective.
13
+ 2. User constraints and preferences.
14
+ 3. Files changed or inspected.
15
+ 4. Important commands and outcomes.
16
+ 5. Decisions already made.
17
+ 6. Remaining work and risks.
18
+
19
+ Use `spawn_agents` with `context-pruner` if the context is long. Do not solve new work.
20
+
21
+ Additional focus:
22
+
23
+ $ARGUMENTS
@@ -0,0 +1,23 @@
1
+ ---
2
+ description: Adversarial decision protocol for hard tradeoffs
3
+ category: planning
4
+ aliases:
5
+ - decide
6
+ ---
7
+
8
+ Run an adversarial decision protocol for:
9
+
10
+ $ARGUMENTS
11
+
12
+ Use this only for decisions that are costly to reverse or where criteria conflict.
13
+
14
+ Process:
15
+
16
+ 1. Frame the decision and list the options.
17
+ 2. State the decision criteria and their priority.
18
+ 3. Use `spawn_agents` with `thinker`, `red-team`, and `plan-reviewer` when useful.
19
+ 4. Steelman each option before comparing.
20
+ 5. Search for a third option or hybrid if both obvious options are weak.
21
+ 6. Return the winner, confidence, deciding evidence, and rollback plan.
22
+
23
+ Do not edit files.
@@ -0,0 +1,36 @@
1
+ ---
2
+ description: Deep evidence-led reasoning for hard bugs, architecture, or plans
3
+ category: planning
4
+ aliases:
5
+ - think
6
+ - ultrathink
7
+ ---
8
+
9
+ Use ultrathink mode for this task:
10
+
11
+ $ARGUMENTS
12
+
13
+ Process:
14
+
15
+ 1. Interpret whether this wraps another command. If it starts with `/blueprint`, `/add`, `/fix`, `/debate`, `/ship`, or another command, follow that command's workflow with deep mode enabled.
16
+ 2. Gather evidence first with `env_scan`, `project_tree`, `code_search_batch`, or `spawn_agents` using `file-picker` and `code-searcher`.
17
+ 3. Consider at least 2-3 plausible approaches or root causes before choosing.
18
+ 4. Trace downstream effects across files, APIs, data, tests, UX, and operations.
19
+ 5. Use `spawn_agents` with `thinker` only after evidence is available.
20
+ 6. If a plan is produced, use `plan-reviewer` to challenge assumptions, order, tests, and risks.
21
+ 7. Return a concrete next patch or decision, not generic advice.
22
+
23
+ Separate confirmed facts from inference. Include file paths and validation steps.
24
+
25
+ Output contract:
26
+
27
+ ```text
28
+ Deep read: {one-line task interpretation}
29
+ Decision: {chosen path or answer}
30
+ Why:
31
+ - {evidence-backed reason}
32
+ - {tradeoff}
33
+ Next: {verification command or implementation step}
34
+ ```
35
+
36
+ Do not expose hidden reasoning. Keep the final output concise.
@@ -0,0 +1,24 @@
1
+ ---
2
+ description: Audit dependency manifests, lockfiles, loose pins, and update risk
3
+ category: quality
4
+ aliases:
5
+ - dependencies
6
+ ---
7
+
8
+ Audit dependencies for:
9
+
10
+ $ARGUMENTS
11
+
12
+ Process:
13
+
14
+ 1. Run `dependency_inventory`.
15
+ 2. Use `env_scan` to confirm package managers and frameworks.
16
+ 3. If the user explicitly asks for live vulnerability or outdated checks, run the project-native audit command only after confirming it is safe for this repo.
17
+ 4. Classify findings:
18
+ - patch update: low risk
19
+ - minor update: medium risk
20
+ - major update: high risk, needs migration plan
21
+ - missing lockfile: supply-chain risk
22
+ - loose pin: review risk
23
+
24
+ Return tables for outdated/risk/unused or say exactly which checks were not run.
@@ -0,0 +1,22 @@
1
+ ---
2
+ description: Map relevant files and code paths before implementation
3
+ category: discovery
4
+ aliases:
5
+ - x
6
+ ---
7
+
8
+ Explore the project for this task:
9
+
10
+ $ARGUMENTS
11
+
12
+ Use Pi-native discovery:
13
+
14
+ 1. Use `project_tree` for a compact structure map if the relevant area is unclear.
15
+ 2. Use `code_search_batch` for symbols, routes, config keys, errors, and user-facing strings.
16
+ 3. Use `spawn_agents` when useful:
17
+ - `directory-lister` for repository shape
18
+ - `glob-matcher` for file pattern discovery
19
+ - `code-searcher` for exact search evidence
20
+ - `librarian` for source-grounded explanation
21
+
22
+ Return relevant files, line references, tests to run, and what remains unknown. Do not edit files.
@@ -0,0 +1,22 @@
1
+ ---
2
+ description: Check test integrity for reward-hacking and vacuous pass patterns
3
+ category: quality
4
+ aliases:
5
+ - test-integrity
6
+ ---
7
+
8
+ Check test integrity for:
9
+
10
+ $ARGUMENTS
11
+
12
+ Process:
13
+
14
+ 1. Run `ghost_test_scan`.
15
+ 2. Inspect any suspicious files before drawing conclusions.
16
+ 3. If the user asks for a canary test, explain the exact temporary test file and command first; do not leave the canary file behind.
17
+ 4. Classify verdict:
18
+ - CLEAN: no static reward-hack patterns found
19
+ - SUSPICIOUS: static patterns found, needs inspection
20
+ - COMPROMISED: a canary that must fail unexpectedly passes
21
+
22
+ Report exact file:line findings and the verification commands used.
@@ -0,0 +1,26 @@
1
+ ---
2
+ description: Manage durable Pi-native task goals in .pi/memory/goals.md
3
+ category: context
4
+ aliases:
5
+ - goals
6
+ ---
7
+
8
+ Manage goals for this session:
9
+
10
+ $ARGUMENTS
11
+
12
+ Use `goal_state`:
13
+
14
+ - list goals when no clear action is supplied
15
+ - set a goal when the user gives a new objective
16
+ - complete a goal only when verification is done
17
+ - block a goal only when the blocker is concrete and repeated
18
+
19
+ Goal records must include:
20
+
21
+ 1. objective
22
+ 2. current status
23
+ 3. evidence or verification
24
+ 4. next action
25
+
26
+ Do not mark a goal complete just because work paused.
@@ -0,0 +1,42 @@
1
+ ---
2
+ description: Plan or run safe parallel agent work with ownership checks
3
+ category: workflow
4
+ aliases:
5
+ - wave
6
+ ---
7
+
8
+ Prepare parallel execution for:
9
+
10
+ $ARGUMENTS
11
+
12
+ Use parallel execution only when milestones are independent.
13
+
14
+ Process:
15
+
16
+ 1. Identify candidate milestones and likely files for each.
17
+ 2. Use `problem-architect` or `code-searcher` if file ownership is unclear.
18
+ 3. Run `parallel_safety_check` with milestone ids, files, dependencies, and statuses.
19
+ 4. If conflicts exist, return the sequential order instead of forcing parallelism.
20
+ 5. If safe, use `spawn_agents` with `mode: "parallel"` and project role agents.
21
+ 6. Do not commit, merge, push, delete branches, or create worktrees unless the user explicitly asks.
22
+
23
+ Output:
24
+
25
+ ```text
26
+ Parallel verdict: PARALLEL_SAFE | SEQUENTIAL_REQUIRED
27
+
28
+ Milestones:
29
+ - id - title - files - validation
30
+
31
+ Conflicts:
32
+ -
33
+
34
+ Dispatch plan:
35
+ - Wave 1:
36
+ - Wave 2:
37
+
38
+ Merge/validation gate:
39
+ - {commands or review steps}
40
+ ```
41
+
42
+ Never say parallel work is safe without a file-ownership and dependency check.
@@ -0,0 +1,31 @@
1
+ ---
2
+ description: Create a team-oriented implementation plan using Pi-native agents
3
+ category: planning
4
+ aliases:
5
+ - plan-team
6
+ - team-plan
7
+ ---
8
+
9
+ Create a planning-only implementation blueprint for:
10
+
11
+ $ARGUMENTS
12
+
13
+ Use the Pi-native team model:
14
+
15
+ - Available specialist roles live in `agents/*.md`.
16
+ - Team sets live in `agents/teams.yaml`.
17
+ - Sequential workflows live in `agents/agent-chain.yaml`.
18
+ - The dispatcher can use `dispatch_agent`.
19
+ - The chain runner can use `run_chain`.
20
+
21
+ Plan format:
22
+
23
+ 1. Task type and complexity.
24
+ 2. Relevant files and source-truth checks.
25
+ 3. Recommended team or chain.
26
+ 4. Step-by-step tasks with dependencies.
27
+ 5. Agent assignment per task.
28
+ 6. Verification commands.
29
+ 7. Risks and fallback plan.
30
+
31
+ Planning only. Do not implement until the plan is accepted.
@@ -0,0 +1,17 @@
1
+ ---
2
+ description: Load project orientation before work
3
+ category: workflow
4
+ aliases:
5
+ - orient
6
+ ---
7
+
8
+ Orient yourself in this repository before making changes.
9
+
10
+ 1. Inspect the project file tree.
11
+ 2. Read the main project instruction files if present: `AGENTS.md`, `README.md`, `.pi/settings.json`.
12
+ 3. Identify the package manager, test commands, and main source directories.
13
+ 4. Summarize the purpose, stack, entry points, and any safety rules before implementation.
14
+
15
+ User request:
16
+
17
+ $ARGUMENTS
@@ -0,0 +1,23 @@
1
+ ---
2
+ description: Review code or changes for bugs and missing tests
3
+ name: code-review
4
+ category: quality
5
+ aliases:
6
+ - rv
7
+ ---
8
+
9
+ Review the target code or current changes.
10
+
11
+ Focus on:
12
+
13
+ 1. Bugs and behavioral regressions.
14
+ 2. Security or data-loss risks.
15
+ 3. Missing tests.
16
+ 4. API or workflow contract breaks.
17
+ 5. Unnecessary complexity.
18
+
19
+ Lead with findings ordered by severity and include file/line references when available.
20
+
21
+ Scope:
22
+
23
+ $ARGUMENTS
@@ -0,0 +1,29 @@
1
+ ---
2
+ description: Read-only security and environment safety scan
3
+ category: security
4
+ aliases:
5
+ - security-scan
6
+ ---
7
+
8
+ Run a read-only safety scan for:
9
+
10
+ $ARGUMENTS
11
+
12
+ Process:
13
+
14
+ 1. Run `secret_scan`.
15
+ 2. Run `dependency_inventory`.
16
+ 3. Run `ghost_test_scan` if test trust matters.
17
+ 4. Use `code_search_batch` for high-risk patterns:
18
+ - `eval(`
19
+ - `child_process.exec`
20
+ - `shell=True`
21
+ - `dangerouslySetInnerHTML`
22
+ - `pickle.load`
23
+ - `yaml.load`
24
+ - `ignore previous instructions`
25
+ 5. Use `spawn_agents` with `security-auditor` for a full read-only review when available.
26
+
27
+ Never print full secret values. Redact findings.
28
+
29
+ Return score, blocking findings, high/medium/low findings, and required fixes before ship.
@@ -0,0 +1,30 @@
1
+ ---
2
+ description: Pre-ship gate for tests, security, dependency risk, and git readiness
3
+ category: quality
4
+ aliases:
5
+ - preflight
6
+ ---
7
+
8
+ Run a pre-ship gate for:
9
+
10
+ $ARGUMENTS
11
+
12
+ Do not commit or push unless the user explicitly asks for that exact action.
13
+
14
+ Gate:
15
+
16
+ 1. Run `env_scan`.
17
+ 2. Run `secret_scan`; blocking findings stop ship.
18
+ 3. Run `ghost_test_scan`; suspicious findings require inspection.
19
+ 4. Run `dependency_inventory`; missing lockfiles or loose pins become risk notes.
20
+ 5. Inspect `git status --short` and `git diff --stat`.
21
+ 6. Run the smallest relevant test/build/typecheck commands from project scripts.
22
+ 7. Use `spawn_agents` with `problem-architect` for risk scan and `reviewer` for diff review when useful.
23
+
24
+ Output:
25
+
26
+ - Ship verdict: GO | BLOCKED | RISK ACCEPTANCE NEEDED
27
+ - Changed files
28
+ - Commands run and exact outcomes
29
+ - Blocking issues
30
+ - Commit message suggestion if GO
@@ -0,0 +1,26 @@
1
+ ---
2
+ description: Write a mid-session checkpoint to survive context compaction
3
+ category: context
4
+ aliases:
5
+ - checkpoint
6
+ ---
7
+
8
+ Write a Pi-native session snapshot.
9
+
10
+ Topic:
11
+
12
+ $ARGUMENTS
13
+
14
+ Process:
15
+
16
+ 1. Use `session_state` to read current goals and latest checkpoint.
17
+ 2. Summarize only durable context needed to continue.
18
+ 3. Use `write_snapshot` with:
19
+ - current task
20
+ - decisions
21
+ - known context
22
+ - next actions
23
+ - risks
24
+ 4. Print the checkpoint path and content.
25
+
26
+ Do not solve new work during snapshotting.
@@ -0,0 +1,58 @@
1
+ ---
2
+ description: Write a structured feature spec before planning or coding
3
+ category: planning
4
+ aliases:
5
+ - requirements
6
+ ---
7
+
8
+ Write a structured spec for:
9
+
10
+ $ARGUMENTS
11
+
12
+ Use source-grounded context only where helpful:
13
+
14
+ 1. Run `env_scan` for stack context if this is a codebase task.
15
+ 2. Use `code_search_batch` to find related existing behavior.
16
+ 3. If requirements are vague, switch to `/clarify` behavior first.
17
+ 4. Use `spawn_agents` with `spec-reviewer` for the final gate when available.
18
+
19
+ Spec format:
20
+
21
+ ```markdown
22
+ # Spec: {feature title}
23
+ status: draft | ready-for-plan
24
+
25
+ ## Goal
26
+ {who uses this, what problem it solves, and why now}
27
+
28
+ ## User Stories
29
+ - As a {user}, I want {action} so that {outcome}
30
+
31
+ ## Acceptance Criteria
32
+ 1. Given {precondition}, when {action}, then {expected outcome}
33
+ 2. Given {precondition}, when {action}, then {expected outcome}
34
+ 3. Given {precondition}, when {action}, then {expected outcome}
35
+
36
+ ## Data Model Changes
37
+ {changes or "none"}
38
+
39
+ ## API / Interface Changes
40
+ {changes or "none"}
41
+
42
+ ## Out of Scope
43
+ - {explicit exclusion}
44
+
45
+ ## Failure Modes
46
+ | Scenario | Expected behavior |
47
+ | --- | --- |
48
+
49
+ ## Constraints
50
+ - Security:
51
+ - Performance:
52
+ - Compatibility:
53
+
54
+ ## Open Questions
55
+ - [ ] {question or "none"}
56
+ ```
57
+
58
+ Do not write implementation code.
@@ -0,0 +1,13 @@
1
+ ---
2
+ description: Run or design focused verification for a change
3
+ category: quality
4
+ aliases:
5
+ - verify
6
+ ---
7
+
8
+ Verify this change or behavior:
9
+
10
+ $ARGUMENTS
11
+
12
+ Find the smallest meaningful test path first, then expand only if the blast radius requires it.
13
+ Report exact commands, outcomes, and remaining unverified risk.
@@ -0,0 +1,19 @@
1
+ ---
2
+ description: Select and run targeted validation for current work
3
+ category: quality
4
+ aliases:
5
+ - check
6
+ ---
7
+
8
+ Validate the current work or this scope:
9
+
10
+ $ARGUMENTS
11
+
12
+ Process:
13
+
14
+ 1. Identify the smallest useful validation commands.
15
+ 2. Use `spawn_agents` with `tester` or `basher` for isolated validation when helpful.
16
+ 3. Use `reviewer` after validation if code changed.
17
+ 4. Report exact commands, outcomes, important output lines, and remaining risk.
18
+
19
+ Do not edit files unless I explicitly ask for fixes.
@@ -0,0 +1,114 @@
1
+ ---
2
+ name: bowser
3
+ description: Headless browser automation using Playwright CLI. Use when you need headless browsing, parallel browser sessions, UI testing, screenshots, web scraping, or browser automation that can run in the background. Keywords - playwright, headless, browser, test, screenshot, scrape, parallel.
4
+ allowed-tools: Bash
5
+ ---
6
+
7
+ # Playwright Bowser
8
+
9
+ ## Purpose
10
+
11
+ Automate browsers using `playwright-cli` — a token-efficient CLI for Playwright. Runs headless by default, supports parallel sessions via named sessions (`-s=`), and doesn't load tool schemas into context.
12
+
13
+ ## Key Details
14
+
15
+ - **Headless by default** — pass `--headed` to `open` to see the browser
16
+ - **Parallel sessions** — use `-s=<name>` to run multiple independent browser instances
17
+ - **Persistent profiles** — cookies and storage state preserved between calls
18
+ - **Token-efficient** — CLI-based, no accessibility trees or tool schemas in context
19
+ - **Vision mode** (opt-in) — set `PLAYWRIGHT_MCP_CAPS=vision` to receive screenshots as image responses in context instead of just saving to disk
20
+
21
+ ## Sessions
22
+
23
+ **Always use a named session.** Derive a short, descriptive kebab-case name from the user's prompt. This gives each task a persistent browser profile (cookies, localStorage, history) that accumulates across calls.
24
+
25
+ ```bash
26
+ # Derive session name from prompt context:
27
+ # "test the checkout flow on mystore.com" → -s=mystore-checkout
28
+ # "scrape pricing from competitor.com" → -s=competitor-pricing
29
+ # "UI test the login page" → -s=login-ui-test
30
+
31
+ playwright-cli -s=mystore-checkout open https://mystore.com --persistent
32
+ playwright-cli -s=mystore-checkout snapshot
33
+ playwright-cli -s=mystore-checkout click e12
34
+ ```
35
+
36
+ Managing sessions:
37
+ ```bash
38
+ playwright-cli list # list all sessions
39
+ playwright-cli close-all # close all sessions
40
+ playwright-cli -s=<name> close # close specific session
41
+ playwright-cli -s=<name> delete-data # wipe session profile
42
+ ```
43
+
44
+ ## Quick Reference
45
+
46
+ ```
47
+ Core: open [url], goto <url>, click <ref>, fill <ref> <text>, type <text>, snapshot, screenshot [ref], close
48
+ Navigate: go-back, go-forward, reload
49
+ Keyboard: press <key>, keydown <key>, keyup <key>
50
+ Mouse: mousemove <x> <y>, mousedown, mouseup, mousewheel <dx> <dy>
51
+ Tabs: tab-list, tab-new [url], tab-close [index], tab-select <index>
52
+ Save: screenshot [ref], pdf, screenshot --filename=f
53
+ Storage: state-save, state-load, cookie-*, localstorage-*, sessionstorage-*
54
+ Network: route <pattern>, route-list, unroute, network
55
+ DevTools: console, run-code <code>, tracing-start/stop, video-start/stop
56
+ Sessions: -s=<name> <cmd>, list, close-all, kill-all
57
+ Config: open --headed, open --browser=chrome, resize <w> <h>
58
+ ```
59
+
60
+ ## Workflow
61
+
62
+ 1. Derive a session name from the user's prompt and open with `--persistent` to preserve cookies/state. Always set the viewport via env var at launch:
63
+ ```bash
64
+ PLAYWRIGHT_MCP_VIEWPORT_SIZE=1440x900 playwright-cli -s=<session-name> open <url> --persistent
65
+ # or headed:
66
+ PLAYWRIGHT_MCP_VIEWPORT_SIZE=1440x900 playwright-cli -s=<session-name> open <url> --persistent --headed
67
+ # or with vision (screenshots returned as image responses in context):
68
+ PLAYWRIGHT_MCP_VIEWPORT_SIZE=1440x900 PLAYWRIGHT_MCP_CAPS=vision playwright-cli -s=<session-name> open <url> --persistent
69
+ ```
70
+
71
+ 3. Get element references via snapshot:
72
+ ```bash
73
+ playwright-cli snapshot
74
+ ```
75
+
76
+ 4. Interact using refs from snapshot:
77
+ ```bash
78
+ playwright-cli click <ref>
79
+ playwright-cli fill <ref> "text"
80
+ playwright-cli type "text"
81
+ playwright-cli press Enter
82
+ ```
83
+
84
+ 5. Capture results:
85
+ ```bash
86
+ playwright-cli screenshot
87
+ playwright-cli screenshot --filename=output.png
88
+ ```
89
+
90
+ 6. **Always close the session when done.** This is not optional — close the named session after finishing your task:
91
+ ```bash
92
+ playwright-cli -s=<session-name> close
93
+ ```
94
+
95
+ ## Configuration
96
+
97
+ If a `playwright-cli.json` exists in the working directory, use it automatically. If the user provides a path to a config file, use `--config path/to/config.json`. Otherwise, skip configuration — the env var and CLI defaults are sufficient.
98
+
99
+ ```json
100
+ {
101
+ "browser": {
102
+ "browserName": "chromium",
103
+ "launchOptions": { "headless": true },
104
+ "contextOptions": { "viewport": { "width": 1440, "height": 900 } }
105
+ },
106
+ "outputDir": "./screenshots"
107
+ }
108
+ ```
109
+
110
+ ## Full Help
111
+
112
+ Run `playwright-cli --help` or `playwright-cli --help <command>` for detailed command usage.
113
+
114
+ See [docs/playwright-cli.md](docs/playwright-cli.md) for full documentation.