Skip to content
Back to search

lagune

Lagune's Security-Driven Hardening commands, from the repository that authors them.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today

Check it deeper on your machine

It has changed since its scan on 11 Nov 2026. Its scripts were only partly scanned.

As a Claude Code plugin, install it and then ask Claude Code:

/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/wellwelwel/lagune with scanskillsafety

Or from a terminal, clone it and run it:

git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/wellwelwel/lagune'

It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/wellwelwel--lagune/badge.svg)](/listings/wellwelwel--lagune)

HTML

<a href="/listings/wellwelwel--lagune"><img src="/api/listings/wellwelwel--lagune/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

Pick your agent:

<table> <tr> <th width="50%" align="left">Install</th> <th width="50%" align="left">Update</th> </tr> <tr> <td colspan="2"><picture><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/agents/claude.svg" width="20" align="absmiddle" /></picture> <a href="https://lagune.ai/docs/install/claude-code"><b>Claude Code</b></a></td> </tr> <tr> <td>

claude plugin install lagune --marketplace wellwelwel/lagune

</td> <td>

claude plugin marketplace update lagune
claude plugin update lagune@lagune

</td> </tr> <tr> <td colspan="2"><picture><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/agents/claude.svg" width="20" align="absmiddle" /></picture> <a href="https://lagune.ai/docs/install/claude-code"><b>Claude Code Extension</b></a></td> </tr> <tr> <td>

- Type `/plugin` and select **Manage plugins**. - Add `wellwelwel/lagune` on the **Marketplaces** tab. - Install `lagune` on the **Plugins** tab.

</td> <td>

- Type `/plugin` and select **Manage plugins**. - Open the **Marketplaces** tab. - Select the refresh icon on `lagune`.

</td> </tr> <tr> <td colspan="2"><picture><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/agents/codex.svg" width="20" align="absmiddle" /></picture> <a href="https://lagune.ai/docs/install/codex"><b>Codex</b></a></td> </tr> <tr> <td>

codex plugin marketplace add wellwelwel/lagune
codex plugin add lagune@lagune

</td> <td>

codex plugin marketplace upgrade lagune

</td> </tr> </table>

