Răsfoiți Sursa

Merge pull request #462 from alvinunreal/clonedeps

Add clonedeps skill
Alvin 3 luni în urmă
părinte
comite
a28636ba52

+ 4 - 0
.gitignore

@@ -82,3 +82,7 @@ wheels/
 .installed.cfg
 *.egg
 captures/
+
+# BEGIN oh-my-opencode-slim clonedeps
+.slim/clonedeps/repos/
+# END oh-my-opencode-slim clonedeps

+ 33 - 0
.slim/clonedeps.json

@@ -0,0 +1,33 @@
+{
+  "version": "1.0.0",
+  "updatedAt": "2026-05-12T00:00:00.000Z",
+  "dependencies": [
+    {
+      "name": "@opencode-ai/plugin",
+      "resolvedVersion": "1.4.3",
+      "repoUrl": "https://github.com/opencode-ai/opencode.git",
+      "ref": "main@73ee493265acf15fcd8caab2bc8cd3bd375b63cb",
+      "path": ".slim/clonedeps/repos/opencode-ai__opencode",
+      "packagePath": "packages/plugin",
+      "reason": "Core plugin lifecycle and hook API used by the orchestration plugin."
+    },
+    {
+      "name": "@opencode-ai/sdk",
+      "resolvedVersion": "1.4.3",
+      "repoUrl": "https://github.com/opencode-ai/opencode.git",
+      "ref": "main@73ee493265acf15fcd8caab2bc8cd3bd375b63cb",
+      "path": ".slim/clonedeps/repos/opencode-ai__opencode",
+      "packagePath": "packages/sdk/js",
+      "reason": "SDK types and runtime client/session/message shapes used across agents, hooks, tools, and council code."
+    },
+    {
+      "name": "@modelcontextprotocol/sdk",
+      "resolvedVersion": "1.29.0",
+      "repoUrl": "https://github.com/modelcontextprotocol/typescript-sdk.git",
+      "ref": "v1.29.0@e12cbd7078db388152f6e839abdbe09ba01f3f32",
+      "path": ".slim/clonedeps/repos/modelcontextprotocol__typescript-sdk",
+      "packagePath": ".",
+      "reason": "MCP protocol/server implementation details used by built-in MCP integrations."
+    }
+  ]
+}

+ 8 - 0
AGENTS.md

@@ -259,3 +259,11 @@ Before working on any task, read `codemap.md` to understand:
 - Data flow and integration points between modules
 
 For deep work on a specific folder, also read that folder's `codemap.md`.
+
+## Cloned Dependency Source
+
+Read-only dependency source repositories are available under
+`.slim/clonedeps/repos/` for inspection. Do not edit these clones.
+
+- `.slim/clonedeps/repos/opencode-ai__opencode/` — `https://github.com/opencode-ai/opencode.git` at `main@73ee493265acf15fcd8caab2bc8cd3bd375b63cb`; inspect `packages/plugin` and `packages/sdk/js` for OpenCode plugin and SDK internals.
+- `.slim/clonedeps/repos/modelcontextprotocol__typescript-sdk/` — `https://github.com/modelcontextprotocol/typescript-sdk.git` at `v1.29.0@e12cbd7078db388152f6e839abdbe09ba01f3f32`; inspect it for MCP protocol and server integration internals.

+ 2 - 1
README.md

@@ -492,6 +492,7 @@ Use this section as a map: start with installation, then jump to features, confi
 | **[Preset Switching](docs/preset-switching.md)** | Switch agent model presets at runtime with `/preset` |
 | **[Subtask](docs/subtask.md)** | Run a bounded child worker with `/subtask` and return a structured summary to the main session |
 | **[Codemap](docs/codemap.md)** | Generate hierarchical codemaps to understand large codebases faster |
+| **[Clonedeps](docs/clonedeps.md)** | Clone selected dependency source into an ignored local workspace for inspection |
 | **[Interview](docs/interview.md)** | Turn rough ideas into a structured markdown spec through a browser-based Q&A flow |
 | **[Divoom Display](docs/divoom.md)** | Mirror orchestrator and specialist-agent activity to a Divoom MiniToo Bluetooth display |
 
