← Back to Skills Marketplace
k-kolomeitsev

Data Structure Protocol (DSP)

by k-kolomeitsev · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
222
Downloads
1
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install data-structure-protocol
Description
Build and navigate DSP (Data Structure Protocol) — graph-based long-term structural memory of codebases for LLM agents. Stores entities (modules, functions),...
README (SKILL.md)

Data Structure Protocol (DSP)

DSP builds a dependency graph of project entities in a .dsp/ directory. Each entity (module, function, external dependency) gets a UID, description, import list, and export index. The graph answers: what exists, why it exists, what depends on what, and who uses what.

DSP is NOT documentation for humans or AST dump. It captures meaning (purpose), boundaries (imports/exports), and reasons for connections (why).

Agent Prompt

Embed this context when working on a DSP-tracked project:

This project uses DSP (Data Structure Protocol). The .dsp/ directory is the entity graph of this project: modules, functions, dependencies, public API. It is your long-term memory of the code structure.

Core rules:

  1. Before changing code — find affected entities via dsp-cli search, find-by-source, or read-toc. Read their description and imports to understand context.
  2. When creating a file/module — call dsp-cli create-object. For each exported function — create-function (with --owner). Register exports via create-shared.
  3. When adding an import — call dsp-cli add-import with a brief why. For external dependencies — first create-object --kind external if the entity doesn't exist yet.
  4. When removing import / export / file — call remove-import, remove-shared, remove-entity respectively. Cascade cleanup is automatic.
  5. When renaming/moving a file — call move-entity. UID does not change.
  6. Don't touch DSP if only internal implementation changed without affecting purpose or dependencies.
  7. Bootstrap — if .dsp/ is empty, traverse the project from root entrypoint via DFS on imports, documenting every file.

Key commands:

dsp-cli init
dsp-cli create-object \x3Csource> \x3Cpurpose> [--kind external] [--toc ROOT_UID]
dsp-cli create-function \x3Csource> \x3Cpurpose> [--owner UID] [--toc ROOT_UID]
dsp-cli create-shared \x3Cexporter_uid> \x3Cshared_uid> [\x3Cshared_uid> ...]
dsp-cli add-import \x3Cimporter_uid> \x3Cimported_uid> \x3Cwhy> [--exporter UID]
dsp-cli remove-import \x3Cimporter_uid> \x3Cimported_uid> [--exporter UID]
dsp-cli remove-shared \x3Cexporter_uid> \x3Cshared_uid>
dsp-cli remove-entity \x3Cuid>
dsp-cli move-entity \x3Cuid> \x3Cnew_source>
dsp-cli update-description \x3Cuid> [--source S] [--purpose P] [--kind K]
dsp-cli get-entity \x3Cuid>
dsp-cli get-children \x3Cuid> [--depth N]
dsp-cli get-parents \x3Cuid> [--depth N]
dsp-cli search \x3Cquery>
dsp-cli find-by-source \x3Cpath>
dsp-cli read-toc [--toc ROOT_UID]
dsp-cli get-stats

Using the CLI

The script is at scripts/dsp-cli.py relative to this skill directory.

python \x3Cskill-path>/scripts/dsp-cli.py [--root \x3Cproject-root>] \x3Ccommand> [args]

--root defaults to current working directory. All paths in arguments are repo-relative.

Core Concepts

  • Code = graph. Nodes are Objects and Functions. Edges are imports and shared/exports.
  • Identity by UID, not file path. Path is an attribute; renames/moves don't change UID.
  • "Shared" creates an entity. If something becomes public (exported), it gets its own UID.
  • Import tracks both "from where" and "what". One code import may create two DSP links: to the module and to the specific shared entity.
  • Full import coverage. Every imported file/asset must be an Object in .dsp — code, images, styles, configs, everything.
  • why lives next to the imported entity in its exports/ directory (reverse index).
  • Start from roots. Each root entrypoint has its own TOC file.
  • External deps — record only. kind: external, no deep dive into node_modules/site-packages/etc. But exports index works — shows who imports it.

UID Format

  • Objects: obj-\x3C8 hex> (e.g., obj-a1b2c3d4)
  • Functions: func-\x3C8 hex> (e.g., func-7f3a9c12)

UID marker in source code — comment @dsp \x3Cuid> before declaration:

// @dsp func-7f3a9c12
export function calculateTotal(items) { ... }
# @dsp obj-e5f6g7h8
class UserService:

Workflows

Setting Up DSP

  1. Run dsp-cli init to create .dsp/ directory.
  2. Identify root entrypoint(s) — package.json main, framework entry, etc.
  3. Run bootstrap (DFS from root). See bootstrap.md.

Creating Entities (when writing new code)

  1. Create module: dsp-cli create-object \x3Cpath> \x3Cpurpose>
  2. Create functions: dsp-cli create-function \x3Cpath>#\x3Csymbol> \x3Cpurpose> --owner \x3Cmodule-uid>
  3. Register exports: dsp-cli create-shared \x3Cmodule-uid> \x3Cfunc-uid> [\x3Cfunc-uid> ...]
  4. Register imports: dsp-cli add-import \x3Cthis-uid> \x3Cimported-uid> \x3Cwhy> [--exporter \x3Cmodule-uid>]
  5. External deps: dsp-cli create-object \x3Cpackage-name> \x3Cpurpose> --kind external

