Passer au contenu principal
D

recollect (dsh)

dkmnx/recollect/adapters/dsh

Per-workspace Recollect memory for DeepSeek Harness. Adds a scoped memory tool and injects a memory snapshot for each agent's working directory.

Installer

dsh plugin --profile web add github:dkmnx/recollect

Ce plugin se trouve dans le sous-répertoire adapters/dsh du dépôt.

README

Recollect logo

Recollect

CI Go Version License: MIT Latest release

Recollect is a Go memory engine for coding agents. It stores facts as Markdown files and ranks them for recall.

Description

An agent needs memory that survives a session and stays easy to inspect. Recollect stores each fact in its own Markdown file. A generated index lists the facts. The engine searches the corpus, follows links between facts, and builds derived pages from cited sources.

The packages are written in Go. They depend on the standard library, golang.org/x/sys, ncruces/go-sqlite3, and luist18/sqlite-vec-go. Platform-specific code covers atomic file replacement, advisory locks, and the Windows search cache ACL. The engine is designed to be cross platform. Linux, macOS arm64, and Windows builds are checked.

Markdown stays the authoritative store, so a person can read and edit the files without the engine.

Features:

  • Fact storage with format-v1 parsing and atomic writes
  • Ranked project and user search
  • Optional private SQLite search index and hybrid semantic recall
  • Privacy filtering and secret detection
  • Digests, revision chains, journals, and derived pages
  • Prompt section rendering from an injected store and enablement flag
  • Fixtures and a ranking corpus that exercise the real store

Packages

PackageEcosystemInstallPurpose
github.com/dkmnx/recollectGo modulego get github.com/dkmnx/recollect@latestEngine library for facts, search, transactions, jobs, and prompt rendering.
recollectGo binarygo install github.com/dkmnx/recollect/cmd/recollect@latestJSON-RPC stdio engine, MCP server, and setup commands.
opencode-recollectnpm packageopencode plugin add opencode-recollect@latestOpenCode plugin with the memory tool, /recollect-* commands, and event capture.
dsh-recollectnpm packagedsh plugin --profile <name> add dsh-recollect@latestDeepSeek Harness plugin with the recollect_memory tool and a scoped memory snapshot.

Requirements

Go 1.27.4 or later.

Installation

Build the engine from a checkout:

git clone https://github.com/dkmnx/recollect
cd recollect
go build -o recollect ./cmd/recollect

Install it with:

go install github.com/dkmnx/recollect/cmd/recollect@latest

One-line install

curl -fsSL https://raw.githubusercontent.com/dkmnx/recollect/main/scripts/install.sh | sh

Pin a release by replacing vX.Y.Z with the tag you want:

curl -fsSL https://raw.githubusercontent.com/dkmnx/recollect/main/scripts/install.sh | sh -s -- --version vX.Y.Z

On Windows PowerShell:

irm https://raw.githubusercontent.com/dkmnx/recollect/main/scripts/install.ps1 | iex

Pin a Windows release:

