Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ bin/gstack-global-discover
.openclaw/
.hermes/
.gbrain/
.cognition/
.devin/
.context/
extension/.auth.json
# xterm assets are vendored from npm at build time; not source-of-truth.
Expand Down
25 changes: 25 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,31 @@ bun run skill:check # health dashboard for all skills
helper resolves state roots through `CLAUDE_PLUGIN_DATA` / `GSTACK_HOME` so plugin
installs work on every platform.

## Multi-agent support

gstack works with multiple AI coding agents via typed host configs in `hosts/`.
Each agent gets its own generated SKILL.md output:

| Host | Generate | Skill location |
| --- | --- | --- |
| Claude Code (default) | `bun run gen:skill-docs --host claude` | `<skill>/SKILL.md` (in-tree) |
| OpenAI Codex CLI | `bun run gen:skill-docs --host codex` | `.agents/skills/gstack-*/` |
| Factory Droid | `bun run gen:skill-docs --host factory` | `.factory/skills/gstack-*/` |
| OpenCode | `bun run gen:skill-docs --host opencode` | `.opencode/skills/gstack-*/` |
| Cursor | `bun run gen:skill-docs --host cursor` | `.cursor/skills/gstack-*/` |
| **Devin (Cognition AI)** | `bun run gen:skill-docs --host devin` | `.devin/skills/gstack-*/` |

For Devin specifically, see [`docs/DEVIN.md`](docs/DEVIN.md). Two surfaces share
the same skills:

- **Devin for Terminal CLI** (local) reads from `.devin/skills/` (project) and
`~/.config/devin/skills/` (global). Run `./setup --host devin` for global
install on your machine, or `./setup --host devin --local` from inside any
project repo to commit per-repo.
- **Devin remote/cloud sessions** clone the repo into a fresh Ubuntu VM and also
discover skills under `.devin/skills/`. The canonical commit-to-repo install is
`./setup --host devin --local` from inside your project repo.

## Key conventions

- SKILL.md files are **generated** from `.tmpl` templates. Edit the template, not the output.
Expand Down
234 changes: 234 additions & 0 deletions devin-setup/SKILL.md.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
---
name: devin-setup
preamble-tier: 1
version: 1.0.0
description: |
Devin-only one-shot setup. Registers /ship and /land-and-deploy as Devin
Playbooks for this user/org, creates an initial Knowledge Note linking the
project's ETHOS.md and AGENTS.md, and verifies that `devin_mcp` is reachable
for sub-session orchestration. Run this once per Devin workspace after
cloning a gstack-equipped repo.
Use when: "devin setup", "register playbooks", "set up gstack for devin",
"wire devin_mcp", "set up knowledge notes for this repo".
triggers:
- devin setup
- register playbooks
- setup knowledge notes
allowed-tools:
- Bash
- Read
- Grep
- Glob
---

{{PREAMBLE}}

# /devin-setup — Wire gstack into this Devin workspace

You are helping the user wire gstack into their Devin workspace. This is the
**Devin-equivalent of `/setup-gbrain`**: it ensures the cross-session memory
(Knowledge Notes) and orchestration (Playbooks, sub-sessions) are ready before
the user runs `/ship`, `/land-and-deploy`, `/review`, or any of the
review-army-style skills.

This skill is idempotent — running it again is safe and only adds missing
pieces.

## When to invoke

Run this once per Devin workspace, ideally right after `./setup --host devin --local`
generates the `.devin/skills/` tree. Repeat anytime gstack changes how it
uses Devin's MCP surface.

## Instructions

### Step 1: Verify devin_mcp is reachable

The whole skill assumes the agent has access to the `devin_mcp` tool with
`devin_session_create`, `devin_knowledge_manage`, and `devin_playbook_manage`.

Try a no-op call:

```
tool_name = "devin_knowledge_manage"
tool_args = {
"action": "list",
"first": 1
}
```

If this returns an authorization / "tool unavailable" error, stop and tell the
user: "devin_mcp is not enabled for this Devin account. Phase 2 features
(sub-session second opinions, Knowledge Notes memory, Playbook registration)
require `devin_mcp` access. Continuing without these — gstack still works,
but cross-session memory and outside-voice reviews will be no-ops."

If the call succeeds, continue.

### Step 2: Derive the repo identifier

```bash
REPO_URL=$(git config --get remote.origin.url)
REPO_SLUG=$(echo "$REPO_URL" | sed -E 's#(git@github\.com:|https?://github\.com/)##; s#\.git$##')
echo "REPO_SLUG: $REPO_SLUG"
```

Remember `$REPO_SLUG` — every Knowledge Note created by this skill will be
pinned to it.

### Step 3: Register /ship as a Devin Playbook

Read the generated /ship skill markdown:

```bash
SHIP_SKILL=".devin/skills/gstack-ship/SKILL.md"
[ -f "$SHIP_SKILL" ] || SHIP_SKILL=".agents/skills/gstack-ship/SKILL.md"
[ -f "$SHIP_SKILL" ] || SHIP_SKILL=".github/skills/gstack-ship/SKILL.md"
[ -f "$SHIP_SKILL" ] || SHIP_SKILL=".cognition/skills/gstack-ship/SKILL.md" # legacy
cat "$SHIP_SKILL" | head -1
```

