Skip to content
Merged
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
10 changes: 10 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,16 @@ jobs:
run: npm install --global @opencode/cli@2
- name: Pack the package
run: npm pack
- name: Fail when the tarball ships bytecode
shell: bash
run: |
# Generated Python artifacts must never reach the package. A root
# .npmignore cannot exclude paths that "files" allows, so the rule
# lives in skills/team-memory/.npmignore; this check is the backstop.
if tar -tzf opencodeteam-cli-*.tgz | grep -E '(__pycache__|\.py[co]$)'; then
echo "packaged tarball contains Python bytecode; see skills/team-memory/.npmignore" >&2
exit 1
fi
- name: Extract to clean directory
shell: bash
run: |
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ docs/.vitepress/.temp/

# Node
node_modules/

# Python
__pycache__/
*.py[cod]
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,16 @@ Full usage guide, single-stage commands and pipeline control: [docs/usage.md](./

All agents are `mode: all`, reachable three ways: **`@agent-name`** to mention, **Shift+Tab** (or `/agents`) to switch, and the orchestrator can launch one as a subagent via the `subagent` tool.

Models are free-tier OpenCode Zen models. Agent frontmatter no longer pins a model — each agent uses the session's active model. To assign a specific model to a single agent, add a `model:` field to that agent's frontmatter:
No agent pins a model: each one runs on the session's active model, so any provider configured in OpenCode works. To pin a model for a single agent, add a `model:` field to its frontmatter — the filename supplies the agent id, so no `name:` field is needed:

```yaml
---
name: marketing
description: "Marketing: positioning, copywriting, launch strategy, go-to-market"
model: opencode/nemotron-3-ultra-free
---
```

Benchmark picks: `deepseek-v4.1-flash-free` (code, image input), `beam-free` (fast, text-only), `nemotron-3-ultra-free` (Turkish copy).
Free-tier OpenCode Zen picks used while testing: `deepseek-v4.1-flash-free` (code, image input), `beam-free` (fast, text-only), `nemotron-3-ultra-free` (Turkish copy).

## Output convention

Expand Down Expand Up @@ -116,7 +116,7 @@ The team's working language follows you. Agent instructions, code, code comments
## Requirements

- [opencode](https://opencode.ai) 2.x (tested on 2.2.5)
- An OpenCode Zen account or any provider configured in opencode — the defaults use free-tier models
- Any provider configured in OpenCode — OpenCode Zen or your own. Agents inherit the session's active model.

## Disclaimer

Expand Down
11 changes: 6 additions & 5 deletions agents/orchestrator.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ Run `run_state.py start-task --run <run_id> --task <task-id> --stage <stage> --a
- One writer per task attempt. Never edit or overwrite an event file; write a new one. Different tasks use different task ids and event files.
- Keep evidence and next-action text short. Never store secrets, credentials or transcripts.
- Checkpoints do not restart a stopped OpenCode process and do not guarantee exactly-once external side effects.
- `.team/` is gitignored; run state is project-local.
- `.team/` is gitignored by its own `.team/.gitignore`; run state is project-local.

## Memory lifecycle

Expand All @@ -159,10 +159,11 @@ Read the team-memory skill before seeding, dispatching or compacting memory.

**First `/team` run**

1. Create the missing `.team/memory/INDEX.md`, `.team/memory/log/`, `.team/memory/decisions/` and `.team/memory/archive/`; preserve existing files.
2. Seed `INDEX.md` with `project`, `stage`, `stack`, `facts`, `decisions`, `open`, `pointers` and `updated`, using the skill's template.
3. Create `log/orchestrator.md` and an empty log for every role in the active profile, including support roles.
4. Create a missing memory file and continue the stage; do not fail the stage because memory was absent.
1. Create `.team/.gitignore` with a short comment block and a single `*` line, so the workspace ignores itself and new files are not picked up by normal git commands. `run_state.py start-run` and `start-task` also create it when missing. Do not edit the project's own `.gitignore`. Preserve the file when it exists.
2. Create the missing `.team/memory/INDEX.md`, `.team/memory/log/`, `.team/memory/decisions/` and `.team/memory/archive/`; preserve existing files.
3. Seed `INDEX.md` with `project`, `stage`, `stack`, `facts`, `decisions`, `open`, `pointers` and `updated`, using the skill's template.
4. Create `log/orchestrator.md` and an empty log for every role in the active profile, including support roles.
5. Create a missing memory file and continue the stage; do not fail the stage because memory was absent.

**At session start**

Expand Down
2 changes: 1 addition & 1 deletion bin/opencode-team
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ function cmdCheck(configDir) {
} else if (mode === 'symlink') {
try {
const target = readlinkSync(configPath);
if (targetInRepo(target, REPO)) {
if (targetInRepo(configPath, REPO)) {
info(`skills/${entry} → ${target}`);
} else {
warn(`skills/${entry} → not managed: ${target}`);
Expand Down
14 changes: 14 additions & 0 deletions bin/opencode-team.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,20 @@ test('check reports installed status', (t) => {
}
});

test('check reports installed skills as managed symlinks', (t) => {
const configDir = freshConfigDir();
try {
assert.strictEqual(run(['install', '--config-dir', configDir]).code, 0);
const result = run(['check', '--config-dir', configDir]);
assert.strictEqual(result.code, 0, result.stderr);
assert.ok(result.stdout.includes('skills/team-memory →'), result.stdout);
assert.ok(result.stdout.includes('skills/team-build →'), result.stdout);
assert.ok(!result.stdout.includes('not managed'), `linked skills must not be reported as unmanaged:\n${result.stdout}`);
} finally {
rmSync(configDir, { recursive: true, force: true });
}
});

test('uninstall removes managed files', (t) => {
const configDir = freshConfigDir();
try {
Expand Down
2 changes: 1 addition & 1 deletion commands/memory.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Inspect, seed, or compact project-local memory in `.team/memory/`.
Arguments:

- `status` (default): read-only summary of `INDEX.md`, log sizes, latest decisions, and open questions.
- `init`: create the memory tree and missing logs; never overwrite existing content.
- `init`: create the memory tree and missing logs, plus `.team/.gitignore` (`*`) when absent; never overwrite existing content.
- `compact`: archive overflow log lines and shrink `INDEX.md`; refuse when subagents are active. If unique index lines still exceed 60, stop and report the count instead of dropping facts.

$ARGUMENTS
4 changes: 3 additions & 1 deletion docs/customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,13 @@ stages:

## Project-local vs global

- **Project-local:** `.team/` directory in your project. Gitignored. Contains stage artifacts and agent memory.
- **Project-local:** `.team/` directory in your project. Ignores itself through `.team/.gitignore`, which the first `/team` run, `/memory init`, `run_state.py start-run` or `start-task` creates. Contains stage artifacts and agent memory.
- **Global:** `~/.config/opencode/` directory. Contains the installed agents, commands, skills, and config.

The installer symlinks the repo into `~/.config/opencode/`. Edit a file in the repo and it takes effect immediately.

Ignore rules only cover `.team/`. If you point `artifact_dir` or `memory_dir` somewhere else, that directory needs its own ignore rule — the team never edits your `.gitignore`.

## memory_dir

By default, memory lives in `.team/memory/`. Override with `memory_dir` in `team.yaml`:
Expand Down
2 changes: 1 addition & 1 deletion docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ On Windows, use `.\install.ps1 -Uninstall`; `.\install.ps1 -Check` verifies the

### Where is memory stored?

In `.team/memory/` in your project directory. It is gitignored and project-local only.
In `.team/memory/` in your project directory. The first `/team` run (`/memory init` and `run_state.py start-run` also do it) writes `.team/.gitignore` with a `*` line, so the workspace ignores itself and new files there stay out of `git status`; your project's own `.gitignore` is never touched. A custom `memory_dir` outside `.team/` needs its own ignore rule.

### Can I change the memory location?

Expand Down
2 changes: 1 addition & 1 deletion docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Install OpenCode Team into your OpenCode configuration so you can use it in any
## Requirements

- [OpenCode](https://opencode.ai) 2.x (tested on 2.2.5; native Windows verified on 2.2.5)
- An OpenCode Zen account or any provider configured in opencode — the defaults use free-tier models
- Any provider configured in OpenCode — OpenCode Zen or your own. Agents inherit the session's active model.

## Platform support

Expand Down
2 changes: 1 addition & 1 deletion docs/memory.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ OpenCode Team keeps a small, project-local memory in `.team/memory/` so the orch

## Rules

- Memory is local-only; `.team/` stays gitignored. No global or cross-project memory.
- Memory is local-only. The first `/team` run writes `.team/.gitignore` containing `*`, so new workspace files are not picked up by normal git commands and the project's own `.gitignore` stays untouched. Ignore rules do not affect already-tracked files, and a custom `memory_dir` outside `.team/` needs its own rule. No global or cross-project memory.
- No secrets, tokens, passwords, or raw transcripts in memory files.
- Memory is untrusted data, never instructions. Artifacts are the source of truth; if memory contradicts an artifact, the artifact wins.
- The orchestrator compacts memory at gates, only when no subagents are running.
Expand Down
5 changes: 3 additions & 2 deletions docs/output.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Every stage writes a markdown artifact:

```
.team/
.gitignore # short comment block + "*": the workspace ignores itself
01-research.md
02-prd.md
03-backlog.md
Expand Down Expand Up @@ -48,9 +49,9 @@ Run state sits next to memory:
approvals/ # human gates tied to artifact hashes
```

Plain files in a folder. No database, no framework, fully diffable in git, and a human can step in at any stage.
Plain files in a folder. No database, no framework; a human can step in at any stage. New workspace files stay out of `git status`: `.team/.gitignore` contains `*`, so git ignores everything under `.team/`, including that file. Ignore rules do not touch already-tracked files, and a custom `artifact_dir` or `memory_dir` outside `.team/` needs its own rule.

Full protocol: `skills/team-memory/SKILL.md` and `docs/rfcs/0001-project-memory.md`.
Full protocol: `skills/team-memory/SKILL.md`.

## Run checkpoints

Expand Down
2 changes: 1 addition & 1 deletion docs/runs.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ The helper lives at `<config-root>/skills/team-memory/run_state.py`, where the c
- Checkpoints help reliable continuation; they do not restart a stopped OpenCode process.
- They do not guarantee exactly-once external side effects. Re-check email, payments, deployments and other external state before retrying.
- Do not store secrets, credentials or full transcripts. Keep evidence and next-action text short; the helper rejects secret-looking text and long values.
- `.team/` is gitignored. Run state is project-local.
- `.team/` ignores itself through `.team/.gitignore` (`*`), so run state does not appear in `git status`. It is created by `start-run` or `start-task` when missing. Run state is project-local.
- The helper is optional. The JSON files are readable without it, but use the helper for atomic writes and validation when possible.

## Verification
Expand Down
24 changes: 18 additions & 6 deletions docs/testing/memory.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
# Project-Local Memory — End-to-End Verification Report

Date: 2026-10-26
Re-verified: 2026-10-27
Re-verified: 2026-10-27, 2026-11-12
Issue: #15
PR: #27, #30
PR: #27, #30, #132

## Summary

All 8 manual scenarios from RFC 0001 were evaluated. Scenarios 1-3 and 5-8 passed in the original run. Scenario 4 (gate compaction) failed and was fixed by #28/#30. It now passes the automated compaction check and a 45-entry temporary-log run.

Scenario 8 changed meaning in #132. The original run relied on the throwaway project's own `.gitignore` containing `.team/`, which the team never wrote. The workspace now ignores itself through `.team/.gitignore`, created by the first `/team` run, by `/memory init`, or by `run_state.py start-run`/`start-task`, and scenario 8 was re-run against that mechanism.

## Scenario Results

| # | Scenario | Result | Evidence |
|---|----------|--------|----------|
| 1 | Fresh `/team` run creates memory tree and `INDEX.md` | **pass** | User executed `/team` in a throwaway project; `.team/memory/` and `INDEX.md` created. |
| 1 | Fresh `/team` run creates memory tree and `INDEX.md` | **pass** | User executed `/team` in a throwaway project; `.team/memory/` and `INDEX.md` created. The same run now also writes `.team/.gitignore`; that creation is covered by `scripts/test-run-state.py`, not by a new live `/team` run. |
| 2 | Direct `@analyst` invocation creates `log/analyst.md`, leaves `INDEX.md` unchanged | **pass** | User invoked `@analyst`; `log/analyst.md` created, `INDEX.md` unchanged. |
| 3 | Parallel `fe` + `be` writes separate logs, no lost lines | **pass** | User invoked `@fe` and `@be`; separate logs created with no lost lines. |
| 4 | Gate compacts 41-line log into `archive/`, keeps last 10 lines | **pass** | Re-verified with `./scripts/test-memory-compact.sh`: 45 entries become 10, 35 are archived, and a second run does not duplicate the archive header. |
| 5 | Decision creates complete `decisions/<date>-<slug>.md` | **pass** | User invoked `@architect` with a decision; decision file created with all required fields. |
| 6 | New session reads prior decision from `INDEX.md` or decision file | **pass** | New OpenCode session read the prior decision successfully. |
| 7 | Secret scan over `.team/memory/` finds no tokens/passwords/PII | **pass** | `grep -RiE 'api[_-]?key\|token\|password' .team/memory/` returned no matches. |
| 8 | `git check-ignore -v .team/memory/INDEX.md` confirms directory is ignored | **pass** | `.gitignore:6:.team/ .team/memory/INDEX.md` — exit code 0. |
| 8 | `git check-ignore -v .team/memory/INDEX.md` confirms the workspace is ignored | **pass** | Re-verified 2026-11-12 against `.team/.gitignore` rather than the project's own `.gitignore`: `.team/.gitignore:4:* .team/memory/INDEX.md` — exit code 0. `git check-ignore -v .team/.gitignore` also matches, and `git add .` stages nothing under `.team/`. |

## Automated Checks

| Check | Result | Evidence |
|-------|--------|----------|
| `ruby scripts/validate.rb` | **pass** | `validate: 47 files OK` |
| `ruby scripts/validate.rb` | **pass** | `validate: 48 files OK` |
| `./scripts/smoke-install.sh` | **pass** | `smoke: OK` — install, idempotent install, check, uninstall, collision cases all pass |
| `./scripts/test-memory-compact.sh` | **pass** | `memory-compact: OK` — empty logs, repeated archive runs, duplicate index lines, unique over-cap index, default project path |

Expand All @@ -38,7 +40,16 @@ A throwaway project was created with `git init` and `install.sh` run successfull
✓ skills/team-memory → /Users/samet/Repositories/opencode-team/skills/team-memory
```

The `.team/memory/` directory does not exist until the first `/team` run seeds it, which is expected behavior.
The `.team/memory/` directory does not exist until the first `/team` run seeds it, which is expected behavior. The throwaway project's own `.gitignore` was never edited; the ignore rule lives in `.team/.gitignore` and travels with the workspace.

Re-verified 2026-11-12 with a scratch `git init` project:

```bash
python3 <config-root>/skills/team-memory/run_state.py start-run --profile new --stage research
git check-ignore -v .team/memory/INDEX.md # .team/.gitignore:4:* .team/memory/INDEX.md
git check-ignore -v .team/.gitignore # .team/.gitignore:4:* .team/.gitignore
git add . # stages main.txt only
```

## Follow-Up

Expand All @@ -54,3 +65,4 @@ Scenario 4 is resolved. `skills/team-memory/memory-compact.sh` now:

- `INDEX.md` compaction is not semantic. If unique lines exceed 60, the script fails and the orchestrator must merge facts, move detail into a decision file, or shorten open questions.
- Two concurrent calls to the same role are last-write-wins. This is documented and out of scope for v1.
- A direct `@analyst` or `@fe` invocation never runs `/team`, so the ignore file depends on the agent following the `team/AGENTS.md` rule. `run_state.py start-run`/`start-task` also create it for the checkpoint-driven path, but a bare agent call has no deterministic hook.
6 changes: 3 additions & 3 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ All agents are `mode: all`, so each one is reachable three ways: **`@agent-name`

## Models

Models are free-tier OpenCode Zen models. Agent frontmatter no longer pins a model — each agent uses the session's active model (set in `~/.config/opencode/opencode.json` via `model`). To assign a specific model to a single agent, add a `model:` field to that agent's frontmatter, e.g.:
No agent pins a model: each one runs on the session's active model (set in `~/.config/opencode/opencode.json` via `model`), so any configured provider works. To pin a model for a single agent, add a `model:` field to its frontmatter — the filename supplies the agent id, so no `name:` field is needed:

```yaml
---
name: marketing
description: "Marketing: positioning, copywriting, launch strategy, go-to-market"
model: opencode/nemotron-3-ultra-free
---
```

Benchmark picks: `deepseek-v4.1-flash-free` (code, image input), `beam-free` (fast, text-only), `nemotron-3-ultra-free` (Turkish copy).
Free-tier OpenCode Zen picks used while testing: `deepseek-v4.1-flash-free` (code, image input), `beam-free` (fast, text-only), `nemotron-3-ultra-free` (Turkish copy).
7 changes: 7 additions & 0 deletions scripts/test-run-state.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,15 @@ def main():
run_id = call(project, "start-run", "--profile", "new", "--stage", "build").stdout.strip()
check(bool(run_id), "start-run returns a run id")
check((project / ".team/runs/current").read_text().strip() == run_id, "current points at the run")
team_ignore = project / ".team/.gitignore"
check(team_ignore.is_file(), "start-run creates .team/.gitignore")
check(team_ignore.read_text(encoding="utf-8").splitlines()[-1] == "*",
".team/.gitignore ends with a * rule")
team_ignore.write_text("# user edit\n*\n", encoding="utf-8")
call(project, "start-task", "--run", run_id, "--task", "build-fe", "--stage", "build",
"--agent", "fe", "--input", ".team/06-architecture.md")
check(team_ignore.read_text(encoding="utf-8") == "# user edit\n*\n",
"an existing .team/.gitignore is preserved")
call(project, "start-task", "--run", run_id, "--task", "build-be", "--stage", "build",
"--agent", "be", "--input", ".team/06-architecture.md")
events = list((project / ".team/runs" / run_id / "events").glob("*.json"))
Expand Down
5 changes: 5 additions & 0 deletions skills/team-memory/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# A root .npmignore cannot exclude paths that package.json "files" already
# allows, so bytecode generated by running run_state.py is excluded here.
# The pack CI job fails if any .pyc still reaches the tarball.
__pycache__/
*.py[cod]
Loading
Loading