Browse Source

Add colonedeps

alvinreal 3 months ago
parent
commit
4586c66a20
9 changed files with 225 additions and 13 deletions
  1. 4 0
      .gitignore
  2. 33 0
      .slim/clonedeps.json
  3. 8 0
      AGENTS.md
  4. 1 1
      README.md
  5. 147 0
      docs/clonedeps.md
  6. 2 0
      docs/skills.md
  7. 3 2
      src/skills/clonedeps/README.md
  8. 25 9
      src/skills/clonedeps/SKILL.md
  9. 2 1
      src/skills/clonedeps/codemap.md

+ 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.

+ 1 - 1
README.md

@@ -491,7 +491,7 @@ Use this section as a map: start with installation, then jump to features, confi
 | **[Todo Continuation](docs/todo-continuation.md)** | Auto-continue orchestrator sessions with cooldowns and safety checks |
 | **[Preset Switching](docs/preset-switching.md)** | Switch agent model presets at runtime with `/preset` |
 | **[Codemap](docs/codemap.md)** | Generate hierarchical codemaps to understand large codebases faster |
-| **[Skills](docs/skills.md#clonedeps)** | Clone selected dependency source into an ignored local workspace for inspection |
+| **[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 |
 

+ 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.

+ 2 - 0
docs/skills.md

@@ -91,6 +91,8 @@ Safety defaults:
 - 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

+ 3 - 2
src/skills/clonedeps/README.md

@@ -12,8 +12,9 @@ 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-name>/` and are
-ignored by git. `.slim/clonedeps.json` is intentionally trackable project
+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.

+ 25 - 9
src/skills/clonedeps/SKILL.md

@@ -102,16 +102,23 @@ The orchestrator owns final approval. Before cloning:
 
 ### Step 4: Clone Sources Manually
 
-Create one folder per dependency under:
+Create one folder per source repository under:
 
 ```text
-.slim/clonedeps/repos/<safe-dependency-name>/
+.slim/clonedeps/repos/<safe-repo-name>/
 ```
 
-Use a safe name by replacing `/` with `__` and other unsafe path characters with
-`_`. Do not create ecosystem folders or per-version folders. If two dependencies
-normalize to the same safe name, disambiguate manually and record the chosen path
-in `.slim/clonedeps.json`.
+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,
@@ -137,14 +144,23 @@ Write `.slim/clonedeps.json` so future agents know what exists:
   "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/example/repo.git",
+      "repoUrl": "https://github.com/opencode-ai/opencode.git",
       "ref": "v1.3.17",
-      "path": ".slim/clonedeps/repos/@opencode-ai__sdk",
+      "path": ".slim/clonedeps/repos/opencode-ai__opencode",
       "packagePath": "packages/sdk/js",
-      "reason": "Core runtime SDK used by the project"
+      "reason": "Core SDK source used to inspect runtime behavior"
     }
   ]
 }

+ 2 - 1
src/skills/clonedeps/codemap.md

@@ -27,7 +27,8 @@ directly.
 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 repo into `.slim/clonedeps/repos/`.
+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