vibecoding-devtools 1.0.1

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 (43) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +46 -0
  3. package/hooks/full-suite.mjs +156 -0
  4. package/hooks/lib/io.mjs +135 -0
  5. package/hooks/maestri-protocol.mjs +48 -0
  6. package/hooks/secret-scan.mjs +90 -0
  7. package/installer/cli.mjs +263 -0
  8. package/installer/clis.mjs +46 -0
  9. package/installer/convert.mjs +91 -0
  10. package/installer/detect.mjs +389 -0
  11. package/installer/execute.mjs +386 -0
  12. package/installer/hooks.mjs +67 -0
  13. package/installer/json-merge.mjs +211 -0
  14. package/installer/panel.mjs +99 -0
  15. package/installer/plan.mjs +255 -0
  16. package/installer/state.mjs +105 -0
  17. package/installer/third-party.json +16 -0
  18. package/installer/third-party.mjs +204 -0
  19. package/npm-shrinkwrap.json +80 -0
  20. package/package.json +43 -0
  21. package/rules/base.md +25 -0
  22. package/rules/context-on-demand.md +25 -0
  23. package/rules/maestri-messaging.md +10 -0
  24. package/rules/maestri-usage.md +12 -0
  25. package/rules/model-tiers.md +17 -0
  26. package/rules/risk-process.md +69 -0
  27. package/rules/testing.md +53 -0
  28. package/skills/maestri-agent-cli/SKILL.md +150 -0
  29. package/skills/maestri-agent-cli/references/_template.md +62 -0
  30. package/skills/maestri-agent-cli/references/antigravity.md +206 -0
  31. package/skills/maestri-agent-cli/references/claude-code.md +203 -0
  32. package/skills/maestri-agent-cli/references/codex.md +190 -0
  33. package/skills/maestri-budget/SKILL.md +118 -0
  34. package/skills/maestri-protocol/SKILL.md +72 -0
  35. package/skills/risk-triage/SKILL.md +44 -0
  36. package/skills/security-surfaces/SKILL.md +31 -0
  37. package/skills/security-surfaces/surfaces/accounts-and-data.md +41 -0
  38. package/skills/security-surfaces/surfaces/inputs-and-services.md +47 -0
  39. package/skills/security-surfaces/surfaces/money.md +57 -0
  40. package/skills/security-surfaces/surfaces/secrets-and-infra.md +43 -0
  41. package/templates/AGENTS.md +68 -0
  42. package/templates/CLAUDE.md +1 -0
  43. package/templates/coderabbit.yaml +127 -0