@@ -501,7 +502,7 @@ Use this section as a map: start with installation, then jump to features, confi
 |-----|----------------|
 | **[Configuration](docs/configuration.md)** | Config file locations, JSONC support, prompt overrides, and full option reference |
 | **[Maintainer Guide](docs/maintainers.md)** | Issue triage rules, label meanings, support routing, and repo maintenance workflow |
-| **[Skills](docs/skills.md)** | Built-in and recommended skills such as `simplify`, `agent-browser`, and `codemap` |
+| **[Skills](docs/skills.md)** | Built-in and recommended skills such as `simplify`, `agent-browser`, `codemap`, and `clonedeps` |
 | **[MCPs](docs/mcps.md)** | `websearch`, `context7`, `grep_app`, and how MCP permissions work per agent |
 | **[Tools](docs/tools.md)** | Built-in tool capabilities like `webfetch`, LSP tools, code search, and formatters |
 

+ 1 - 0
codemap.md

@@ -50,6 +50,7 @@ This codemap intentionally covers the plugin repository itself and excludes the
 | `src/multiplexer/zellij/` | zellij backend implementation for tab/pane lifecycle. | [View Map](src/multiplexer/zellij/codemap.md) |
 | `src/skills/` | Bundled install-time OpenCode skills shipped as static payloads. | [View Map](src/skills/codemap.md) |
 | `src/skills/codemap/` | Repository-mapping skill package and codemap state-management script. | [View Map](src/skills/codemap/codemap.md) |
+| `src/skills/clonedeps/` | Workflow-only dependency source mirroring skill that routes discovery/ref resolution through librarian and direct orchestrator git operations. | [View Map](src/skills/clonedeps/codemap.md) |
 | `src/skills/simplify/` | Behavior-preserving simplification skill package. | [View Map](src/skills/simplify/codemap.md) |
 | `src/tools/` | Tool and runtime-command export surface for AST-grep, smartfetch, council orchestration, and `/preset` switching. | [View Map](src/tools/codemap.md) |
 | `src/tools/ast-grep/` | AST-grep binary management and AST-aware search/replace tool flow. | [View Map](src/tools/ast-grep/codemap.md) |

+ 147 - 0
docs/clonedeps.md