& ([scriptblock]::Create((irm https://raw.githubusercontent.com/dkmnx/recollect/main/scripts/install.ps1))) -Version vX.Y.Z

This runs the script without inspection. Use the download-and-inspect form below when you need to review it first.

Download and inspect

curl -fsSL https://raw.githubusercontent.com/dkmnx/recollect/main/scripts/install.sh -o install.sh
less install.sh
sh install.sh --version vX.Y.Z

On Windows:

irm https://raw.githubusercontent.com/dkmnx/recollect/main/scripts/install.ps1 -OutFile install.ps1
notepad install.ps1
.\install.ps1 -Version vX.Y.Z

The scripts install to ~/.local/bin or %LOCALAPPDATA%\Programs\recollect by default. Pass --dir or -Dir to choose another directory, and set RECOLLECT_INSTALL_DIR to change the POSIX default.

The binary serves JSON-RPC on stdin and stdout. It also has setup commands:

recollect version
recollect doctor
recollect mcp
recollect setup opencode

setup opencode prints the plugin entry for the OpenCode host. Add --write to merge it into the global opencode.json. recollect mcp serves the Model Context Protocol over stdio.

Usage

Import the public facade github.com/dkmnx/recollect/memory in your Go program. Open a store over two directories.

package main

import (
    "fmt"
    "os"
    "path/filepath"

    "github.com/dkmnx/recollect/memory"
)

func main() {
    root, err := os.MkdirTemp("", "recollect-demo-")
    if err != nil {
        panic(err)
    }
    userDir := filepath.Join(root, "user")
    projectDir := filepath.Join(root, "project")
    if err := os.MkdirAll(userDir, 0o700); err != nil {
        panic(err)
    }
    if err := os.MkdirAll(projectDir, 0o700); err != nil {
        panic(err)
    }

    store := memory.NewStore(memory.Options{
        UserDir:    userDir,
        ProjectDir: projectDir,
    })
    if _, err := store.EnsureProject(memory.ProjectMeta{
        Root: projectDir,
        Name: "demo",
        Slug: "demo",
    }); err != nil {
        panic(err)
    }

    _, err = store.AppendFact(memory.Fact{
        Name:        "build-command",
        Description: "How to build the project",
        Type:        memory.FactTypeProject,
        Body:        "Run go test ./... before a change.",
    })
    if err != nil {
        panic(err)
    }

    matches, err := store.SearchFacts("build", "", 10)
    if err != nil {
        panic(err)
    }
    for _, match := range matches {
        fmt.Println(match.Name, match.Description)
    }
}

Run it from the repository root with go run ./cmd/demo. No credentials are needed.

Search index

Search is lexical by default. Set RECOLLECT_SEARCH_INDEX to choose the derived index:

  • sqlite uses the private SQLite FTS5 index under .engine/search.
  • hybrid adds semantic candidates from the OpenAI-compatible endpoint in config.json. Set embedding.baseURL, embedding.model, embedding.dimensions, and embedding.apiKeyEnv. hybrid refuses to start without an endpoint.

The config file lives at <userDir>/config.json. Run recollect doctor to print the effective values with secret values hidden.

Markdown stays authoritative. The index rebuilds from the files and never replaces them.

MCP

recollect mcp serves the Model Context Protocol over stdio. It exposes memory search, read, save, correct, delete, and context tools, plus resources. See docs/mcp.md for client setup, configuration, and limits.

The server uses the same engine, config file, and privacy filters as the stdio protocol. The engine protocol itself is documented in docs/protocol.md.

OpenCode

The OpenCode adapter starts the engine as a child process, exposes the memory tool, and registers the /recollect-* commands. Build the engine binary, then add the opencode-recollect package to opencode.jsonc, or use the adapter directory from a checkout. The adapter finds the binary from binaryPath, RECOLLECT_BINARY, the default install directory, or PATH as a fallback. See adapters/opencode/README.md for the exact config and verification steps.

DeepSeek Harness

The DeepSeek Harness adapter gives each agent a recollect_memory tool and injects a memory snapshot bound to that agent's working directory. Add the dsh-recollect package to a DSH profile with dsh plugin --profile <name> add dsh-recollect@latest. The adapter finds the engine binary from binaryPath, RECOLLECT_BINARY, the default install directory, or PATH as a fallback. See adapters/dsh/README.md for the config and verification steps.

Tests

Run these checks from the repository root.

go test ./...
go vet ./...
go run ./tools/checktestaudit

These commands use the Go toolchain and run on any supported platform. The audit check requires an audit record in every test file. The test suite includes the format fixtures and the ranking corpus. The Windows atomic replacement tests run only on Windows.

Contributing

Read CONTRIBUTING.md before you open a change. It lists the required toolchain, every check CI runs, the test audit record, and the commit and branch conventions.

The short version:

gofmt -l .
go vet ./...
go test ./... -count=1
go test -race ./... -count=1
go run ./tools/checktestaudit
staticcheck ./...
govulncheck ./...

Keep new behavior covered by tests at the store or search boundary.

License

Recollect uses the MIT License. See LICENSE.

You may use, copy, modify, merge, publish, distribute, sublicense, and sell copies of the software. Keep the copyright and permission notice in all copies or substantial portions. The software comes without warranty.

Plugins associés