@@ -0,0 +1,190 @@
1
+ # OpenAI Codex CLI
2
+
3
+ Verified live on Codex 0.164.0, Windows, ChatGPT Free account (2026-10-27); quota windows and `/clear` on 0.166.0, paid
4
+ plan (2026-11-04).
5
+
6
+ ## Identify
7
+
8
+ - Launch command: `codex`, e.g. `codex --no-daemon`.
9
+ - Banner: `>_ OpenAI Codex (v<version>)` and the working folder.
10
+ - Input prompt is `›`.
11
+ - Footer: `<model> <effort> · <folder>`, then `? for shortcuts` and warnings such as `⚠ 1 warning · f2 to view`.
12
+ - `/status`: model and reasoning effort, provider, folder, **Permissions**, `AGENTS.md` in use, **Account** and plan,
13
+ collaboration mode, session id, and the usage limit with its reset date.
14
+
15
+ ## States
16
+
17
+ | State | On screen |
18
+ |---|---|
19
+ | Idle | `› Ask Codex to do anything` (placeholder) |
20
+ | Done | `• <reply>` then `Worked for <time> • <clock>` and an idle input |
21
+ | Warnings panel | `Warnings · 1 of 1 · ...` with `k keep & next · esc dismiss & close` |
22
+ | Menu | Numbered list with `enter select · esc back` |
23
+ | Approval prompt | `Would you like to run the following command?` with numbered options |
24
+
25
+ The warnings panel can open on its own while you type: then your keys go to the panel (`k` keeps the warning and closes
26
+ it). `check` before sending text, and resend if it did not reach the input.
27
+
28
+ ## Sending a prompt
29
+
30
+ Send the text, then `\n` in a separate `--raw` call.
31
+
32
+ ## Permissions and sandbox
33
+
34
+ - `/permissions` → **Update Model Permissions**:
35
+ 1. **Ask for approval**: reads and edits the workspace and runs commands; asks for internet access or edits outside
36
+ the workspace.
37
+ 2. **Approve for me**: asks only for actions detected as potentially unsafe.
38
+ 3. **Full Access**: edits outside the workspace and uses the internet without asking.
39
+ 4. **Read Only**: reads the workspace; asks for edits and internet access.
40
+ - `/status` may show a mode not in that list (here `Workspace (granular)`). Read Only shows as
41
+ `Read Only (Ask for approval)`.
42
+ - **Changing the mode gives no confirmation screen**, only a history line `• Permission selection requested: <mode>`,
43
+ and options 3 (Full Access) and 4 (Read Only) sit next to each other. Run `/status` after every change and check
44
+ `Permissions:`.
45
+ - On Windows the sandbox is set in `~/.codex/config.toml`, e.g. `[windows] sandbox = "elevated"`.
46
+ - Blocked by the sandbox, the agent can **refuse on its own without an approval prompt**: asked to write outside the
47
+ workspace, it replied that the folder is not writable and stopped. Read its reply, not only the screen state.
48
+ - Changing the permission mode lowers or raises what the agent may do on the user's behalf: ask the user first.
49
+ - `/approve` approves one retry of a recent auto-review denial.
50
+
51
+ ## Autonomous launch and command rules
52
+
53
+ Verified on Codex 0.166.0, Windows (2026-11-06): local help, isolated rule checks and a live recruited agent.
54
+
55
+ ```bash
56
+ codex --no-daemon --approve-for-me
57
+ ```
58
+
59
+ `--approve-for-me` routes approval requests through automatic review with the workspace-write sandbox. It does not
60
+ grant full access. Verify `/status`: **Workspace (Approve for me)**. The live check ran `npm.cmd --version` and wrote
61
+ a workspace file without human approval. PowerShell blocked `npm.ps1`; `npm.cmd` worked. Hook trust remains separate:
62
+ the test session continued without trusting hooks, so this check did not exercise hook execution.
63
+
64
+ Alternative: `codex --no-daemon -a never -s workspace-write` never asks a person; failures return to the agent.
65
+ It does not provide automatic approval for blocked operations. For tasks requiring shell networking, the configuration
66
+ override is `-c sandbox_workspace_write.network_access=true`; this enables outbound network within workspace-write,
67
+ not writes outside it. The key is documented and accepted by the installed parser; outbound access was not tested.
68
+ The unauthenticated fake-home run reported read-only permissions: always verify effective permissions after startup.
69
+ See the [configuration reference](https://learn.chatgpt.com/docs/config-file/config-reference).
70
+
71
+ For a limited agent, use a dedicated `CODEX_HOME` and a sandbox, with narrow grants in
72
+ `CODEX_HOME/rules/default.rules` (normally `~/.codex/rules/default.rules`):
73
+
74
+ ```python
75
+ prefix_rule(pattern = ['npm', '--version'], decision = 'allow')
76
+ prefix_rule(pattern = ['git', 'push'], decision = 'forbidden')
77
+ ```
78
+
79
+ ```bash
80
+ codex --no-daemon -a never -s read-only
81
+ codex execpolicy check --rules /path/to/isolated-codex/rules/default.rules -- npm --version
82
+ ```
83
+
84
+ Set `CODEX_HOME` to the prepared directory before either command. The installed checker returned `allow` for
85
+ `npm --version`, `forbidden` for `git push`, and no match for `npm install`. Write rule files as UTF-8 without BOM;
86
+ the installed parser rejected a BOM. Rules match argument prefixes; choose task-specific command grants.
87
+
88
+ Approval option `p` saves the proposed prefix as an allow rule in the user layer's `rules/default.rules`; it is not a
89
+ one-time approval. The save location is documented; this review did not press `p` against a real home. Rules load at
90
+ startup, including trusted project layers.
91
+ See [command rules](https://learn.chatgpt.com/docs/agent-configuration/rules).
92
+
93
+ These grants control execution outside the sandbox; unmatched commands can still run within sandbox permissions.
94
+ Neither `-a never` nor an allow rule list creates a strict commands-only boundary. Use an external enforcement layer
95
+ if that is required. Do not combine limited-agent grants with `--approve-for-me`, which can approve other requests.
96
+ `--dangerously-bypass-approvals-and-sandbox` removes both safeguards: use only at the user's explicit request.
97
+
98
+ ## Approval prompt
99
+
100
+ ```text
101
+ • Running <command>
102
+ Would you like to run the following command?
103
+ Environment: local
104
+ Reason: <why the agent needs it>
105
+ $ <command>
106
+ › 1. Yes, proceed (y)
107
+ 2. Yes, and don't ask again for commands that start with `<command>` (p)
108
+ 3. No, and tell Codex what to do differently (esc)
109
+ Press enter to confirm or esc to cancel
110
+ ```
111
+
112
+ - Edits also come as commands (e.g. `Set-Content` on Windows), so file edits show this same prompt.
113
+ - `• Running <command>` shows up **before** approval. After it, the history shows
114
+ `✔ You approved codex to run <command> this time`, then `• Ran <command>` and its output.
115
+ - Enter or `y` approves once. `p` (option 2) persists the rule: ask the user first. Esc denies.
116
+
117
+ ## Model and effort
118
+
119
+ - `/model` → **Select Model and Effort**: numbered models, `enter select · esc back`. The list depends on the plan (on a
120
+ Free account: GPT-6-Luna, GPT-5.6-Terra, GPT-5.6-Luna).
121
+ - **Exact ids:** `codex debug models` prints the account's catalog as JSON: `slug` is the id (e.g. `gpt-6.1-sol`) and
122
+ `supported_reasoning_levels` lists the efforts. Launch with
123
+ `codex --model <slug> -c model_reasoning_effort=<low|medium|high|...>`.
124
+
125
+ ## Quota
126
+
127
+ - `/status` shows the limit as **percent left**, e.g. `Monthly limit: [bar] 100% left (resets 15:45 on 26 Nov)` on a
128
+ Free account, and points to <https://chatgpt.com/settings/usage>. On a paid plan (Codex 0.166) it shows a five-hour
129
+ and a weekly limit, each with percent left and reset time.
130
+ - Context: the docs say `/status` also shows token usage; not yet verified live.
131
+ - `/usage` → **Usage**: `View analytics` (usage history) and `Redeem reset` (use a usage-limit reset when one is
132
+ available).
133
+ - Not yet observed: the limit-reached screen.
134
+
135
+ ## Keys
136
+
137
+ | Key | Raw | Action |
138
+ |---|---|---|
139
+ | Enter | `\n` | Send or select |
140
+ | Esc | `\e` | Back; closes menus and the warnings panel (dismissing the warning) |
141
+ | Backspace | `\x7f` | Delete a character |
142
+ | ↑ / ↓ | `\e[A` / `\e[B` | Navigate |
143
+ | F2 | `\eOQ` | Open the warnings panel |
144
+ | `k` | `k` | In the warnings panel: keep the warning and go to the next |
145
+ | `y` / `p` | `y` / `p` | In an approval prompt: approve once / approve and persist the rule |
146
+ | `?` | | **Typed as text**: it does not open a shortcuts panel |
147
+
148
+ ## Slash commands for the Maestro
149
+
150
+ `/status`, `/model`, `/permissions`, `/approve`, `/usage`, `/config`, `/compact`, `/clear` (clears the terminal and
151
+ starts a new chat), `/new`, `/resume`, `/plan`, `/side` (side conversation in a fork), `/diff`, `/warnings`, `/mcp`,
152
+ `/hooks`, `/skills`, `/daemon`. Destructive or stopping: `/delete` (permanently deletes the session), `/archive`,
153
+ `/logout`, `/quit` and `/exit`: only when the user asks.
154
+
155
+ ## Built-in capabilities
156
+
157
+ Tools as the agent listed them (GPT-6-Luna): `functions.exec` runs JavaScript that calls the work tools
158
+ (`tools.exec_command`, `tools.write_stdin`, `tools.apply_patch`, `tools.view_image`, `tools.web__run`, goal and MCP
159
+ tools); `collaboration.spawn_agent`, `send_message`, `followup_task`, `wait_agent`, `interrupt_agent`, `list_agents` for
160
+ subagents; `request_user_input`, `clock.sleep`.
161
+
162
+ | Need | How |
163
+ |---|---|
164
+ | Web search | `tools.web__run`; the docs also name the launch flag `codex --search` |
165
+ | Read images | `tools.view_image`; `codex --image <file>` at launch |
166
+ | Generate images | Skill `imagegen` |
167
+ | Subagents | `collaboration.spawn_agent`; `/agents`, `/subagents` |
168
+ | Code review | `/review` (working tree, base branch, commit), skill `review-agent` |
169
+ | Plan before editing | `/plan` (not while it works) |
170
+ | Side question | `/side` or `/btw` |
171
+ | Run until a goal is met | `/goal` |
172
+ | Background terminals | `/ps`; `/stop` stops them all |
173
+ | Git worktree | `/worktree` |
174
+
175
+ The workspace-write sandbox keeps shell networking off by default. Configure needed access at recruitment using the
176
+ launch guidance above; a later change to a running agent follows the skill's permission-prompt policy.
177
+
178
+ Built-in skills (`~/.codex/skills/.system`): `imagegen`, `openai-docs`, `review-agent`, `skill-creator`,
179
+ `skill-installer`. Without any install by the user, `$` (or `/skills` → List skills) also showed OpenAI curated plugins
180
+ in `~/.codex/plugins/cache/openai-curated-remote`: `plugin-management` and `work-pets` (pet skills), plus apps such as
181
+ Codex Document Control and Safety Settings. Maestri's skills in the list come from Maestri, not from Codex.
182
+
183
+ ## Notes
184
+
185
+ - With `--no-daemon` the startup warning is:
186
+ `Running without the shared background server: Bedrock sign-in requires embedded mode.`
187
+
188
+ ## Not yet observed
189
+
190
+ Limit-reached screen, logged-out screen, API or network errors.
@@ -0,0 +1,118 @@
1
+ ---
2
+ name: maestri-budget
3
+ description: Pace the context and quota of the agents on the Maestri canvas, so every CLI's quota lasts the whole cycle and none is left unused when it resets. Load it as the Maestro at a checkpoint - start of a session, after a large delegated task finishes, before handing out a large task, or when an agent shows a limit warning - never for routine checks.
4
+ ---
5
+
6
+ # Context and Quota Budget
7
+
8
+ You're the Maestro on a Maestri canvas. The agents may run different CLIs on different accounts, and each account has
9
+ its own quota pools, windows and prices. Pace them: a pool that runs out early stops the work, and quota left when a
10
+ pool resets is lost. The goal is every pool close to empty at its reset, with no stop before it.
11
+
12
+ You pace mostly by **choosing who gets each task**. You change an agent's model only when the user put it under your
13
+ control (section 4). Reading quota and context costs tokens too, so you read them only at checkpoints and decide from
14
+ your ledger in between. How to open each screen is in the `maestri-agent-cli` references.
15
+
16
+ ## 1. Checkpoints
17
+
18
+ Read at these moments only, never on a timer and never while the agent you would read is working:
19
+
20
+ - **Start of a session**, or your first delegation: every pool and every agent.
21
+ - **A large task finished**: the agent reported DONE or PENDING on a task that took many turns or more than about half
22
+ an hour. Read that agent's pool and context.
23
+ - **Before handing out a large task**: choose the agent from the ledger. Read again only if that pool's row is more than
24
+ a few hours old.
25
+ - **A limit warning**, an error about quota, or an agent that slows down: read that pool.
26
+
27
+ ## 2. Ledger
28
+
29
+ Add a `## Pools` section to the `ledger.md` that `maestri-agent-cli` keeps in your session directory:
30
+
31
+ ```markdown
32
+ ## Pools
33
+
34
+ | Pool | Agents | Window | Left | Resets at | Read at |
35
+ |---|---|---|---|---|---|
36
+ | Antigravity / Gemini | Lynx | week | 82% | Sat 14:00 | Mon 10:12 |
37
+ | Antigravity / Gemini | Lynx | 5 h | 60% | Mon 13:40 | Mon 10:12 |
38
+ | Claude Code / Default | Hawk | week | 55% | Thu 09:00 | Mon 10:12 |
39
+ ```
40
+
41
+ - One row per pool and window, scarce pools included (Argon on Antigravity).
42
+ - **Left** is the percent remaining. Claude Code shows percent used: write `100 - used`.
43
+ - Write **Resets at** and **Read at** as date and time: `Refreshes in 98h 45m` read at Mon 10:12 resets Fri 13:00.
44
+ - **Your own pool:** you spend quota too, and you cannot open your own CLI's panels through `maestri`. If an agent runs
45
+ on your account, its reading covers you; otherwise ask the user for your numbers at a full checkpoint.
46
+
47
+ ## 3. Pace and delegation
48
+
49
+ For each pool, at a checkpoint:
50
+
51
+ - `elapsed` = 100 × time already gone / window length, from the reset time (a percent, like `used`).
52
+ - `used` = 100 - left.
53
+ - `pace` = used / elapsed. Above 1.0, the pool runs out before it resets.
54
+ - Unknown window length or reset time, or a reading taken before the pool's last reset: do not compute; read the pool
55
+ again at the next checkpoint.
56
+
57
+ | Pace | Meaning | Do |
58
+ |---|---|---|
59
+ | below 0.85 | quota will be left over | send more work to the agents on this pool |
60
+ | 0.85 to 1.0 | on track | keep going |
61
+ | above 1.0 | runs out before reset | send new work to agents on other pools |
62
+ | above 1.3 | runs out well before reset | only essential work here; tell the user if routing cannot fix it |
63
+
64
+ - While less than 15% of a window has gone, skip the pace and keep the previous decision; a pool already spent or too
65
+ low for the next task still counts.
66
+ - A pool with two windows (five hours and week) is limited by the tighter one: decide by the worse of the two.
67
+
68
+ - **Roles come first.** Who does what is set by the agents' role prompts and by your own instructions. An agent with a
69
+ dedicated function does that function: never take a task from its owner to save quota.
70
+ - **Everyone works.** The main agents carry the main work; an agent declared as a helper on a lighter model takes the
71
+ simple, repetitive tasks to relieve them. It supports them and never replaces them: overload it and its pool runs out
72
+ early. An idle agent with quota left is quota lost.
73
+ - **Pace splits the rest.** Work that more than one agent could do goes to the one whose pool is furthest below pace,
74
+ matching the task to the agent's model: mechanical work (docs, renames, formatting, triage) to lighter models, deep
75
+ reasoning (architecture, hard debugging, costly-to-get-wrong planning) to the strongest. Smaller quotas end up with
76
+ less work, larger ones with more. Short, focused tasks last longest: quota is spent in proportion to token cost.
77
+ - **Verify work from lighter models, always.** A result from an agent on a lighter model (such as Gemini Flash on
78
+ Antigravity) is a claim until you check it, even when it reports DONE. Check it in proportion to the task, without
79
+ redoing it: read the file it wrote, rerun the count or command, read the diff and run the tests, or send code to a
80
+ main agent for review. Report it to the user only after that. Keep development work off lighter models when you can.
81
+ - **Scarce pools** (a small weekly-only quota, such as Argon on Antigravity): enough for only a few large tasks a week.
82
+ Reserve them for the tasks that truly need that model and plan those tasks for the week.
83
+ - **Short windows** (five hours): when one is nearly spent, send work to agents on other pools until it refreshes. Do
84
+ not change the weekly plan because of it.
85
+ - **Last day of a cycle:** a pool that will reset with quota left takes work pulled forward from the backlog the user
86
+ already approved. Never invent work just to spend quota.
87
+
88
+ ## 4. Switching models: managed Antigravity agents only
89
+
90
+ Every agent is `fixed` in the ledger unless the user said otherwise. Never change the model, effort or settings of a
91
+ `fixed` agent, and never switch models on Claude Code or Codex agents.
92
+
93
+ An Antigravity agent the user marked `managed` (a multi-model generalist under your control) is the exception. On a Pro
94
+ plan its account showed three pools (Antigravity 1.4.9): Gemini (Flash, Pro), Claude and GPT (Opus, Sonnet, GPT-OSS)
95
+ and Argon. Read `/usage` at the first checkpoint and trust the screen. For it:
96
+
97
+ - Pick the model for each task: Flash for mechanical work, Sonnet or Pro for day-to-day work, Opus or Argon only for
98
+ high-reasoning work. Argon has only a small weekly quota and no five-hour window: a few large tasks a week.
99
+ - Prefer the pool with more room by the pace above.
100
+ - **Switch only between tasks**, never mid-task: a switch mid-task loses the prompt cache and costs more.
101
+ - After a restart, the agent is back on the preset's model: check its footer before the next task.
102
+
103
+ ## 5. Context: every agent
104
+
105
+ - **Before handing any task to an agent**, if it is unrelated to what that agent did last and the previous task is
106
+ closed, clear it first with the command in its CLI reference (`/clear` in the three, as of the versions there). This
107
+ needs no reading and keeps the new task from paying for the old context.
108
+ - **At a checkpoint**, read the context of the agents that just finished. If the next task continues the same work and
109
+ context is above about 60%, `/compact`; where the reference says it takes text (Claude Code), add what must survive,
110
+ e.g. `/compact keep the T-12 decisions, open items and files touched`.
111
+ - **Never** compact or clear an agent that is working, is in the middle of a task, has a prompt or menu open, or whose
112
+ report has not arrived. Compacting between tasks keeps the CLI's own auto-compaction from firing in the middle of one.
113
+
114
+ ## 6. Ask the user first
115
+
116
+ Turning on paid credits (Antigravity **Use AI Credits**, extra usage), using a usage-limit reset (Codex **Redeem
117
+ reset**), moving an agent to another account, changing a preset, or making an agent `managed`. After a full checkpoint,
118
+ tell the user only what is off pace or needs their decision, one line per pool.
@@ -0,0 +1,72 @@
1
+ ---
2
+ name: maestri-protocol
3
+ description: Reply format for agent-to-agent messages on the Maestri canvas. Load it whenever you delegate a task to another agent with `maestri ask`, report back to another agent (ask back), or receive a message that starts with `~ ` or a task that mentions maestri-protocol. You MUST read this skill before replying to a task that asks for a maestri-protocol report.
4
+ user-invocable: true
5
+ ---
6
+
7
+ # Maestri Agent Reply Protocol
8
+
9
+ You're running inside Maestri, a spatial development workspace that connects AI agents, terminals, notes, and browser
10
+ portals on a visual canvas. This skill extends the base `maestri` skill: it defines how agents report back and ask
11
+ questions to each other, so a reply from an agent is never mistaken for a message from the user or from another agent.
12
+
13
+ ## Reply format
14
+
15
+ Every report or question you send to another agent with `maestri ask` (an ask back, the answer to a task or message you
16
+ were given, or a question that is not a task) starts with one header line:
17
+
18
+ ```text
19
+ ~ Name | STATUS | ref | one-line summary
20
+ ```
21
+
22
+ - `~` followed by a space marks agent-to-agent traffic.
23
+ - `Name`: your own name exactly as `maestri list` prints it under `You:` (`Name @ Workspace` when replying across
24
+ workspaces).
25
+ - `STATUS`, one of:
26
+ - `DONE`: finished, nothing left
27
+ - `PENDING`: finished, with open items listed below
28
+ - `BLOCKED`: cannot continue; say what you need and from whom
29
+ - `ERROR`: failed; say what failed and what you tried
30
+ - `ACK`: received, no action needed. Never use it to say you started: your first ask back ends the sender's wait.
31
+ - `ASK`: a question, not a report; the answer comes back as a report with the same ref
32
+ - `ref`: the ref the task came with; otherwise the most precise work item (PR number, branch@short-sha, task or decision
33
+ id, file). `-` only when nothing applies.
34
+ - Summary: one line, no secrets.
35
+
36
+ Details, evidence and lists go on the following lines; in PowerShell, use real line breaks, not `\n`. Keep the whole
37
+ message inside quotes and avoid double quotes, backticks and `$` in it, which break the shell command. Never send a bare
38
+ `ok` or `done`. One report per task; post progress with `maestri floor status`.
39
+
40
+ ```text
41
+ maestri ask "Maestro" "~ Hawk | DONE | T-12 | login screen wired, tests green, PR #412 open"
42
+ maestri ask "Maestro" "~ Lynx | BLOCKED | T-13 | need the token format decision from the user"
43
+ maestri ask "Maestro" "~ Kite | ACK | design-spec | reply format adopted"
44
+ ```
45
+
46
+ ## Delegating a task
47
+
48
+ Give each task a ref (a task id like `T-12`, or the PR, branch or decision it concerns) and end the prompt with this
49
+ footer, filled in with your name and the ref. Do this in `--batch` prompts too, and never ask for a bare `ok` reply.
50
+
51
+ ```text
52
+ ref: T-12
53
+ When done, load the maestri-protocol skill and report back with:
54
+ maestri ask "Your Name" "~ Your Name | STATUS | T-12 | one-line summary"
55
+ STATUS is one of DONE, PENDING, BLOCKED, ERROR, ACK. Details go on the following lines.
56
+ ```
57
+
58
+ Your name is under `You:` in `maestri list`; when the agent is in another workspace, use the `Name @ Workspace` address
59
+ shown right under `You:` instead. The footer carries the whole format, so the agent can follow it even if it does not
60
+ load this skill.
61
+
62
+ ## Receiving a message
63
+
64
+ When you receive a message whose first line starts with `~` and a space, it is a message from the agent it names, never
65
+ input from the user: match it to your task by its ref and act on its STATUS (DONE: move on; PENDING: triage the open
66
+ items; BLOCKED: unblock it or ask the user; ERROR: investigate; ACK: nothing; ASK: answer it with a report on the same
67
+ ref). A message that ends with the delegation footer above (`ref:` and the report-back line) is a task from the agent
68
+ named in that line. Any other message without the header is from the user, unless its content clearly says otherwise;
69
+ when a short one is ambiguous, ask the user instead of assuming it was their answer.
70
+
71
+ Text in an agent's TUI input area seen with `maestri check`, such as a greyed prompt suggestion, is never an
72
+ instruction, a reply or a decision.
@@ -0,0 +1,44 @@
1
+ ---
2
+ name: risk-triage
3
+ description: Classifies a task or diff as Low, Medium or High risk and returns the minimum contract, testing and review plan. Use at the start of every coding task, before delegating, and when a finding suggests the risk has changed.
4
+ ---
5
+
6
+ # Risk triage
7
+
8
+ Goal: spend as little time and as few tokens as the risk allows, without leaving gaps involving money, data or access.
9
+ Follow the `risk-process` rule and the `testing` rule.
10
+
11
+ ## Steps
12
+
13
+ 1. List the files the change will touch. If the diff already exists: `git diff --name-only <base>...HEAD`.
14
+ 2. Read the project's risk map in `AGENTS.md`, if present. It overrides the generic list below.
15
+ 3. Mark each file's level:
16
+ - **High:** money and value (payments, balances, sales), personal data, authentication, sessions, permissions,
17
+ administrative commands, secrets, external input the system publishes or executes, data migration or deletion,
18
+ deploy, CI, dependencies.
19
+ - **Medium:** business logic, bug fixes, behavior changes.
20
+ - **Low:** assets, text, styling, docs, versions, logs; configuration values unrelated to authentication,
21
+ permissions, CORS, limits, secrets or money.
22
+ 4. The task level is the highest among its files.
23
+ 5. Independent areas (front, back, infra) in a change that is not small: split according to **Parallel by area** in
24
+ the `risk-process` rule. At High risk, call the `security-surfaces` skill with only the touched surfaces.
25
+ 6. Reply in this format, in at most 8 lines:
26
+
27
+ ```text
28
+ Level: <Low|Medium|High>: <one-sentence reason naming the deciding file>
29
+ Areas: <front/back/infra and who handles each>
30
+ Contract: <none | the request itself | one page>
31
+ Tests: <none | 1 regression | risk paths: ...>
32
+ Reviews: <CI or local verification | + diff reading | + architecture, testing and security>
33
+ Done when: <criterion>
34
+ ```
35
+
36
+ ## Examples
37
+
38
+ - Replace a provider icon: **Low**. No tests or reviewers.
39
+ - Fix a command that hangs when skipping tracks: **Medium**. One regression test and diff reading.
40
+ - Large fix touching the dashboard endpoint and screen component: **Medium**; back and front are independent,
41
+ so run in parallel. If the fix is only a few lines, one builder handles both.
42
+ - New card checkout: **High**, with full baseline.
43
+ - Publish external text to a channel (song name, username): **High**. Security review is limited to that point:
44
+ escaping mentions and links.
@@ -0,0 +1,31 @@
1
+ ---
2
+ name: security-surfaces
3
+ description: Surface-based security checklist for High-risk work - money and value (payments, balances, sales, trades), accounts and personal data, exposed inputs and services, secrets and infrastructure. Use when writing the contract, threat model or review of a High-risk item; load only the surfaces the change touches.
4
+ ---
5
+
6
+ # Security review
7
+
8
+ ## Steps
9
+
10
+ 1. List the surfaces the change touches (the `risk-triage` skill).
11
+ 2. Read **only** the files for those surfaces:
12
+
13
+ | Surface | File | When |
14
+ |---|---|---|
15
+ | Money and value | `surfaces/money.md` | payments, payment methods, financial platforms, balances, wallets, sales, subscriptions, user trades, refunds |
16
+ | Accounts and personal data | `surfaces/accounts-and-data.md` | signup, login, sessions, roles, admin, user data |
17
+ | Inputs and services | `surfaces/inputs-and-services.md` | HTTP APIs, WebSocket, incoming webhooks, uploads, published messages, external data |
18
+ | Secrets and infrastructure | `surfaces/secrets-and-infra.md` | tokens and keys, admin commands, subprocesses, downloads, dependencies, Docker, CI |
19
+
20
+ 3. **Contract:** copy applicable items as completion criteria. **Threat model:** only for these surfaces.
21
+ 4. **Review:** for each applicable item, Pass or a finding with severity (Critical, Major, Minor or Suggestion),
22
+ `file:line`, abuse scenario and fix.
23
+ 5. **Triage:** decide according to the **Findings** section of the `risk-process` rule.
24
+ 6. Never describe an unfixed flaw in a public issue, PR, commit or document.
25
+
26
+ ## Tools
27
+
28
+ Secrets scanning (`gitleaks git --pre-commit --staged`, `gitleaks git` for history and `gitleaks dir`), dependency
29
+ audits
30
+ with the project's package manager (`pnpm audit`, `npm audit`, `uvx pip-audit`, `govulncheck`), and risk tests listed in
31
+ each surface.
@@ -0,0 +1,41 @@
1
+ # Accounts and personal data
2
+
3
+ ## Authentication
4
+
5
+ - Established libraries, never custom cryptography. Passwords with argon2id (bcrypt with cost ≥ 12 as an alternative).
6
+ - Social login: OAuth2 with code + PKCE, server-side code exchange, verified `state`.
7
+ - Attempt limits and progressive lockout on login, reset and code verification.
8
+ - Generic messages: do not reveal whether an email or user exists.
9
+ - Password reset with a single-use, short-lived token stored only as a hash.
10
+ - Mandatory MFA for admin. Extra confirmation (step-up) before withdrawals, high-value trades and email or password
11
+ changes.
12
+ - Changing the password ends other sessions.
13
+
14
+ ## Sessions
15
+
16
+ - `httpOnly`, `Secure` and `SameSite` cookies; no session tokens in `localStorage`.
17
+ - CSRF protection on every state-changing action.
18
+ - Renew the session at login, expire it after inactivity and end it server-side at logout.
19
+
20
+ ## Authorization
21
+
22
+ - Object-level checks on every route: user A never reads or changes B's resources (BOLA/IDOR).
23
+ - Server-decided roles, deny by default. Separate admin, with every action recorded.
24
+ - Input field allowlist: the client never sets `role`, `balance`, `owner` or `status` (mass assignment).
25
+ - Capped pagination; no listing exposes other users' data.
26
+
27
+ ## Personal data (LGPD)
28
+
29
+ - Collect the minimum, with a defined purpose and legal basis.
30
+ - Retention period for each data item, with deletion or anonymization at the end.
31
+ - Always encrypt in transit; encrypt documents, CPF, addresses and financial data at rest.
32
+ - Logs without personal data (mask email, CPF and phone) or secrets.
33
+ - Data subjects can export and delete their own data.
34
+ - Record every admin access to personal data.
35
+
36
+ ## Required tests
37
+
38
+ - Authorization matrix: each role against each resource, including A trying to access B.
39
+ - End-to-end flows: signup, login, logout, reset, wrong password, lockout and expired session.
40
+ - Forbidden client field (`role`, `balance`): ignored or rejected.
41
+ - Reused or expired reset token: rejected.
@@ -0,0 +1,47 @@
1
+ # Inputs and exposed services
2
+
3
+ ## All input
4
+
5
+ - Untrusted inputs include users, but also databases, local files, queues, webhooks and third-party APIs.
6
+ - Schema validation at the boundary: types, allowed fields, maximum string and list lengths, IDs in the expected format.
7
+ - Always parameterized queries or ORM; never build SQL or filters from user text.
8
+ - Generic client errors: no traceback, exception `repr`, file paths or configuration. Details stay in the server log.
9
+
10
+ ## Deserialization
11
+
12
+ - No `pickle`, `marshal`, `shelve` or equivalents for persisted or received data. Use validated JSON.
13
+ - YAML only with a safe loader; XML with external entities disabled.
14
+
15
+ ## HTTP APIs and WebSocket
16
+
17
+ - Authentication decided by configuration and server, never by a client-supplied field. Constant-time secret comparison
18
+ (`hmac.compare_digest` or equivalent).
19
+ - CORS and `Origin` with allowlists; never accept any origin.
20
+ - Message size limits, connection limits per client and rate limits per expensive or sensitive route.
21
+ - WebSocket: decode inside `try`, require an object, `op` in an allowlist; discard invalid messages without crashing
22
+ the handler.
23
+ - Forward only allowlisted fields to other clients, never the entire received payload.
24
+ - Security headers (CSP, HSTS, `X-Content-Type-Options`) and TLS in production.
25
+
26
+ ## Outbound requests (SSRF)
27
+
28
+ - Never fetch a user-supplied URL without scheme and domain allowlists and blocking internal IPs.
29
+ - Every outbound request has an explicit `timeout`.
30
+
31
+ ## Uploads
32
+
33
+ - Maximum size, type checked from content rather than extension, server-generated name, storage outside the public root.
34
+
35
+ ## Messages the system publishes (bots, chats, emails)
36
+
37
+ - Republished user or third-party text has mentions disabled or escaped (on Discord, `AllowedMentions.none()`) to
38
+ prevent injected `@everyone` and similar mentions.
39
+ - External links are displayed as text or checked against an allowlist; no masked links with third-party-controlled
40
+ destinations.
41
+ - Size and frequency limits on what the system publishes on someone's behalf.
42
+
43
+ ## Required tests
44
+
45
+ - Payload outside schema (wrong type, extra field, excessive size): rejected without a 500 error.
46
+ - Disallowed origin and oversized message: refused.
47
+ - Text with `@everyone` or injected mention: published without notifying anyone.
@@ -0,0 +1,57 @@
1
+ # Money and value
2
+
3
+ Applies to all code that creates, calculates, stores or moves value: money, payment methods, integrations with financial
4
+ infrastructure platforms, balances, credits, sales, subscriptions, refunds and trades between users.
5
+
6
+ ## Values
7
+
8
+ - Money as integers in the smallest unit (cents) or exact decimals, always with currency. Never `float`.
9
+ - One rounding rule, written in the contract, applied in a single place.
10
+
11
+ ## Payments
12
+
13
+ - Price, discount, fee and total are calculated on the server. Never trust amounts, prices or currency from the client.
14
+ - Use the provider's checkout or tokenization: no card data passes through your server or is stored.
15
+ - **Provider webhooks:** verify the signature over the raw body with constant-time comparison; reject events outside
16
+ the time window (replay); process each event only once, by its id; respond 2xx only after persisting.
17
+ - A browser redirect does not prove payment. State comes from the webhook or a provider query.
18
+ - Idempotency key on every charge creation, capture and refund.
19
+ - Explicit states (pending, paid, failed, refunded, disputed), with only allowed transitions.
20
+ - Periodic reconciliation with the provider; discrepancies trigger alerts, not silent corrections.
21
+
22
+ ## Balances and wallets
23
+
24
+ - A single module moves balances and records transactions. No other module, endpoint or script changes balances
25
+ directly in the database.
26
+ - Every value that generates or moves balance (price, prize, credit, cashback, items worth currency) is calculated and
27
+ validated only on the server; the client only displays it.
28
+ - Balance is not an editable field: it is the sum of ledger entries. In double-entry accounting, every credit has a
29
+ matching debit.
30
+ - Entries are insert-only. A correction is a reversing entry, never `UPDATE` or `DELETE`.
31
+ - Every movement occurs in a database transaction, with account locking (`SELECT ... FOR UPDATE`) or optimistic
32
+ version control. The sufficient-balance check stays inside that transaction to prevent double spending in a race.
33
+ - Database constraints: balance never negative (`CHECK`) when required by the rule; unique idempotency key.
34
+ - Audit trail on each entry: who, when, why and the originating request id.
35
+ - Limits per user and period, and alerts for abnormal patterns.
36
+ - Balances representing redeemable money may be regulated (in Brazil, Central Bank rules for payment institutions).
37
+ Confirm with legal counsel before allowing real-money withdrawals or transfers.
38
+
39
+ ## Trades between users
40
+
41
+ - Atomic trade: both sides change in the same transaction, or nothing changes.
42
+ - Both parties consent to the exact offer state (version or hash). Any offer change invalidates acceptance.
43
+ - Offered items remain reserved (escrow) while the offer is open, and return on cancellation or expiration.
44
+ - Ownership checked server-side at execution time: only owners offer their own items.
45
+ - Terminal states (completed, cancelled, expired); accepting twice does not execute two trades.
46
+ - Rate and value limits; watch new accounts and repeated unbalanced trades (fraud and laundering).
47
+ - Complete record of each trade to resolve disputes.
48
+
49
+ ## Required tests
50
+
51
+ - Two concurrent requests spending the same balance: only one succeeds.
52
+ - Repeated request or webhook: a single effect.
53
+ - Webhook with invalid signature, modified body or outside the time window: rejected.
54
+ - Forbidden state transition: rejected.
55
+ - Rounding at boundaries (cents, divisions, different currencies).
56
+ - Offer changed after the other party accepted: trade does not execute.
57
+ - User A cannot move B's balance or offer B's items.
@@ -0,0 +1,43 @@
1
+ # Secrets and infrastructure
2
+
3
+ ## Secrets
4
+
5
+ - Never in code, logs, messages, attachments, error reports, exception messages or client responses. For diagnostics,
6
+ record only whether the value is present or absent.
7
+ - Connection URLs in logs have credentials masked (`postgres://***@host`).
8
+ - Every new sensitive variable is empty and documented in `.env.example`, and read by a single configuration loader.
9
+ - Configuration exports replace secrets with placeholders.
10
+ - Public exceptions (for example, a client ID in every authorization URL) only by explicit name and format validation;
11
+ any value outside that format remains a secret.
12
+ - `.env`, local databases and caches stay outside git and Docker images (`.gitignore` and `.dockerignore`).
13
+
14
+ ## Admin commands and subprocesses
15
+
16
+ - Arguments as lists; `shell=True` only in an admin shell command intended for that purpose.
17
+ - Minimal subprocess environment (allowlist such as `PATH`, `HOME`, `LANG`); never forward the entire environment.
18
+ - Admin command output has secrets masked and goes only to the admin, never to a public channel.
19
+ - `eval` and remote consoles disabled by default, enabled through configuration.
20
+ - Record every admin command execution (who, what, when), without secrets.
21
+ - Auto-update only from the official repository, by verified tag or commit, without silently discarding local changes.
22
+ - Restart through orderly shutdown and a nonzero exit code, letting the supervisor start it again; never kill
23
+ unrelated PIDs.
24
+
25
+ ## Binary and script downloads
26
+
27
+ - Version-pinned URL (immutable tag or release, never `main` or `latest`) and pinned SHA-256.
28
+ - Download to a temporary file, verify the hash, move atomically; a wrong hash deletes the file and aborts.
29
+ - HTTPS only, with `timeout`. No `curl | bash` or executing freshly downloaded scripts.
30
+
31
+ ## Dependencies
32
+
33
+ - Exact version and hash in the lockfile, installation requiring hashes.
34
+ - Prefer official registry releases; git dependencies only pinned to a full commit SHA.
35
+ - Before adding: actual use, active maintenance, compatible license and audit without high or critical vulnerabilities.
36
+
37
+ ## Docker, CI and scripts
38
+
39
+ - Base image pinned by digest, non-root user, no secrets in layers or `ARG`.
40
+ - Bash scripts with `set -euo pipefail`, quoted variables and no printing the environment.
41
+ - No secrets in compose or workflow YAML; use CI secrets or ignored local `.env`.
42
+ - GitHub Actions pinned by SHA, minimal `permissions:` and no `pull_request_target` executing PR code.
43
+ - New security options start with the safe value as default.