Navigating the Graph (when reading/understanding code)

  • Find entity by file: dsp-cli find-by-source \x3Cpath>
  • Search by keyword: dsp-cli search \x3Cquery>
  • Read TOC: dsp-cli read-toc → get all UIDs, then get-entity for details
  • Dependency tree down: dsp-cli get-children \x3Cuid> --depth N
  • Dependency tree up: dsp-cli get-parents \x3Cuid> --depth N
  • Impact analysis: dsp-cli get-recipients \x3Cuid> — who depends on this entity
  • Path between entities: dsp-cli get-path \x3Cfrom> \x3Cto>

Updating (when modifying code)

  • Purpose changed: dsp-cli update-description \x3Cuid> --purpose \x3Cnew>
  • File moved: dsp-cli move-entity \x3Cuid> \x3Cnew-path>
  • Import reason changed: dsp-cli update-import-why \x3Cimporter> \x3Cimported> \x3Cnew-why>

Deleting (when removing code)

  • Import removed: dsp-cli remove-import \x3Cimporter> \x3Cimported> [--exporter UID]
  • Export removed: dsp-cli remove-shared \x3Cexporter> \x3Cshared>
  • File/module deleted: dsp-cli remove-entity \x3Cuid> (cascading cleanup)

Diagnostics

  • dsp-cli detect-cycles — circular dependencies
  • dsp-cli get-orphans — unused entities
  • dsp-cli get-stats — project graph overview

When to Update DSP

Code Change DSP Action
New file/module create-object + create-function + create-shared + add-import
New import added add-import (+ create-object --kind external if new external dep)
Import removed remove-import
Export added create-shared (+ create-function if new function)
Export removed remove-shared
File renamed/moved move-entity
File deleted remove-entity
Purpose changed update-description
Internal-only change No DSP update needed

References

Usage Guidance
This skill appears to do what it says: it creates and updates a .dsp/ graph inside the repo and does not contact external services or require secrets. Before installing or using it, (1) review and back up your repository (or run in a sandbox) since the agent will create/modify .dsp/ files in-place, (2) verify you are comfortable with an autonomous agent modifying project metadata, and (3) if you want stricter controls, run dsp-cli manually rather than allowing autonomous invocation so you can review changes before committing them.
Capability Analysis
Type: OpenClaw Skill Name: data-structure-protocol Version: 1.0.0 The skill bundle implements the 'Data Structure Protocol' (DSP), a system for AI agents to maintain a graph-based map of a codebase's structure (modules, functions, and dependencies) within a local .dsp/ directory. The core logic in scripts/dsp-cli.py uses standard Python libraries (pathlib, shutil) to manage metadata files and directories; it contains no network calls, shell execution, or obfuscation. The instructions in SKILL.md and the reference documentation are consistent with the stated purpose of codebase mapping and do not attempt to subvert the agent or exfiltrate sensitive data.
Capability Assessment
Purpose & Capability
The name/description (graph-based memory for codebases) matches the provided CLI and docs. The script implements UID generation, TOC management, imports/exports bookkeeping and bootstrap traversal — all expected for this functionality. No unrelated credentials or binaries are requested.
Instruction Scope
SKILL.md instructs the agent to run the local dsp-cli and to read/update the .dsp directory and project files; those actions are appropriate for maintaining a structural memory. The instructions do not direct the agent to read unrelated system files, environment secrets, or to transmit data externally. (Minor doc quirk: examples include an invalid hex character in a UID example, but this is non-security.)
Install Mechanism
There is no install spec; the skill is instruction-only plus a local Python CLI script. No remote downloads, package installs, or external taps are used.
Credentials
The skill declares no required environment variables, credentials, or config paths. The CLI operates on repository-relative paths and writes only into .dsp under the project root, which is proportionate to the stated goal.
Persistence & Privilege
always:false (normal). The CLI writes persistent state into the repository's .dsp directory and can be invoked by the agent autonomously. This is expected for a tool that maintains project memory, but users should be aware the agent can modify .dsp files when invoking the skill.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install data-structure-protocol
  3. After installation, invoke the skill by name or use /data-structure-protocol
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
Initial release of the Data Structure Protocol (DSP) skill. - Introduces DSP as a codebase graph for long-term structural memory (entities, dependencies, APIs, reasons). - Details core DSP concepts, UID system, and strict CLI-driven workflows for creating, modifying, and navigating code structure. - Provides a comprehensive agent prompt with usage rules and safety checks for DSP-tracked projects. - Documents setup, updates, deletion scenarios, and diagnostics commands for maintaining DSP integrity. - Includes references for storage format, bootstrap procedure, and supported operations.
Metadata
Slug data-structure-protocol
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is Data Structure Protocol (DSP)?

Build and navigate DSP (Data Structure Protocol) — graph-based long-term structural memory of codebases for LLM agents. Stores entities (modules, functions),... It is an AI Agent Skill for Claude Code / OpenClaw, with 222 downloads so far.

How do I install Data Structure Protocol (DSP)?

Run "/install data-structure-protocol" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Data Structure Protocol (DSP) free?

Yes, Data Structure Protocol (DSP) is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Data Structure Protocol (DSP) support?

Data Structure Protocol (DSP) is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Data Structure Protocol (DSP)?

It is built and maintained by k-kolomeitsev (@k-kolomeitsev); the current version is v1.0.0.

💬 Comments