@@ -0,0 +1,147 @@
+# Clonedeps
+
+`clonedeps` is a bundled Orchestrator skill for cloning a small set of important
+dependency source repositories into a local, ignored workspace so agents can
+inspect library internals while working on your project.
+
+It is useful when docs are not enough and the agent needs to understand how a
+runtime, SDK, framework, plugin API, or other core dependency actually behaves.
+
+---
+
+## What It Does
+
+When you ask for cloned dependency source, the Orchestrator:
+
+1. Checks `.slim/clonedeps.json` first and reuses existing clones when possible.
+2. Asks `@librarian` for source-repo recommendations only if more context is
+   needed.
+3. Presents a small clone plan for approval.
+4. Clones each approved source repository once into
+   `.slim/clonedeps/repos/<safe-repo-name>/`.
+5. Writes `.slim/clonedeps.json` as trackable project metadata.
+6. Updates ignore files so git ignores clone contents while OpenCode can read
+   them.
+7. Updates root `AGENTS.md` with a concise list of cloned repos and why each one
+   exists.
+
+There is intentionally no helper script. The workflow uses agent judgment for
+source selection and normal git/filesystem operations for cloning.
+
+---
+
+## How To Use It
+
+Ask the Orchestrator directly:
+
+```text
+Use clonedeps to clone the key dependency source repos for this project.
+```
+
+Or for a specific dependency/debugging task:
+
+```text
+Use clonedeps for the OpenCode SDK so you can inspect its plugin API internals.
+```
+
+The Orchestrator should show you what it wants to clone before running network
+git operations, unless you explicitly ask it to clone immediately.
+
+---
+
+## Files It Creates
+
+### `.slim/clonedeps/repos/`
+
+Ignored local clones live here, one folder per source repository:
+
+```text
+.slim/clonedeps/repos/<safe-repo-name>/
+```
+
+The safe folder name is derived from the repository owner/name, not the package
+name. For example, `https://github.com/opencode-ai/opencode.git` becomes
+`.slim/clonedeps/repos/opencode-ai__opencode/`.
+
+If multiple packages come from the same monorepo, they share one cloned repo path
+and use different `packagePath` values in the manifest.
+
+These repositories are read-only reference source. Do not edit them.
+
+### `.slim/clonedeps.json`
+
+This is the structured manifest. It is intentionally small and committable:
+
+```json
+{
+  "version": "1.0.0",
+  "updatedAt": "2026-05-12T00:00:00.000Z",
+  "dependencies": [
+    {
+      "name": "@opencode-ai/plugin",
+      "resolvedVersion": "1.3.17",
+      "repoUrl": "https://github.com/opencode-ai/opencode.git",
+      "ref": "v1.3.17",
+      "path": ".slim/clonedeps/repos/opencode-ai__opencode",
+      "packagePath": "packages/plugin",
+      "reason": "Plugin API source used by the project"
+    },
+    {
+      "name": "@opencode-ai/sdk",
+      "resolvedVersion": "1.3.17",
+      "repoUrl": "https://github.com/opencode-ai/opencode.git",
+      "ref": "v1.3.17",
+      "path": ".slim/clonedeps/repos/opencode-ai__opencode",
+      "packagePath": "packages/sdk/js",
+      "reason": "Core SDK source used to inspect runtime behavior"
+    }
+  ]
+}
+```
+
+Future clonedeps runs read this file first instead of starting from a fresh scan.
+
+### `AGENTS.md`
+
+The skill also keeps a short `## Cloned Dependency Source` section in the repo
+root `AGENTS.md`, listing the cloned repo paths directly so future agents do not
+need to read the manifest just to know what exists.
+
+Example:
+
+```markdown
+## Cloned Dependency Source
+
+Read-only dependency source repositories are available under
+`.slim/clonedeps/repos/` for inspection. Do not edit these clones.
+
+- `.slim/clonedeps/repos/opencode-ai__opencode/` — `opencode-ai/opencode` at
+  `v1.3.17`; inspect `packages/sdk/js` for OpenCode SDK internals.
+```
+
+---
+
+## Safety Defaults
+
+- Prefer **0-3 strong recommendations** over a dependency dump.
+- Clone at most **3-5 core dependencies** by default.
+- Use HTTPS repository URLs by default.
+- Prefer pinned tags or commit SHAs.
+- Do not run install, build, test, or lifecycle scripts from cloned repos.
+- Git ignores `.slim/clonedeps/repos/`, but not `.slim/clonedeps.json`.
+- Ignore-file edits are limited to managed clonedeps marker blocks.
+
+---
+
+## When To Use It
+
+Use clonedeps when source code is likely to answer questions better than docs:
+
+- debugging SDK or framework behavior;
+- implementing against plugin/runtime APIs;
+- checking version-specific internals;
+- understanding generated types, adapters, or protocol code;
+- working with dependencies whose docs are incomplete or stale.
+
+Do not use it for ordinary documentation lookup, tiny utilities, transitive
+dependencies, or packages where public docs are sufficient.

+ 34 - 0
docs/skills.md

@@ -20,6 +20,7 @@ Skills are installed via the `oh-my-opencode-slim` installer or manually with `n
 |-------|-------------|----------------------|
 | [`simplify`](#simplify) | Behavior-preserving code simplification | `oracle` |
 | [`codemap`](#codemap) | Repository codemap generation | `orchestrator` |
+| [`clonedeps`](#clonedeps) | Local dependency source cloning | `orchestrator` |
 
 ---
 
@@ -61,6 +62,39 @@ See **[Codemap Skill](codemap.md)** for full documentation including manual comm
 
 ---
 
+## clonedeps
+
+**Local source mirroring for important project dependencies.**
+
+`clonedeps` helps the Orchestrator clone a small, approved set of dependency
+source repositories into `.slim/clonedeps/repos/` so OpenCode can inspect library
+internals while keeping cloned code out of git.
+
+The skill is assigned to `orchestrator`. The orchestrator may ask `@librarian`
+to identify important dependencies and resolve official repository URLs/tags,
+then asks for approval before cloning with direct git/filesystem operations.
+There is intentionally no helper script; dependency discovery and ref validation
+are handled by the orchestrator/librarian workflow so the skill works across
+languages and repository types.
+
+Before planning, the orchestrator checks `.slim/clonedeps.json` and reuses
+existing clones when possible. After cloning, it adds or updates a concise
+`## Cloned Dependency Source` section in root `AGENTS.md` that lists each
+read-only cloned repo path directly with a one-sentence purpose.
+
+Safety defaults:
+
+- direct, important dependencies only;
+- max 3-5 clones by default;
+- HTTPS repositories only;
+- pinned tags/commits only;
+- no dependency scripts are executed;
+- ignore-file edits are limited to managed marker blocks.
+
+See **[Clonedeps](clonedeps.md)** for the full workflow and file layout.
+
+---
+
 ## Skills Assignment
 
 Control which skills each agent can use in `~/.config/opencode/oh-my-opencode-slim.json` (or `.jsonc`):