- <picture><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/agents/antigravity.svg" width="20" align="absmiddle" /></picture> [**Antigravity**](https://lagune.ai/docs/install/antigravity-cli) - <picture><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/agents/cursor.svg" width="20" align="absmiddle" /></picture> [**Cursor**](https://lagune.ai/docs/install/cursor) - <picture><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/agents/devin.svg" width="20" align="absmiddle" /></picture> [**Devin for Terminal**](https://lagune.ai/docs/install/devin-cli) - <picture><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/agents/droid.svg" width="20" align="absmiddle" /></picture> [**Factory Droid**](https://lagune.ai/docs/install/factory-droid) - <picture><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/agents/gemini.svg" width="20" align="absmiddle" /></picture> [**Gemini CLI**](https://lagune.ai/docs/install/gemini-cli) - <picture><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/agents/copilot.svg" width="20" align="absmiddle" /></picture> [**GitHub Copilot**](https://lagune.ai/docs/install/github-copilot-cli) - <picture><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/agents/grok.svg" width="20" align="absmiddle" /></picture> [**Grok Build**](https://lagune.ai/docs/install/grok-build) - <picture><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/agents/hermes.svg" width="20" align="absmiddle" /></picture> [**Hermes Agent**](https://lagune.ai/docs/install/hermes-agent) - <picture><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/agents/kimi.svg" width="20" align="absmiddle" /></picture> [**Kimi Code**](https://lagune.ai/docs/install/kimi-code) - <picture><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/agents/muse.svg" width="20" align="absmiddle" /></picture> [**Muse Code**](https://lagune.ai/docs/install/muse-code)

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

.claude-plugin/marketplace.json · Manifest · 32 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. {
  2. "name": "lagune",
  3. "description": "Lagune's Security-Driven Hardening commands, from the repository that authors them.",
  4. "owner": {
  5. "name": "Weslley Araújo"
  6. },
  7. "plugins": [
  8. {
  9. "name": "lagune",
  10. "source": {
  11. "source": "url",
  12. "url": "https://github.com/wellwelwel/lagune.git",
  13. "ref": "plugin-claude"
  14. },
  15. "description": "🪼 Your security copilot as you build, your Blue Team when you audit, whether you're a developer or not.",
  16. "category": "security",
  17. "tags": [
  18. "security",
  19. "blue-team",
  20. "sdh",
  21. "sdd",
  22. "security-driven-hardening",
  23. "spec-driven-development",
  24. "audit",
  25. "hardening",
  26. "coding",
  27. "best-practices",
  28. "agent-skills"
  29. ]
  30. }
  31. ]
  32. }
README.md · README · 363 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. <div align="center">
  2. # 🪼 Lagune [AI](https://lagune.ai)
  3. [![Secured By Lagune](https://img.shields.io/badge/Lagune-2f7bff?logo=springsecurity&logoColor=white&label=Secured%20By&labelColor=303952)](https://lagune.ai)
  4. [![Version](https://img.shields.io/npm/v/lagune?label=&color=2f7bff&logo=npm&logoColor=white)](https://www.npmjs.com/package/lagune)
  5. [![Monthly Downloads](https://img.shields.io/npm/dt/lagune?label=&color=2f7bff&logo=npm&logoColor=white)](https://www.npmjs.com/package/lagune)
  6. [![No API Key Needed](https://img.shields.io/badge/No%20API%20Key%20Needed-2f7bff?logo=claudecode&logoColor=white)](https://lagune.ai/docs)
  7. Instead of running a generic checklist, what if security existed **before**, **during**, and **after** development?
  8. ---
  9. [**Give us a ⭐ on GitHub**](https://github.com/wellwelwel/lagune)<br />
  10. It helps more people discover the project.
  11. ---
  12. #### 📘 Documentation
  13. <a href="https://lagune.ai/docs"><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/flags/us.svg" alt="English" width="32" align="absmiddle" /></a>
  14. <a href="https://lagune.ai/pt-BR/docs"><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/flags/br.svg" alt="Português (Brasil)" width="32" align="absmiddle" /></a>
  15. <a href="https://lagune.ai/es-ES/docs"><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/flags/es.svg" alt="Español (España)" width="32" align="absmiddle" /></a>
  16. <a href="https://lagune.ai/de-DE/docs"><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/flags/de.svg" alt="Deutsch" width="32" align="absmiddle" /></a>
  17. <a href="https://lagune.ai/fr-FR/docs"><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/flags/fr.svg" alt="Français" width="32" align="absmiddle" /></a>
  18. <a href="https://lagune.ai/it-IT/docs"><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/flags/it.svg" alt="Italiano" width="32" align="absmiddle" /></a>
  19. <a href="https://lagune.ai/tr-TR/docs"><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/flags/tr.svg" alt="Türkçe" width="32" align="absmiddle" /></a>
  20. <a href="https://lagune.ai/uk-UA/docs"><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/flags/ua.svg" alt="Українська" width="32" align="absmiddle" /></a>
  21. <a href="https://lagune.ai/ru-RU/docs"><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/flags/ru.svg" alt="Русский" width="32" align="absmiddle" /></a>
  22. <a href="https://lagune.ai/zh-CN/docs"><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/flags/cn.svg" alt="简体中文" width="32" align="absmiddle" /></a>
  23. <a href="https://lagune.ai/ja-JP/docs"><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/flags/jp.svg" alt="日本語" width="32" align="absmiddle" /></a>
  24. <a href="https://lagune.ai/ko-KR/docs"><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/flags/kr.svg" alt="한국어" width="32" align="absmiddle" /></a>
  25. <a href="https://lagune.ai/hi-IN/docs"><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/flags/in.svg" alt="हिन्दी" width="32" align="absmiddle" /></a>
  26. <a href="https://lagune.ai/id-ID/docs"><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/flags/id.svg" alt="Bahasa Indonesia" width="32" align="absmiddle" /></a>
  27. <a href="https://lagune.ai/th-TH/docs"><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/flags/th.svg" alt="ไทย" width="32" align="absmiddle" /></a>
  28. <a href="https://lagune.ai/da-DK/docs"><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/flags/dk.svg" alt="Dansk" width="32" align="absmiddle" /></a>
  29. <a href="https://lagune.ai/no-NO/docs"><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/flags/no.svg" alt="Norsk" width="32" align="absmiddle" /></a>
  30. <a href="https://lagune.ai/pl-PL/docs"><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/flags/pl.svg" alt="Polski" width="32" align="absmiddle" /></a>
  31. <a href="https://lagune.ai/ar-AE/docs"><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/flags/ae.svg" alt="العربية" width="32" align="absmiddle" /></a>
  32. ---
  33. <img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/flow.svg" width="100%" alt="An AI agent running Lagune: a project charter, a secure user sign-up, and a Blue Team audit" />
  34. </div>
  35. ---
  36. ## Get Started
  37. ### Install and Update
  38. Pick your agent:
  39. <table>
  40. <tr>
  41. <th width="50%" align="left">Install</th>
  42. <th width="50%" align="left">Update</th>
  43. </tr>
  44. <tr>
  45. <td colspan="2"><picture><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/agents/claude.svg" width="20" align="absmiddle" /></picture> <a href="https://lagune.ai/docs/install/claude-code"><b>Claude Code</b></a></td>
  46. </tr>
  47. <tr>
  48. <td>
  49. ```bash
  50. claude plugin install lagune --marketplace wellwelwel/lagune
  51. ```
  52. </td>
  53. <td>
  54. ```bash
  55. claude plugin marketplace update lagune
  56. claude plugin update lagune@lagune
  57. ```
  58. </td>
  59. </tr>
  60. <tr>
  61. <td colspan="2"><picture><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/agents/claude.svg" width="20" align="absmiddle" /></picture> <a href="https://lagune.ai/docs/install/claude-code"><b>Claude Code Extension</b></a></td>
  62. </tr>
  63. <tr>
  64. <td>
  65. - Type `/plugin` and select **Manage plugins**.
  66. - Add `wellwelwel/lagune` on the **Marketplaces** tab.
  67. - Install `lagune` on the **Plugins** tab.
  68. </td>
  69. <td>
  70. - Type `/plugin` and select **Manage plugins**.
  71. - Open the **Marketplaces** tab.
  72. - Select the refresh icon on `lagune`.
  73. </td>
  74. </tr>
  75. <tr>
  76. <td colspan="2"><picture><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/agents/codex.svg" width="20" align="absmiddle" /></picture> <a href="https://lagune.ai/docs/install/codex"><b>Codex</b></a></td>
  77. </tr>
  78. <tr>
  79. <td>
  80. ```bash
  81. codex plugin marketplace add wellwelwel/lagune
  82. codex plugin add lagune@lagune
  83. ```
  84. </td>
  85. <td>
  86. ```bash
  87. codex plugin marketplace upgrade lagune
  88. ```
  89. </td>
  90. </tr>
  91. <tr>
  92. <td colspan="2"><picture><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/agents/vercel.svg" width="20" align="absmiddle" /></picture> <a href="https://lagune.ai/docs/install/universal"><b>Universal (skills.sh)</b></a></td>
  93. </tr>
  94. <tr>
  95. <td>
  96. ```bash
  97. npx skills add wellwelwel/lagune -y
  98. ```
  99. </td>
  100. <td>
  101. ```bash
  102. npx skills update
  103. ```
  104. </td>
  105. </tr>
  106. <tr>
  107. <td colspan="2"><picture><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/agents/github.svg" width="20" align="absmiddle" /></picture> <a href="https://lagune.ai/docs/install/universal"><b>Universal (GitHub CLI)</b></a></td>
  108. </tr>
  109. <tr>
  110. <td>
  111. ```bash
  112. gh skill install wellwelwel/lagune --all --scope project
  113. ```
  114. </td>
  115. <td>
  116. ```bash
  117. gh skill update --all
  118. ```
  119. </td>
  120. </tr>
  121. </table>
  122. - <picture><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/agents/antigravity.svg" width="20" align="absmiddle" /></picture> [**Antigravity**](https://lagune.ai/docs/install/antigravity-cli)
  123. - <picture><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/agents/cursor.svg" width="20" align="absmiddle" /></picture> [**Cursor**](https://lagune.ai/docs/install/cursor)
  124. - <picture><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/agents/devin.svg" width="20" align="absmiddle" /></picture> [**Devin for Terminal**](https://lagune.ai/docs/install/devin-cli)
  125. - <picture><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/agents/droid.svg" width="20" align="absmiddle" /></picture> [**Factory Droid**](https://lagune.ai/docs/install/factory-droid)
  126. - <picture><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/agents/gemini.svg" width="20" align="absmiddle" /></picture> [**Gemini CLI**](https://lagune.ai/docs/install/gemini-cli)
  127. - <picture><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/agents/copilot.svg" width="20" align="absmiddle" /></picture> [**GitHub Copilot**](https://lagune.ai/docs/install/github-copilot-cli)
  128. - <picture><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/agents/grok.svg" width="20" align="absmiddle" /></picture> [**Grok Build**](https://lagune.ai/docs/install/grok-build)
  129. - <picture><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/agents/hermes.svg" width="20" align="absmiddle" /></picture> [**Hermes Agent**](https://lagune.ai/docs/install/hermes-agent)
  130. - <picture><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/agents/kimi.svg" width="20" align="absmiddle" /></picture> [**Kimi Code**](https://lagune.ai/docs/install/kimi-code)
  131. - <picture><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/agents/muse.svg" width="20" align="absmiddle" /></picture> [**Muse Code**](https://lagune.ai/docs/install/muse-code)
  132. - <picture><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/agents/opencode.svg" width="20" align="absmiddle" /></picture> [**OpenCode**](https://lagune.ai/docs/install/opencode)
  133. - <picture><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/agents/pi.svg" width="20" align="absmiddle" /></picture> [**Pi**](https://lagune.ai/docs/install/pi)
  134. - <picture><img src="https://raw.githubusercontent.com/wellwelwel/lagune/main/.github/readme/assets/agents/qwen.svg" width="20" align="absmiddle" /></picture> [**Qwen Code**](https://lagune.ai/docs/install/qwen-code)
  135. > [!NOTE]
  136. >
  137. > - See the [**Install**](https://lagune.ai/docs) section for **detailed instructions**.
  138. > - [**Migrate from previous Lagune**](https://lagune.ai/docs/commands/migrate) manifest-based setup.
  139. ---
  140. ### Skills
  141. Once installed, your **AI** agent unlocks a set of commands, all governed by the **charter**: secure new work as you build it, or run the full audit over a project.
  142. > [!TIP]
  143. >
  144. > See real-world [**Prompt Samples**](https://lagune.ai/docs/examples/prompts) 🪼
  145. #### › First use
  146. Start here, before building or auditing:
  147. | Skill | What it does for you |
  148. | -------------------------------------------------------------- | ------------------------------------------------------------------------------ |
  149. | [**/lagune-charter**](https://lagune.ai/docs/commands/charter) | Sets your project's security rules, the foundation every other skill builds on |
  150. ##### Examples
  151. ```md
  152. /lagune-charter
  153. ```
  154. ```md
  155. /lagune-charter @<PRD.md>
  156. ```
  157. ```md
  158. /lagune-charter <describe your project and what it does>
  159. ```
  160. #### › Build _(Universal)_
  161. Harden the work as you write it, with no flow to follow:
  162. | Skill | What it does for you |
  163. | ----------------------------------------------------- | -------------------------------------------------------------------------- |
  164. | [**/lagune**](https://lagune.ai/docs/commands/lagune) | Builds what you ask and hardens it as it is written, guided by the charter |
  165. ##### Examples
  166. ```md
  167. /lagune let users upload a custom photo on their profile.
  168. ```
  169. ```md
  170. /lagune nothing happens when the user submits the form. Look into what it might be and fix it.
  171. ```
  172. ```md
  173. /lagune decouple and improve the payload logic
  174. ```
  175. #### › Audit: the Blue Team flow
  176. These five run in order. Each builds on the previous, so following the list top to bottom is all it takes:
  177. | # | Skill | What it does for you |
  178. | --- | -------------------------------------------------------------- | ------------------------------------------------------------------------------ |
  179. | 1 | [**/lagune-charter**](https://lagune.ai/docs/commands/charter) | Sets your project's security rules, proposed for you or shaped by what you say |
  180. | 2 | [**/lagune-detect**](https://lagune.ai/docs/commands/detect) | Reads your code and maps what your system does and where the risks are |
  181. | 3 | [**/lagune-plan**](https://lagune.ai/docs/commands/plan) | Turns what detect found into a defense plan, with a fix for each finding |
  182. | 4 | [**/lagune-harden**](https://lagune.ai/docs/commands/harden) | Applies the plan's fixes to your code, safely and one at a time |
  183. | 5 | [**/lagune-verify**](https://lagune.ai/docs/commands/verify) | Proves each applied fix holds and closes out the ones that do |
  184. ##### Examples
  185. ```md
  186. You are a cybersecurity orchestrator:
  187. - 0th sub-agent: /lagune-charter (only if no charter exists)
  188. - 1st sub-agent: /lagune-detect
  189. - 2nd sub-agent: /lagune-plan
  190. - 3rd sub-agent: /lagune-harden
  191. - 4th sub-agent: /lagune-verify
  192. Loop: re-run harden and verify sub-agents until all findings are closed.
  193. ```
  194. Combine them with your own skills, for example:
  195. ```md
  196. // ...
  197. - 3rd sub-agent: /lagune-harden /engineering
  198. - 4th sub-agent: /lagune-verify /code-review
  199. ```
  200. #### › Special skills
  201. | Skill | What it does |
  202. | -------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
  203. | [**/lagune-specialize**](https://lagune.ai/docs/commands/specialize) | Teaches **Lagune** a new security specialization from articles, exploits, or topics |
  204. | [**/lagune-prove**](https://lagune.ai/docs/commands/prove) | Turns each detected finding into a runnable, defense-only proof for responsible disclosure |
  205. > [!TIP]
  206. >
  207. > Security is not a cost, it is an investment: what you put in upfront, you save many times over in the incidents you never have 🙋🏻‍♂️
  208. > [!NOTE]
  209. >
  210. > Some agents take the commands under the plugin's name, such as `/lagune:lagune-charter`. Your agent's [**install page**](https://lagune.ai/docs) shows how to type them.
  211. > [!IMPORTANT]
  212. >
  213. > See the full [**documentation**](https://lagune.ai/) for usage examples and more.
  214. ---
  215. ### Dashboard
  216. For an interactive live view of `.lagune/`, run:
  217. ```bash
  218. npx lagune
  219. ```
  220. It serves a dashboard and opens it on a random port:
  221. - [x] **Live Reload**
  222. - [x] **Private** and **Local**
  223. - [x] Follow the findings, fixes, and verdicts, and manage the categories, directly from your browser
  224. - [x] No `node_modules` or `package.json` is needed 📦
  225. <details>
  226. <summary>Overview</summary>
  227. <br />
  228. <img width="320" src="https://raw.githubusercontent.com/wellwelwel/lagune/main/website/static/img/dashboard/02.png" />
  229. <img width="320" src="https://raw.githubusercontent.com/wellwelwel/lagune/main/website/static/img/dashboard/03.png" />
  230. <img width="320" src="https://raw.githubusercontent.com/wellwelwel/lagune/main/website/static/img/dashboard/04.png" />
  231. <img width="320" src="https://raw.githubusercontent.com/wellwelwel/lagune/main/website/static/img/dashboard/05.png" />
  232. <img width="320" src="https://raw.githubusercontent.com/wellwelwel/lagune/main/website/static/img/dashboard/06.png" />
  233. </details>
  234. > [!TIP]
  235. >
  236. > - 🚪 Use `--port` to specify a custom port.
  237. > - ⏏️ Press `Ctrl+C` to stop.
  238. ---
  239. ## Requirements
  240. You will need [**Node.js (LTS)**](https://nodejs.org/en/download/package-manager) installed on your system.
  241. ---
  242. ## Security
  243. To report a vulnerability and see the supported versions, check the [**Security Policy**](https://github.com/wellwelwel/lagune/blob/main/SECURITY.md).
  244. ---
  245. ## Contributing
  246. See the [**Contributing Guide**](https://github.com/wellwelwel/lagune/blob/main/CONTRIBUTING.md) and please follow our [**Code of Conduct**](https://github.com/wellwelwel/lagune/blob/main/CODE_OF_CONDUCT.md) 🚀
  247. ---
  248. ## Acknowledgements
  249. ### Partners
  250. Partners get an exclusive logo across the repositories and landing pages, plus a spot on a dedicated partners page.
  251. > Help my work grow by [**becoming a partner**](https://weslley.io/?partners) 🖖
  252. ### Supporters
  253. Really thanks to everyone who has supported and keeps supporting my work.
  254. [![Sponsors](https://wellwelwel.github.io/wellwelwel/sponsors.svg?v=1)](https://github.com/sponsors/wellwelwel)
  255. > Support my work by [**becoming a sponsor**](https://github.com/sponsors/wellwelwel) too ✨
  256. ---
  257. ## License
  258. **Lagune** is under the [**Apache License 2.0**](https://github.com/wellwelwel/lagune/blob/main/LICENSE).<br />
  259. Copyright © 2026-present [**Weslley Araújo**](https://github.com/wellwelwel) and [**contributors**](https://github.com/wellwelwel/lagune/graphs/contributors).
  260. All product names, trademarks, and registered trademarks mentioned are the property of their respective owners and are used for identification purposes only.
scripts/playground/agents.sh · Bundled script · 728 lines · 2 findings marked
  1. #!/usr/bin/env bash
  2. set -euo pipefail
  3. repository="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
  4. tools="$repository/tools/playground"
  5. fixture="$repository/.claude/skills/simulate/fixtures/image-upload-service"
  6. root="${LAGUNE_PLAYGROUND:-$HOME/.lagune-playground}"
  7. keysFile="$root/keys.env"
  8. prompt='An image upload service for a small team'
  9. agents='droid grok gemini qwen opencode pi cursor antigravity copilot kimi'
  10. export GIT_AUTHOR_NAME='Lagune playground' GIT_AUTHOR_EMAIL='playground@lagune.invalid'
  11. export GIT_COMMITTER_NAME='Lagune playground' GIT_COMMITTER_EMAIL='playground@lagune.invalid'
  12. export COPYFILE_DISABLE=1
  13. usage() {
  14. cat << TEXT
  15. Usage: bash scripts/playground/agents.sh <agent> <action> [arguments]
  16. bash scripts/playground/agents.sh keys
  17. Agents:
  18. acceptance droid grok gemini qwen opencode pi cursor antigravity
  19. probe copilot kimi
  20. Actions:
  21. mount Build this tree, install what the release would publish for the agent
  22. into an isolated home, and copy the fixture into a fresh project.
  23. mount sign-in The same, with the agent's own sign-in instead of the keys file's BYOK.
  24. run [args] Start the agent in the project, with its isolated home.
  25. server on|off Put the engine's server back in the installed plugin, or take it out,
  26. and start a new measurement. Acceptance agents only.
  27. report Print the engine calls and the verdict, or what the probe received.
  28. keys Create the keys file, where your API keys and BYOK endpoint live.
  29. Everything lives under $root, outside the repository
  30. (override it with LAGUNE_PLAYGROUND). The agent's CLI comes from your PATH, or from
  31. LAGUNE_PLAYGROUND_BIN. Logins stay in each agent's isolated home across mounts.
  32. The agent starts with a clean environment, as outside any editor: only PATH, your user
  33. and shell, the terminal, the locale, proxy settings, and the keys file reach it.
  34. Claude Code keeps its own playground: bash scripts/playground/mount.sh
  35. TEXT
  36. }
  37. binaryName() {
  38. case "$1" in
  39. droid | grok | gemini | qwen | opencode | pi | copilot | kimi) echo "$1" ;;
  40. cursor) echo agent ;;
  41. antigravity) echo agy ;;
  42. *) return 1 ;;
  43. esac
  44. }
  45. installHint() {
  46. case "$1" in
  47. droid) echo 'npm install --global @factory/cli' ;;
  48. grok) echo 'npm install --global @xai-official/grok' ;;
  49. gemini) echo 'npm install --global @google/gemini-cli' ;;
  50. qwen) echo 'npm install --global @qwen-code/qwen-code' ;;
  51. opencode) echo 'npm install --global opencode-ai (1.x) or @opencode/cli (2.x)' ;;
  52. pi) echo 'npm install --global @earendil-works/pi-coding-agent' ;;
  53. cursor) echo 'curl https://cursor.com/install -fsS | bash' ;;
    • Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
    • Line 61 on GitHub
  54. antigravity) echo 'curl -fsSL https://antigravity.google/cli/install.sh | bash' ;;
    • Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
    • Line 62 on GitHub
  55. copilot) echo 'npm install --global @github/copilot' ;;
  56. kimi) echo 'npm install --global @moonshot-ai/kimi-code' ;;
  57. esac
  58. }
  59. isProbe() {
  60. [[ "$1" == copilot || "$1" == kimi ]]
  61. }
  62. hasByok() {
  63. [[ -n "${LAGUNE_BYOK_BASE_URL:-}" && -n "${LAGUNE_BYOK_API_KEY:-}" && -n "${LAGUNE_BYOK_MODEL:-}" ]] && ! signsIn
  64. }
  65. signsIn() {
  66. [[ "$(cat "$state/model" 2> /dev/null)" == sign-in ]]
  67. }
  68. createKeysFile() {
  69. if [[ -f "$keysFile" ]]; then
  70. echo "The keys file already exists: $keysFile"
  71. return
  72. fi
  73. mkdir -p "$root"
  74. (
  75. umask 077
  76. cat > "$keysFile" << 'TEXT'
  77. # The Lagune playground reads this file on every mount and run. It lives outside the
  78. # repository and only you can read it. Uncomment and fill what you have, then mount again.
  79. # Keys exported by your shell never reach the agent, so every key it needs goes here.
  80. # BYOK: any OpenAI-compatible endpoint drives Factory Droid, Grok Build, Qwen Code,
  81. # OpenCode, and Pi with the same model. Examples of base URLs:
  82. # OpenRouter https://openrouter.ai/api/v1
  83. # OpenAI https://api.openai.com/v1
  84. # xAI https://api.x.ai/v1
  85. # Anthropic https://api.anthropic.com/v1
  86. # Google https://generativelanguage.googleapis.com/v1beta/openai
  87. # The model is its id as the provider names it, such as one listed at openrouter.ai/models.
  88. # LAGUNE_BYOK_BASE_URL=https://openrouter.ai/api/v1
  89. # LAGUNE_BYOK_API_KEY=
  90. # LAGUNE_BYOK_MODEL=
  91. # Gemini CLI and Antigravity CLI: a key from https://aistudio.google.com/apikey
  92. # GEMINI_API_KEY=
  93. # Cursor CLI: a user API key from https://cursor.com/dashboard/api, since its sign-in
  94. # needs the macOS keychain, which the isolated home cannot reach.
  95. # CURSOR_API_KEY=
  96. TEXT
  97. )
  98. echo "Created $keysFile. Fill it in, then mount the agent again."
  99. }
  100. if [[ "${1:-}" == keys ]]; then
  101. createKeysFile
  102. exit 0
  103. fi
  104. agent="${1:-}"
  105. action="${2:-}"
  106. if [[ -z "$agent" || -z "$action" ]]; then
  107. usage
  108. exit 0
  109. fi
  110. if ! binaryName "$agent" > /dev/null; then
  111. echo "Unknown agent \"$agent\". Choose one of: $agents." >&2
  112. exit 1
  113. fi
  114. shift 2
  115. state="$root/$agent"
  116. project="$state/project"
  117. calls="$state/engine-calls.jsonl"
  118. measurements="$state/measurements"
  119. probeLog="$state/probe.jsonl"
  120. registryProcess=''
  121. resolveBinary() {
  122. local name found
  123. name="$(binaryName "$agent")"
  124. found="${LAGUNE_PLAYGROUND_BIN:-$(command -v "$name" || true)}"
  125. if [[ -z "$found" && "$agent" == cursor ]]; then
  126. found="$(command -v cursor-agent || true)"
  127. fi
  128. if [[ -z "$found" ]]; then
  129. echo "The $agent CLI ($name) is not on your PATH. Install it with: $(installHint "$agent")" >&2
  130. exit 1
  131. fi
  132. binary="$found"
  133. }
  134. keepsVariable() {
  135. case "$1" in
  136. PATH | PWD | SHELL | USER | LOGNAME | TERM | COLORTERM | LANG | LC_* | TZ) return 0 ;;
  137. HTTP_PROXY | HTTPS_PROXY | NO_PROXY | ALL_PROXY | http_proxy | https_proxy | no_proxy | all_proxy) return 0 ;;
  138. NODE_EXTRA_CA_CERTS | SSL_CERT_FILE | SSL_CERT_DIR) return 0 ;;
  139. LAGUNE_PLAYGROUND | LAGUNE_PLAYGROUND_BIN | GIT_AUTHOR_* | GIT_COMMITTER_* | COPYFILE_DISABLE) return 0 ;;
  140. esac
  141. return 1
  142. }
  143. clearEnvironment() {
  144. local name
  145. for name in $(compgen -e); do
  146. keepsVariable "$name" || unset "$name" 2> /dev/null || true
  147. done
  148. }
  149. loadKeys() {
  150. if [[ -f "$keysFile" ]]; then
  151. set -a
  152. # shellcheck source=/dev/null
  153. . "$keysFile"
  154. set +a
  155. fi
  156. }
  157. isolate() {
  158. clearEnvironment
  159. loadKeys
  160. export HOME="$state/home"
  161. export XDG_CONFIG_HOME="$HOME/.config"
  162. export XDG_DATA_HOME="$HOME/.local/share"
  163. export XDG_CACHE_HOME="$HOME/.cache"
  164. export XDG_STATE_HOME="$HOME/.local/state"
  165. export TMPDIR="$state/tmp"
  166. export npm_config_cache="$HOME/.npm"
  167. export npm_config_prefix="$HOME/.npm-global"
  168. export PATH="$state/shadow:$PATH"
  169. mkdir -p "$XDG_CONFIG_HOME" "$XDG_DATA_HOME" "$XDG_CACHE_HOME" "$XDG_STATE_HOME" "$TMPDIR" "$npm_config_prefix" "$state/shadow"
  170. printf '#!/bin/sh\necho "lagune: command not found" >&2\nexit 127\n' > "$state/shadow/lagune"
  171. chmod +x "$state/shadow/lagune"
  172. case "$agent" in
  173. droid) export FACTORY_DISABLE_KEYRING=1 FACTORY_DROID_AUTO_UPDATE_ENABLED=false ;;
  174. grok) export GROK_HOME="$HOME/.grok" GROK_DISABLE_AUTOUPDATER=1 ;;
  175. gemini) export GEMINI_CLI_HOME="$HOME" ;;
  176. qwen) export QWEN_HOME="$HOME/.qwen" ;;
  177. opencode) export OPENCODE_DISABLE_AUTOUPDATE=1 ;;
  178. pi) export PI_CODING_AGENT_DIR="$HOME/.pi/agent" ;;
  179. copilot) export COPILOT_HOME="$HOME/.copilot" ;;
  180. kimi) export KIMI_CODE_HOME="$HOME/.kimi-code" ;;
  181. esac
  182. }
  183. commitAll() {
  184. git -C "$1" add -A
  185. git -C "$1" commit --quiet --no-verify -m "$2"
  186. }
  187. buildEngine() {
  188. echo "Building this tree..."
  189. if ! (cd "$repository" && npm run build > "$state/build.log" 2>&1); then
  190. cat "$state/build.log" >&2
  191. exit 1
  192. fi
  193. version="$(node -p 'require(process.argv[1]).version' "$repository/package.json")"
  194. tarball="$state/pack/lagune-$version.tgz"
  195. rm -rf "$state/pack"
  196. mkdir -p "$state/pack"
  197. (cd "$repository" && npm pack --pack-destination "$state/pack" > /dev/null 2>&1)
  198. }
  199. freshProject() {
  200. rm -rf "$project"
  201. mkdir -p "$project"
  202. cp -R "$fixture/." "$project/"
  203. git -C "$project" init --quiet
  204. commitAll "$project" 'The image-upload-service fixture'
  205. }
  206. stagePinnedEngine() {
  207. local unpacked="$state/unpacked"
  208. rm -rf "$unpacked" "$state/registry" "$state/home/.npm/_npx"
  209. mkdir -p "$unpacked" "$state/registry"
  210. tar -xzf "$tarball" -C "$unpacked"
  211. node "$tools/instrument.ts" "$unpacked/package/lib/bin/index.js" "$calls" npx
  212. tar -czf "$state/registry/lagune-$version.tgz" -C "$unpacked" package
  213. echo "$version" > "$state/registry/latest"
  214. echo "$version" > "$state/pinned"
  215. rm -rf "$unpacked"
  216. }
  217. assembleBundle() {
  218. rm -rf "$state/bundle"
  219. (cd "$repository" && bash scripts/plugins/bundle.sh "$1" "$state/bundle")
  220. node "$tools/instrument.ts" "$state/bundle/lib/bin/index.js" "$calls" tools
  221. }
  222. publishBareRepository() {
  223. local branch="$1" bare="$state/lagune.git" work="$state/work"
  224. rm -rf "$bare" "$work" "$work-main"
  225. git init --quiet --bare --initial-branch=main "$bare"
  226. git init --quiet --initial-branch="$branch" "$work"
  227. cp -R "$state/bundle/." "$work/"
  228. commitAll "$work" "The $branch bundle"
  229. git -C "$work" push --quiet "$bare" "$branch"
  230. git init --quiet --initial-branch=main "$work-main"
  231. "$2" "$work-main"
  232. commitAll "$work-main" 'The default branch'
  233. git -C "$work-main" push --quiet "$bare" main
  234. rm -rf "$work" "$work-main"
  235. }
  236. writeDroidMain() {
  237. node "$tools/config.ts" droid-marketplace \
  238. "$repository/.factory-plugin/marketplace.json" \
  239. "$1/.factory-plugin/marketplace.json" \
  240. "file://$state/lagune.git"
  241. }
  242. writePlaceholderMain() {
  243. echo 'The plugin lives on its own branch.' > "$1/README.md"
  244. }
  245. stageNpmPackage() {
  246. local unpacked="$state/unpacked"
  247. stamped="$version-playground.$(date +%s)"
  248. rm -rf "$unpacked"
  249. mkdir -p "$unpacked"
  250. tar -xzf "$tarball" -C "$unpacked"
  251. node "$tools/config.ts" stamp-package "$unpacked/package" "$stamped"
  252. node "$tools/instrument.ts" "$unpacked/package/lib/bin/index.js" "$calls" tools
  253. tar -czf "$state/registry/lagune-$stamped.tgz" -C "$unpacked" package
  254. echo "$stamped" > "$state/registry/latest"
  255. rm -rf "$unpacked"
  256. }
  257. stopRegistry() {
  258. if [[ -n "$registryProcess" ]]; then
  259. kill "$registryProcess" 2> /dev/null || true
  260. wait "$registryProcess" 2> /dev/null || true
  261. registryProcess=''
  262. fi
  263. }
  264. startRegistry() {
  265. local attempt
  266. registryPort="$(node -e "const server = require('node:net').createServer(); server.listen(0, '127.0.0.1', () => { console.log(server.address().port); server.close(); });")"
  267. node "$tools/registry.ts" "$registryPort" "$state/registry" > "$state/registry.log" 2>&1 &
  268. registryProcess=$!
  269. trap stopRegistry EXIT
  270. for attempt in $(seq 1 50); do
  271. if curl -fsS "http://127.0.0.1:$registryPort/lagune" > /dev/null 2>&1; then
  272. export npm_config_registry="http://127.0.0.1:$registryPort/"
  273. echo "registry=$npm_config_registry" > "$HOME/.npmrc"
  274. return
  275. fi
  276. sleep 0.1
  277. done
  278. echo 'The local npm registry did not start.' >&2
  279. exit 1
  280. }
  281. openCodeMajor() {
  282. "$binary" --version 2> /dev/null | grep -oE '[0-9]+' | head -1
  283. }
  284. writeProbePlugin() {
  285. rm -rf "$state/probe-plugin"
  286. node "$tools/config.ts" probe-plugin "$agent" "$state/probe-plugin" "$(command -v node)" "$tools/probe.ts" "$probeLog"
  287. }
  288. installForAgent() {
  289. case "$agent" in
  290. droid)
  291. assembleBundle droid
  292. publishBareRepository plugin-droid writeDroidMain
  293. isolate
  294. cd "$HOME"
  295. "$binary" plugin uninstall lagune@lagune > /dev/null 2>&1 || true
  296. "$binary" plugin marketplace remove lagune > /dev/null 2>&1 || true
  297. "$binary" plugin marketplace add "file://$state/lagune.git"
  298. "$binary" plugin install lagune@lagune
  299. ;;
  300. grok)
  301. assembleBundle grok
  302. publishBareRepository plugin-grok writePlaceholderMain
  303. isolate
  304. cd "$HOME"
  305. "$binary" plugin uninstall lagune > /dev/null 2>&1 || true
  306. "$binary" plugin install "file://$state/lagune.git@plugin-grok" --trust
  307. ;;
  308. gemini)
  309. assembleBundle gemini
  310. isolate
  311. cd "$HOME"
  312. "$binary" extensions uninstall lagune > /dev/null 2>&1 || true
  313. printf 'y\n' | "$binary" extensions install "$state/bundle" --consent
  314. ;;
  315. qwen)
  316. stageNpmPackage
  317. isolate
  318. cd "$HOME"
  319. startRegistry
  320. "$binary" extensions uninstall lagune > /dev/null 2>&1 || true
  321. printf 'Y\n' | "$binary" extensions install lagune --registry "http://127.0.0.1:$registryPort"
  322. stopRegistry
  323. ;;
  324. opencode)
  325. stageNpmPackage
  326. isolate
  327. cd "$HOME"
  328. startRegistry
  329. node "$tools/config.ts" opencode-clear "$XDG_CONFIG_HOME/opencode/opencode.json" "$(openCodeMajor)"
  330. if [[ "$(openCodeMajor)" == 1 ]]; then
  331. "$binary" plugin "lagune@$stamped" -g --force
  332. else
  333. "$binary" plugin add "lagune@$stamped"
  334. "$binary" service stop > /dev/null 2>&1 || true
  335. fi
  336. stopRegistry
  337. ;;
  338. pi)
  339. stageNpmPackage
  340. isolate
  341. cd "$HOME"
  342. startRegistry
  343. "$binary" remove npm:lagune > /dev/null 2>&1 || true
  344. "$binary" install npm:lagune
  345. stopRegistry
  346. ;;
  347. cursor)
  348. assembleBundle cursor
  349. isolate
  350. rm -rf "$HOME/.cursor/plugins/local/lagune"
  351. mkdir -p "$HOME/.cursor/plugins/local"
  352. cp -R "$state/bundle" "$HOME/.cursor/plugins/local/lagune"
  353. ;;
  354. antigravity)
  355. assembleBundle antigravity
  356. isolate
  357. cd "$HOME"
  358. "$binary" plugin uninstall lagune > /dev/null 2>&1 || true
  359. "$binary" plugin install "$state/bundle"
  360. ;;
  361. copilot)
  362. writeProbePlugin
  363. isolate
  364. cd "$HOME"
  365. "$binary" plugin uninstall lagune-probe@lagune-probe > /dev/null 2>&1 || true
  366. "$binary" plugin marketplace remove lagune-probe > /dev/null 2>&1 || true
  367. "$binary" plugin marketplace add "$state/probe-plugin"
  368. "$binary" plugin install lagune-probe@lagune-probe
  369. ;;
  370. kimi)
  371. writeProbePlugin
  372. ;;
  373. esac
  374. }
  375. clearByok() {
  376. case "$agent" in
  377. droid) node "$tools/config.ts" clear-byok droid "$HOME/.factory/settings.json" ;;
  378. grok) node "$tools/config.ts" clear-byok grok "$GROK_HOME/config.toml" ;;
  379. qwen) node "$tools/config.ts" clear-byok qwen "$QWEN_HOME/settings.json" ;;
  380. opencode) node "$tools/config.ts" clear-byok opencode "$XDG_CONFIG_HOME/opencode/opencode.json" ;;
  381. pi) node "$tools/config.ts" clear-byok pi "$PI_CODING_AGENT_DIR/models.json" ;;
  382. esac
  383. }
  384. configureModel() {
  385. if signsIn; then
  386. clearByok
  387. return
  388. fi
  389. case "$agent" in
  390. gemini)
  391. if [[ -n "${GEMINI_API_KEY:-}" ]]; then
  392. node "$tools/config.ts" select-auth "$HOME/.gemini/settings.json" gemini-api-key
  393. fi
  394. ;;
  395. droid)
  396. if hasByok; then
  397. node "$tools/config.ts" byok-droid "$HOME/.factory/settings.json" "$LAGUNE_BYOK_BASE_URL" "$LAGUNE_BYOK_API_KEY" "$LAGUNE_BYOK_MODEL"
  398. fi
  399. ;;
  400. grok)
  401. if hasByok; then
  402. node "$tools/config.ts" byok-grok "$GROK_HOME/config.toml" "$LAGUNE_BYOK_BASE_URL" "$LAGUNE_BYOK_API_KEY" "$LAGUNE_BYOK_MODEL"
  403. fi
  404. ;;
  405. qwen)
  406. if hasByok; then
  407. node "$tools/config.ts" select-auth "$QWEN_HOME/settings.json" openai
  408. fi
  409. ;;
  410. opencode)
  411. if hasByok; then
  412. node "$tools/config.ts" byok-opencode "$XDG_CONFIG_HOME/opencode/opencode.json" "$(openCodeMajor)" "$LAGUNE_BYOK_BASE_URL" "$LAGUNE_BYOK_API_KEY" "$LAGUNE_BYOK_MODEL"
  413. fi
  414. ;;
  415. pi)
  416. if hasByok; then
  417. node "$tools/config.ts" byok-pi "$PI_CODING_AGENT_DIR/models.json" "$LAGUNE_BYOK_BASE_URL" "$LAGUNE_BYOK_API_KEY" "$LAGUNE_BYOK_MODEL"
  418. fi
  419. ;;
  420. esac
  421. }
  422. modelNote() {
  423. case "$agent" in
  424. gemini | antigravity)
  425. if [[ -n "${GEMINI_API_KEY:-}" ]]; then
  426. echo 'the Gemini API key from the keys file'
  427. elif [[ "$agent" == gemini ]]; then
  428. echo 'none yet: Gemini CLI takes a paid Gemini API key or a Code Assist Standard or Enterprise sign-in, since free, AI Pro, and AI Ultra accounts moved to Antigravity CLI. Put GEMINI_API_KEY in the keys file and mount again'
  429. else
  430. echo 'your Google sign-in, on the first session'
  431. fi
  432. ;;
  433. droid | grok | qwen | opencode | pi)
  434. if signsIn; then
  435. echo "your own sign-in, on the first run, since this mount skips BYOK"
  436. elif hasByok; then
  437. echo "BYOK, $LAGUNE_BYOK_MODEL at $LAGUNE_BYOK_BASE_URL, preselected as \"Playground\""
  438. else
  439. echo "the agent's own sign-in, on the first run, or BYOK: fill LAGUNE_BYOK_* in the keys file and mount again"
  440. fi
  441. ;;
  442. cursor)
  443. if [[ -n "${CURSOR_API_KEY:-}" ]]; then
  444. echo 'the Cursor API key from the keys file'
  445. else
  446. echo 'none yet: put CURSOR_API_KEY in the keys file, since agent login needs the macOS keychain, which the isolated home cannot reach'
  447. fi
  448. ;;
  449. copilot | kimi) echo 'your account, with /login on the first session if the agent asks' ;;
  450. esac
  451. }
  452. invocation() {
  453. case "$agent" in
  454. gemini | qwen | antigravity) echo "/lagune:lagune-charter $prompt" ;;
  455. pi) echo "/skill:lagune-charter $prompt" ;;
  456. opencode)
  457. if [[ "$(openCodeMajor)" == 1 ]]; then
  458. echo "/lagune-charter $prompt"
  459. else
  460. echo "@lagune-charter, picked from the @ menu, then: $prompt"
  461. fi
  462. ;;
  463. *) echo "/lagune-charter $prompt" ;;
  464. esac
  465. }
  466. printNextSteps() {
  467. local command="bash scripts/playground/agents.sh $agent"
  468. echo
  469. echo "Mounted $agent ($binary)."
  470. echo "Project: $project"
  471. echo "Home: $state/home, where the agent keeps its login"
  472. echo "Model: $(modelNote)"
  473. if [[ ! -f "$keysFile" ]]; then
  474. echo "Keys: no keys file yet. Create it with: bash scripts/playground/agents.sh keys"
  475. fi
  476. echo
  477. if isProbe "$agent"; then
  478. echo "1. Start it: $command run"
  479. if [[ "$agent" == kimi ]]; then
  480. echo " In the session: /plugins install $state/probe-plugin, choose Trust and install, then /new"
  481. fi
  482. echo '2. Ask it: "Call the where tool of the lagune-probe server."'
  483. echo "3. See what the plugin server received: $command report"
  484. return
  485. fi
  486. echo "1. Start it: $command run"
  487. echo "2. Type: $(invocation)"
  488. echo ' Answer each permission prompt as it comes. Allow nothing up front.'
  489. echo "3. Read the verdict: $command report"
  490. echo "4. Take the server out, then repeat 1 to 3: $command server off"
  491. }
  492. mount() {
  493. local choice="${1:-byok}"
  494. if [[ "$choice" != byok && "$choice" != sign-in ]]; then
  495. echo 'Usage: mount [sign-in]' >&2
  496. exit 1
  497. fi
  498. if [[ ! -d "$fixture" ]]; then
  499. echo "The fixture is missing: $fixture" >&2
  500. exit 1
  501. fi
  502. resolveBinary
  503. mkdir -p "$state"
  504. echo "$choice" > "$state/model"
  505. freshProject
  506. if ! isProbe "$agent"; then
  507. buildEngine
  508. stagePinnedEngine
  509. fi
  510. rm -rf "$measurements"
  511. : > "$calls"
  512. : > "$probeLog"
  513. echo on > "$state/mode"
  514. installForAgent
  515. configureModel
  516. printNextSteps
  517. }
  518. switchFile() {
  519. if [[ "$1" == off && -e "$2" ]]; then
  520. mv "$2" "$2.off"
  521. fi
  522. if [[ "$1" == on && -e "$2.off" ]]; then
  523. mv "$2.off" "$2"
  524. fi
  525. }
  526. saveMeasurement() {
  527. if [[ -s "$calls" ]]; then
  528. mkdir -p "$measurements"
  529. mv "$calls" "$measurements/$(date +%H%M%S)-$(cat "$state/mode" 2> /dev/null || echo on).jsonl"
  530. fi
  531. : > "$calls"
  532. }
  533. switchServer() {
  534. local wanted="${1:-}" file
  535. if [[ "$wanted" != on && "$wanted" != off ]]; then
  536. echo 'Usage: server on|off' >&2
  537. exit 1
  538. fi
  539. if isProbe "$agent"; then
  540. echo "The $agent probe has no engine server to switch." >&2
  541. exit 1
  542. fi
  543. resolveBinary
  544. isolate
  545. case "$agent" in
  546. droid)
  547. while IFS= read -r file; do
  548. switchFile "$wanted" "${file%.off}"
  549. done < <(find "$HOME/.factory/plugins" \( -name mcp.json -o -name mcp.json.off \) -path '*lagune*' 2> /dev/null)
  550. ;;
  551. grok)
  552. for file in "$GROK_HOME"/installed-plugins/lagune-*/.mcp.json "$GROK_HOME"/installed-plugins/lagune-*/.mcp.json.off; do
  553. if [[ -e "$file" ]]; then
  554. switchFile "$wanted" "${file%.off}"
  555. fi
  556. done
  557. ;;
  558. gemini) node "$tools/config.ts" extension-server "$HOME/.gemini/extensions/lagune/gemini-extension.json" "$wanted" ;;
  559. qwen) node "$tools/config.ts" extension-server "$QWEN_HOME/extensions/lagune/qwen-extension.json" "$wanted" ;;
  560. opencode) node "$tools/config.ts" opencode-tools "$XDG_CONFIG_HOME/opencode/opencode.json" "$(openCodeMajor)" "$wanted" ;;
  561. pi) switchFile "$wanted" "$PI_CODING_AGENT_DIR/npm/node_modules/lagune/lib/plugins/pi.js" ;;
  562. cursor) switchFile "$wanted" "$HOME/.cursor/plugins/local/lagune/mcp.json" ;;
  563. antigravity) switchFile "$wanted" "$HOME/.gemini/config/plugins/lagune/mcp_config.json" ;;
  564. esac
  565. saveMeasurement
  566. echo "$wanted" > "$state/mode"
  567. echo "Server $wanted. A new measurement starts, and report keeps the earlier ones. Start a new session with: bash scripts/playground/agents.sh $agent run"
  568. }
  569. runAgent() {
  570. if [[ ! -d "$project" ]]; then
  571. echo "Mount it first: bash scripts/playground/agents.sh $agent mount" >&2
  572. exit 1
  573. fi
  574. resolveBinary
  575. isolate
  576. cd "$project"
  577. if ! isProbe "$agent"; then
  578. startRegistry
  579. fi
  580. if [[ "$agent" == qwen ]] && hasByok; then
  581. export OPENAI_BASE_URL="$LAGUNE_BYOK_BASE_URL" OPENAI_API_KEY="$LAGUNE_BYOK_API_KEY" OPENAI_MODEL="$LAGUNE_BYOK_MODEL"
  582. fi
  583. if [[ "$agent" == pi && $# -eq 0 ]] && hasByok; then
  584. set -- --provider playground --model "$LAGUNE_BYOK_MODEL"
  585. fi
  586. "$binary" ${@+"$@"}
  587. }
  588. reportMeasurements() {
  589. local version file name
  590. version="$(cat "$state/pinned" 2> /dev/null || echo unknown)"
  591. for file in "$measurements"/*.jsonl; do
  592. if [[ -e "$file" ]]; then
  593. name="$(basename "$file" .jsonl)"
  594. echo "Saved when the server switched at ${name:0:2}:${name:2:2}:${name:4:2}"
  595. node "$tools/report.ts" calls "$file" "$project" "${name##*-}" "$version"
  596. echo
  597. fi
  598. done
  599. echo 'Current measurement'
  600. node "$tools/report.ts" calls "$calls" "$project" "$(cat "$state/mode" 2> /dev/null || echo on)" "$version"
  601. }
  602. report() {
  603. if [[ "$agent" == copilot ]]; then
  604. node "$tools/report.ts" probe "$probeLog" "$project" probe-plain probe-vars
  605. elif [[ "$agent" == kimi ]]; then
  606. node "$tools/report.ts" probe "$probeLog" "$project" probe-plain probe-vars probe-node
  607. else
  608. reportMeasurements
  609. fi
  610. }
  611. case "$action" in
  612. mount) mount "${1:-}" ;;
  613. run) runAgent ${@+"$@"} ;;
  614. server) switchServer "${1:-}" ;;
  615. report) report ;;
  616. *)
  617. usage
  618. exit 1
  619. ;;
  620. esac

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.