If found, register as a Playbook:

```
tool_name = "devin_playbook_manage"
tool_args = {
"action": "create",
"title": "gstack: /ship",
"body": "<full markdown content of $SHIP_SKILL>",
"macro": "!ship"
}
```

Before creating, list existing playbooks via
`{"action": "list", "first": 100}` and check whether one titled exactly
`gstack: /ship` already exists. If it does, prefer
`{"action": "update", "playbook_id": "<existing>"}` over creating a duplicate
(v3 PUT is full-replace — pass the full body).

### Step 4: Register /land-and-deploy as a Devin Playbook

Same procedure as Step 3, but for `/land-and-deploy`:

```bash
LAND_SKILL=".devin/skills/gstack-land-and-deploy/SKILL.md"
[ -f "$LAND_SKILL" ] || LAND_SKILL=".agents/skills/gstack-land-and-deploy/SKILL.md"
[ -f "$LAND_SKILL" ] || LAND_SKILL=".github/skills/gstack-land-and-deploy/SKILL.md"
[ -f "$LAND_SKILL" ] || LAND_SKILL=".cognition/skills/gstack-land-and-deploy/SKILL.md" # legacy
```

Register with:

```
tool_name = "devin_playbook_manage"
tool_args = {
"action": "create",
"title": "gstack: /land-and-deploy",
"body": "<full markdown content of $LAND_SKILL>",
"macro": "!land_and_deploy"
}
```

Same dedup-check (list → update if exists) as Step 3.

### Step 5: Seed the project's Knowledge Notes

Create the first project-pinned Knowledge Note describing this repo's gstack
ETHOS, so future sessions get context on the project's design philosophy when
they start a new skill that calls Knowledge Notes load.

Read the local ETHOS file:

```bash
ETHOS_FILE="ETHOS.md"
[ -f "$ETHOS_FILE" ] || ETHOS_FILE=".devin/skills/gstack/ETHOS.md"
[ -f "$ETHOS_FILE" ] || ETHOS_FILE=".cognition/skills/gstack/ETHOS.md" # legacy
[ -f "$ETHOS_FILE" ] && head -200 "$ETHOS_FILE"
```

If ETHOS.md exists, register it as a Knowledge Note:

```
tool_name = "devin_knowledge_manage"
tool_args = {
"action": "create",
"name": "gstack: ETHOS for <REPO_SLUG>",
"body": "<full ETHOS.md content (truncate to first 30KB if larger)>\n\n---\nPinned by /devin-setup. This note describes the design philosophy that should guide all gstack skill outputs in this repo.",
"trigger": "When starting a new gstack skill in this repo, especially /office-hours, /plan-ceo-review, /investigate, or /retro.",
"pinned_repo": "<REPO_SLUG>"
}
```

Dedup check: list with `{"action": "list", "search": "ETHOS for <REPO_SLUG>", "pinned_repo": "<REPO_SLUG>"}`
and update if it exists.

If `AGENTS.md` exists in the repo, register it as a second Knowledge Note:

```
tool_name = "devin_knowledge_manage"
tool_args = {
"action": "create",
"name": "gstack: AGENTS.md for <REPO_SLUG>",
"body": "<full AGENTS.md content>",
"trigger": "When starting any gstack skill in this repo, to load the slash-command catalog and platform conventions.",
"pinned_repo": "<REPO_SLUG>"
}
```

### Step 6: Print a summary

Output exactly this block (filling in the values you observed):

```
gstack ↔ Devin wiring complete

Repo: <REPO_SLUG>
Playbooks registered:
- gstack: /ship (macro !ship, id: <playbook_id_1>)
- gstack: /land-and-deploy (macro !land_and_deploy, id: <playbook_id_2>)
Knowledge Notes seeded:
- gstack: ETHOS for <REPO_SLUG> (id: <note_id_1>)
- gstack: AGENTS.md for <REPO_SLUG> (id: <note_id_2>)
Sub-session orchestration:
- devin_session_create: REACHABLE
- devin_knowledge_manage: REACHABLE
- devin_playbook_manage: REACHABLE

Next steps:
- Run /ship (or type !ship) to land your next change.
- Run /review on any branch — it will spawn parallel review-army sub-sessions.
- Run /office-hours for product brainstorming with cross-session memory.
```

If any step failed, replace the corresponding line with `FAILED: <one-line reason>`
and continue with the rest. Setup is best-effort — partial wiring is fine.

### Step 7: (optional) Set up a recurring health check

Ask:

> Want a weekly Devin schedule that runs `/health` on this repo every Monday at 09:00?
> A) Yes, schedule weekly /health
> B) No thanks

If A, register the schedule via `devin_mcp`:

```
tool_name = "devin_schedule_manage"
tool_args = {
"action": "create",
"name": "gstack weekly /health for <REPO_SLUG>",
"prompt": "Run /health on this repo and post the result.",
"frequency": "0 9 * * 1",
"schedule_type": "recurring",
"notify_on": "failure",
"agent": "devin"
}
```

If the schedule manager is unavailable, note and continue.

## Done

Setup complete. All future gstack skills in this repo will use Knowledge Notes
for memory and sub-sessions for second-opinion reviews automatically.
Loading