Demonstrates using a beforeAll lifecycle extension to clean and re-initialize an allagents workspace before evaluation runs, then register a project-scoped marketplace and sync plugin content.
allagents workspace init fails if .allagents/workspace.yaml already exists. In CI and repeated eval runs, stale artifacts need to be cleaned before project-scoped plugin content is synced.
A Node.js lifecycle extension exports beforeAll(context). AgentV runs it after workspace.template and workspace.repos materialize, so the extension can safely prepare local configuration without owning repo provisioning.
workspace-setup-script/
├── evals/
│ └── suite.yaml # Eval with beforeAll extension
├── plugins/
│ └── my-plugin/ # Plugin content (AGENTS + prompt)
│ ├── AGENTS.md
│ └── .github/
│ └── prompts/
│ └── summarize-repo.prompt.md
├── marketplace/
│ └── .claude-plugin/
│ └── marketplace.json
├── scripts/
│ └── workspace-setup.mjs # Lifecycle extension module
└── workspace-template/
└── .allagents/
└── workspace.yaml
Use top-level extensions for executable setup and keep repos under workspace.repos:
extensions:
- file://../scripts/workspace-setup.mjs:beforeAll
workspace:
scope: suite
template: ../workspace-template
repos:
- path: ./my-repo
repo: https://github.com/EntityProcess/agentv.git
commit: mainThe extension reads context.workspace_path and context.eval_dir, refreshes .allagents/, runs allagents workspace init, registers the local marketplace with --scope project, syncs plugins, and validates that expected artifacts exist.
Reference plugin files via type: file in test inputs to inject them into the agent's prompt:
tests:
- id: summarize-repo
input:
- role: user
content:
- type: file
value: ../plugins/my-plugin/AGENTS.md
- type: file
value: ../plugins/my-plugin/.github/prompts/summarize-repo.prompt.mdThe type: file path is resolved from the eval file's directory up to the repo root. This injects the file contents into the agent's prompt alongside any text instructions.
- AgentV copies
workspace-template/to the suite workspace. - AgentV clones
workspace.repos. - The
beforeAllextension removes stale.allagents/config and runsnpx allagents workspace init. - The extension registers the local marketplace with
--scope project. allagents workspace syncinstallsmy-plugin@workspace-setup-script-marketplace.- Required-file checks verify
AGENTS.mdand.github/prompts/summarize-repo.prompt.mdexist.
The extension handles Windows by using npx.cmd instead of npx and launches subprocesses with:
stdio: ['ignore', 'inherit', 'inherit']shell: process.platform === 'win32'