+ 1 - 0
scripts/verify-release-artifact.ts

@@ -40,6 +40,7 @@ const packagedRequiredFiles = [
   'oh-my-opencode-slim.schema.json',
   'src/skills/simplify/SKILL.md',
   'src/skills/codemap/SKILL.md',
+  'src/skills/clonedeps/SKILL.md',
 ];
 
 function fail(message: string): never {

+ 3 - 1
src/agents/index.test.ts

@@ -236,7 +236,7 @@ describe('per-model variant in array config', () => {
 });
 
 describe('skill permissions', () => {
-  test('orchestrator gets codemap skill allowed by default', () => {
+  test('orchestrator gets command-style bundled skills allowed by default', () => {
     const agents = createAgents();
     const orchestrator = agents.find((a) => a.name === 'orchestrator');
     expect(orchestrator).toBeDefined();
@@ -247,6 +247,7 @@ describe('skill permissions', () => {
     expect(skillPerm?.['*']).toBe('allow');
     // CUSTOM_SKILLS loop must also add a named codemap entry for orchestrator
     expect(skillPerm?.codemap).toBe('allow');
+    expect(skillPerm?.clonedeps).toBe('allow');
   });
 
   test('fixer does not get codemap skill allowed by default', () => {
@@ -256,6 +257,7 @@ describe('skill permissions', () => {
     const skillPerm = (fixer?.config.permission as Record<string, unknown>)
       ?.skill as Record<string, string>;
     expect(skillPerm?.codemap).not.toBe('allow');
+    expect(skillPerm?.clonedeps).not.toBe('allow');
   });
 
   test('oracle gets requesting-code-review skill allowed by default', () => {

+ 6 - 0
src/cli/custom-skills.ts

@@ -40,6 +40,12 @@ export const CUSTOM_SKILLS: CustomSkill[] = [
     allowedAgents: ['orchestrator'],
     sourcePath: 'src/skills/codemap',
   },
+  {
+    name: 'clonedeps',
+    description: 'Clone important dependency source for local inspection',
+    allowedAgents: ['orchestrator'],
+    sourcePath: 'src/skills/clonedeps',
+  },
 ];
 
 /**

+ 3 - 0
src/cli/skills.test.ts

@@ -20,6 +20,9 @@ describe('skills permissions', () => {
     // Oracle should have simplify allowed by default
     const oraclePerms = getSkillPermissionsForAgent('oracle');
     expect(oraclePerms.simplify).toBe('allow');
+
+    const orchestratorPerms = getSkillPermissionsForAgent('orchestrator');
+    expect(orchestratorPerms.clonedeps).toBe('allow');
   });
 
   it('should honor explicit skill list overrides', () => {

+ 23 - 0
src/skills/clonedeps/README.md

@@ -0,0 +1,23 @@
+# clonedeps
+
+`clonedeps` is a bundled OpenCode workflow skill for cloning a small set of
+important dependency source repositories into a local ignored workspace so agents
+can read library internals.
+
+It is orchestrator-owned. The orchestrator delegates source discovery and URL/ref
+resolution to `@librarian`, asks for approval, then performs the git and
+filesystem operations directly.
+
+There is intentionally no helper script. Dependency discovery, ref validation,
+and cloning are repo-specific enough that the orchestrator/librarian workflow is
+safer than a brittle cross-ecosystem script.
+
+Cloned repositories live under `.slim/clonedeps/repos/<safe-repo-name>/`, one
+folder per source repository, and are ignored by git. `.slim/clonedeps.json` is
+intentionally trackable project
+metadata. After cloning, the orchestrator should add or update a concise
+`## Cloned Dependency Source` section in root `AGENTS.md` that lists each
+read-only cloned repo path directly with a one-sentence purpose.
+
+If `.slim/clonedeps.json` already exists, read it first and reuse those clones
+before asking `@librarian` for new recommendations.

+ 237 - 0
src/skills/clonedeps/SKILL.md

@@ -0,0 +1,237 @@
+---
+name: clonedeps
+description: Clone important project dependency source code into an ignored local workspace so OpenCode can inspect library internals. Use when the user asks to clone dependencies, inspect dependency/source internals, understand SDK/framework behavior from source, debug library implementation details, or make core dependency repos locally readable. Do not use for ordinary API/docs questions where @librarian is enough.
+---
+
+# Clonedeps Skill
+
+You help users make a small set of important dependency source repositories
+locally readable to OpenCode.
+
+This is a workflow skill, not a command wrapper. Do not use a helper script for
+dependency detection, ref validation, cloning, status, or cleanup. The
+orchestrator and `@librarian` do the repo-specific thinking; the orchestrator
+performs the approved filesystem/git operations directly.
+
+## Workflow
+
+### Step 1: Check Existing State
+
+First check whether `.slim/clonedeps.json` exists.
+
+If it exists:
+
+1. Read it before asking librarian for a new plan.
+2. Check whether each listed `path` exists under `.slim/clonedeps/repos/`.
+3. Reuse existing cloned repos when they already satisfy the user's task.
+4. Only ask librarian for new recommendations if the existing manifest is
+   missing, stale, or insufficient for the current task.
+
+Do not rescan/re-plan from scratch when the manifest already has useful entries.
+
+### Step 2: Ask Librarian for the Clone Plan
+
+Delegate dependency discovery and source resolution to `@librarian`.
+
+Use this prompt:
+
+```md
+Understand this project first, then recommend remote source repos that would
+help a developer work on it.
+
+Read enough of the current repo to understand:
+- what the project does
+- its main architecture
+- the important integration points
+- what external systems or libraries it depends on in practice
+
+Think like a developer trying to debug or extend this project.
+
+Which remote repositories, if cloned locally, would actually help understand the
+codebase or solve likely implementation/debugging tasks?
+
+Do not make a dependency dump. Most dependencies are not worth cloning.
+Recommend a repo only when its source code would be more useful than docs or the
+current repo alone.
+
+For each recommendation, include:
+- repo name
+- repo URL
+- suggested ref/tag/commit if known
+- why cloning this source would help
+- when it would be useful
+- caveats
+
+Also include:
+- current-repo files/folders to inspect first
+- repos/dependencies you considered but would not clone
+
+Keep it small. Prefer 0–3 strong recommendations over 5 weak ones. If nothing
+clearly needs cloning, say so.
+```
+
+Librarian should return a small plan with:
+
+- dependency name;
+- current version/range if discoverable;
+- official source repository URL;
+- tag/commit/ref to check out;
+- package subdirectory if the source is a monorepo;
+- reason local source helps;
+- caveats such as huge repo, missing tag, or uncertain version mapping.
+
+Prefer at most 3-5 core dependencies. Include user-mentioned dependencies and
+central frameworks, SDKs, ORMs, runtime/plugin APIs, or build/runtime tools. Do
+not clone tiny utilities, transitive dependencies, or dev-only tools unless they
+are directly relevant to the active task.
+
+### Step 3: Verify and Confirm the Plan
+
+The orchestrator owns final approval. Before cloning:
+
+1. Verify refs manually where possible with `git ls-remote`.
+2. Prefer pinned tags or commit SHAs. If no exact tag exists, ask librarian to
+   find the correct module-specific tag/commit or explain the fallback.
+3. Only use HTTPS GitHub/GitLab-style repository URLs by default. Reject
+   `file://`, SSH URLs, local paths, URLs with embedded credentials, and private
+   or auth-required repositories unless the user explicitly approves that case.
+4. Present the plan to the user with dependency, repo URL, ref, reason, and
+   caveats.
+5. Ask for confirmation before network cloning unless the user explicitly asked
+   to clone immediately.
+
+### Step 4: Clone Sources Manually
+
+Create one folder per source repository under:
+
+```text
+.slim/clonedeps/repos/<safe-repo-name>/
+```
+
+Derive the safe name from the repository owner/name, not from the package name.
+For example, `https://github.com/opencode-ai/opencode.git` becomes
+`opencode-ai__opencode`. Replace `/` with `__`, strip common `.git` suffixes,
+and replace other unsafe path characters with `_`.
+
+If multiple packages come from the same monorepo, clone the repository once and
+point each manifest entry at the same repo path with different `packagePath`
+values as needed. Do not create ecosystem folders, per-package clone folders, or
+per-version folders. If two different source repositories normalize to the same
+safe name, disambiguate manually and record the chosen path in
+`.slim/clonedeps.json`.
+
+Clone/fetch with normal git commands. For an existing clone, first verify that
+`git remote get-url origin` matches the approved repo URL. If it does not match,
+stop and ask whether to clean/reclone.
+
+Safe manual git pattern:
+
+1. `git ls-remote <repoUrl> <ref>` to verify the ref where practical.
+2. Clone without submodules/recursive behavior.
+3. Prefer shallow fetch/clone where practical.
+4. Clone into a temporary directory under `.slim/clonedeps/repos/`, then move it
+   into the final safe-name path after checkout succeeds.
+5. Remove failed temporary clones.
+
+Do not run dependency install/build/test scripts from cloned repositories.
+
+### Step 5: Write Local State
+
+Write `.slim/clonedeps.json` so future agents know what exists:
+
+```json
+{
+  "version": "1.0.0",
+  "updatedAt": "2026-05-12T00:00:00.000Z",
+  "dependencies": [
+    {
+      "name": "@opencode-ai/plugin",
+      "resolvedVersion": "1.3.17",
+      "repoUrl": "https://github.com/opencode-ai/opencode.git",
+      "ref": "v1.3.17",
+      "path": ".slim/clonedeps/repos/opencode-ai__opencode",
+      "packagePath": "packages/plugin",
+      "reason": "Plugin API source used by the project"
+    },
+    {
+      "name": "@opencode-ai/sdk",
+      "resolvedVersion": "1.3.17",
+      "repoUrl": "https://github.com/opencode-ai/opencode.git",
+      "ref": "v1.3.17",
+      "path": ".slim/clonedeps/repos/opencode-ai__opencode",
+      "packagePath": "packages/sdk/js",
+      "reason": "Core SDK source used to inspect runtime behavior"
+    }
+  ]
+}
+```
+
+If a clone fails after earlier clones succeeded, still write state for the
+successful clones so future inspection is not misleading.
+
+Do not add `.slim/clonedeps.json` to `.gitignore`. It is small, reviewable
+project metadata that can be committed. Only the cloned repository contents
+under `.slim/clonedeps/repos/` should be ignored.
+
+### Step 6: Update Ignore Files
+
+Update `.gitignore` with an idempotent marker block:
+
+```gitignore
+# BEGIN oh-my-opencode-slim clonedeps
+.slim/clonedeps/repos/
+# END oh-my-opencode-slim clonedeps
+```
+
+Update `.ignore` so OpenCode can read the cloned source while git still ignores
+it:
+
+```ignore
+# BEGIN oh-my-opencode-slim clonedeps
+!.slim/
+!.slim/clonedeps.json
+!.slim/clonedeps/
+!.slim/clonedeps/repos/
+!.slim/clonedeps/repos/**
+.slim/clonedeps/repos/**/.git/
+.slim/clonedeps/repos/**/.git/**
+# END oh-my-opencode-slim clonedeps
+```
+
+Only edit content inside these marker blocks.
+
+### Step 7: Register Dependency Source in AGENTS.md
+
+After successful cloning, update the repository root `AGENTS.md` so future
+agents know why the dependency source exists and where to look.
+
+If `AGENTS.md` already has a `## Cloned Dependency Source` section, update that
+section. Otherwise append this section:
+
+Use this format and list the actual repos directly. Keep each item to one short
+sentence so future agents do not need an extra read just to know what is there:
+
+```markdown
+## Cloned Dependency Source
+
+Read-only dependency source repositories are available under
+`.slim/clonedeps/repos/` for inspection. Do not edit these clones.
+
+- `.slim/clonedeps/repos/<safe-name>/` — `<repo>` at `<ref>`; <one sentence on
+  why this source is useful>.
+- `.slim/clonedeps/repos/<safe-name-2>/` — `<repo>` at `<ref>`; <one sentence on
+  why this source is useful>.
+```
+
+Also keep `.slim/clonedeps.json` updated as the structured manifest, but do not
+make agents read it for the basic repo list.
+
+## Cleanup
+
+When the user asks to clean cloned dependencies, remove:
+
+- `.slim/clonedeps/repos/`
+- the managed clonedeps marker blocks from `.gitignore` and `.ignore`
+
+Ask before removing `.slim/clonedeps.json` or the `AGENTS.md` section because
+they may be intentional project metadata.

+ 41 - 0
src/skills/clonedeps/codemap.md

@@ -0,0 +1,41 @@
+# src/skills/clonedeps/
+
+## Responsibility
+
+Workflow-only bundled OpenCode skill for local dependency source mirroring. It
+instructs the orchestrator to use `@librarian` for dependency discovery and
+source URL/ref resolution, then perform approved git/filesystem operations
+directly.
+
+## Design
+
+- `SKILL.md` is the prompt contract loaded by OpenCode and assigned only to the
+  orchestrator.
+- No helper script is bundled. The skill avoids brittle cross-ecosystem parsing
+  and keeps repo-specific judgment in librarian/orchestrator.
+- State is trackable project metadata stored in `.slim/clonedeps.json`; clone
+  contents live under `.slim/clonedeps/repos/<safe-dependency-name>/` and are
+  ignored by git.
+- The workflow updates `.gitignore`, `.ignore`, and root `AGENTS.md` with
+  concise marker sections so cloned source stays out of git but visible to
+  OpenCode and discoverable by future agents.
+
+## Flow
+
+1. Orchestrator checks `.slim/clonedeps.json` first and reuses existing clones
+   when they satisfy the current task.
+2. Orchestrator asks librarian for a small source-resolution plan across the
+   repository's actual languages/ecosystems.
+3. Orchestrator verifies refs where possible and asks the user to approve.
+4. Orchestrator clones/fetches each approved source repo once into
+   `.slim/clonedeps/repos/<safe-repo-name>/`.
+5. Orchestrator writes `.slim/clonedeps.json` with paths, refs, and reasons.
+6. Orchestrator updates `.gitignore`, `.ignore`, and root `AGENTS.md`; the
+   AGENTS section lists each read-only clone path directly with a one-sentence
+   purpose.
+
+## Integration
+
+- Registered in `src/cli/custom-skills.ts` with orchestrator-only permission.
+- Included in release verification via `scripts/verify-release-artifact.ts`.
+- Documented in `docs/skills.md` and included in `src/skills/codemap.md`.

+ 8 - 5
src/skills/codemap.md

@@ -12,10 +12,11 @@
 
 - `CUSTOM_SKILLS` in `src/cli/custom-skills.ts` is the authoritative skill manifest for bundled
   skills; each entry maps folder name + `sourcePath` to an install-time consumer.
-- `install.ts` runs `installCustomSkill()` which recursively copies `src/skills/codemap` and
-  `src/skills/simplify` into the OpenCode skills directory.
+- `install.ts` runs `installCustomSkill()` which recursively copies bundled skill
+  directories into the OpenCode skills directory.
 - This directory is partitioned by skill:
   - `src/skills/codemap/` (command-style repository mapping skill)
+  - `src/skills/clonedeps/` (workflow skill for dependency source mirroring)
   - `src/skills/simplify/` (readability/refactor guidance skill)
 - Files are considered static runtime payload. No plugin TS module in `src/` imports these files directly; they
   are loaded by OpenCode via filesystem installation.
@@ -34,7 +35,9 @@
 
 - `src/cli/custom-skills.ts`: source-of-truth registry consumed by installer and permission helpers.
 - `src/cli/skills.ts:getSkillPermissionsForAgent()` auto-populates permission rules for
-  `codemap` and `simplify` when agent policy is derived from built-in recommendations.
-- `verify-release-artifact.ts` enforces artifact completeness by asserting `src/skills/simplify/SKILL.md`
-  and `src/skills/codemap/SKILL.md` are present in the tarball.
+  bundled skills when agent policy is derived from built-in recommendations.
+- `verify-release-artifact.ts` enforces artifact completeness by asserting key
+  bundled skill payloads such as `src/skills/simplify/SKILL.md`,
+  `src/skills/codemap/SKILL.md`, and `src/skills/clonedeps/SKILL.md` are present
+  in the tarball.
 - `package.json` scripts (`verify:release`, `build`) rely on these assets to ensure install-time skill availability.