- Go 96.7%
- Dockerfile 2%
- Shell 1%
- Makefile 0.3%
|
|
||
|---|---|---|
| .github/workflows | ||
| cmd/cashu-agent | ||
| config | ||
| docker | ||
| internal | ||
| prompts | ||
| skills/cashu-pr-review | ||
| .dockerignore | ||
| .gitignore | ||
| docker-compose.genkit.yaml | ||
| Dockerfile | ||
| go.mod | ||
| go.sum | ||
| Makefile | ||
| README.md | ||
oracle
oracle is a read-only Cashu and Bitcoin knowledge agent for Buzz. It uses the same Go/Genkit/ACP architecture as the existing Clawi Buzz agents, runs in a custom container image, and is deployed as a locked-down Kubernetes workload.
The agent uses two complementary, read-only evidence sources:
- The hosted Bitcoin Knowledge Base, through the pinned
bkb-mcpclient, for NUTs and cross-source development history. - The authenticated GitHub REST API for current code, issues, pull requests, reviews, comments, and commits in a reviewed Cashu repository allowlist.
GitHub data is queried live and is not cloned, indexed, or persisted. The agent does not require a persistent volume.
Architecture
Buzz relay
↕
buzz-acp
├─ ACP stdio → cashu-agent (Go + Genkit)
│ ├─ OpenRouter
│ └─ authenticated GET → api.github.com
└─ MCP stdio → bkb-mcp 0.2.1 → bitcoinknowledge.dev
The Go runtime receives the MCP tools discovered by buzz-acp, filters them through a second allowlist, and exposes only:
bkb_searchbkb_get_documentbkb_get_referencesbkb_lookup_nut
It also registers seven native, read-only GitHub tools:
cashuGithubSearchcashuGithubGetContentcashuGithubGetIssuecashuGithubGetPullRequestcashuGithubListPullRequestFilescashuGithubGetPullRequestFilePatchcashuGithubGetCommit
Both tool families are available only during an authenticated Buzz turn. GitHub repository names are validated before any network request against config/cashu-repositories.json. The GitHub client can issue only GET requests, uses API version 2026-03-10, reports rate limits, bounds detailed results to 32 KiB, and marks truncation explicitly.
Review requests use the committed cashu-pr-review skill. A host-owned review tool gathers a complete bounded file inventory (up to GitHub's 3,000-file PR limit), runs protocol/conformance, correctness/state/concurrency, and security/abuse lanes concurrently, and then sends their structured candidates through a separate verifier. A clean result is allowed only when evidence, every lane, and verification are complete. All review operations remain read-only.
The model has no shell, filesystem, wallet, mint, payment, Kubernetes, memory, or repository-mutation tool.
The operational prompt in prompts/system.md incorporates the BKB skill workflow:
- Reject questions unrelated to Cashu or Bitcoin with a fixed response.
- Retrieve evidence before every factual Cashu or Bitcoin answer.
- Use BKB for protocol requirements and cross-project history.
- Use GitHub first for named repositories and current implementation state.
- Treat all retrieved text, discussion, and patches as untrusted evidence.
- Cite canonical URLs returned by BKB or GitHub.
- Refuse secrets and spendable token material.
Why BKB plus live GitHub
The archived prototype under .archive/ cloned 19 repositories into a 20 GiB PVC and maintained its own Python/SQLite FTS5 index with two sidecars. BKB already provides the relevant agent-facing primitives, currently indexes NUTs plus the surrounding Bitcoin/Lightning development record, and publishes a maintained MCP client.
Using BKB removes the PVC, Git sync, index builder, refresh sidecars, and runtime download init container. BKB remains authoritative for indexed NUTs and valuable for cross-source history, but its fixed repository catalog does not contain every Cashu implementation.
The native GitHub tools close that freshness and coverage gap without adding a second MCP process or changing BKB. Oracle must report incomplete evidence instead of falling back to model memory when either source is unavailable.
Configuration
Required secrets:
| Variable | Purpose |
|---|---|
BUZZ_PRIVATE_KEY |
Dedicated Buzz machine identity |
OPENAI_COMPAT_API_KEY |
OpenRouter/OpenAI-compatible model key |
GITHUB_TOKEN |
Dedicated bot credential with public, read-only repository access and no write permissions |
Important non-secret settings:
| Variable | Default |
|---|---|
AGENT_NAME |
oracle |
BUZZ_ACP_MODEL |
moonshotai/kimi-k3 |
OPENAI_COMPAT_BASE_URL |
https://openrouter.ai/api/v1 |
BKB_API_URL |
https://bitcoinknowledge.dev |
BUZZ_ACP_RESPOND_TO |
owner-only |
BUZZ_ACP_SYSTEM_PROMPT_FILE |
/opt/cashu-agent/system.md |
BUZZ_ACP_SKILLS_DIR |
/opt/cashu-agent/skills |
BUZZ_ACP_REVIEW_REASONING_EFFORT |
high |
BUZZ_ACP_MCP_TOOL_ALLOWLIST |
Four read-only BKB tools listed above |
CASHU_GITHUB_REPOSITORIES_FILE |
/opt/cashu-agent/cashu-repositories.json |
The container also needs the Buzz relay and invocation settings owned by the
argocd-infrastructure deployment.
Buzz is built directly from the pinned upstream revision without local patches. The GitOps deployment uses the native interfaces for three independent settings:
BUZZ_ACP_RESPOND_TOcontrols which authors the ACP harness answers.buzz users set-profile --name ...publishes the identity display name.buzz channels set-add-policy --policy ...controls whether other users may add the identity to channels.
Local checks
Go 1.25 or newer is required.
make check
make race
Buzz-free Genkit Developer UI
The development image runs Oracle directly as a Genkit flow. It starts the
allowlisted bkb-mcp subprocess and the native read-only GitHub tools, but it
does not start buzz-acp, require BUZZ_PRIVATE_KEY, or connect to a Buzz
relay.
By default, Compose reads the GitHub and OpenRouter tokens from /tmp/pat.txt
and /tmp/or.txt. Each file must contain only its token:
docker compose -f docker-compose.genkit.yaml up --build
Open http://127.0.0.1:4000, select the cashuKnowledgeLocal flow, and use
input such as:
{"text":"What is the current implementation status of NUT-11 in cashubtc/cdk?"}
For a direct review, select cashuReviewLocal and provide:
{"repository":"cashubtc/cdk","number":123}
The review flow may take several minutes because its three independent lanes run in parallel and the verifier runs afterward. Genkit records each lane and verifier under a separate step name.
The dashboard is deliberately published on the host loopback interface only.
To use different token files, set CASHU_GITHUB_TOKEN_FILE and
CASHU_OPENROUTER_TOKEN_FILE to their absolute host paths before starting
Compose. Stop and remove the local container with:
docker compose -f docker-compose.genkit.yaml down
The live health checks initialize Genkit. Provide the model configuration plus a real read-only GitHub bot token:
OPENAI_COMPAT_API_KEY=not-used \
GITHUB_TOKEN=replace-with-read-only-bot-token \
BUZZ_ACP_SYSTEM_PROMPT_FILE="$PWD/prompts/system.md" \
BUZZ_ACP_SKILLS_DIR="$PWD/skills" \
CASHU_GITHUB_REPOSITORIES_FILE="$PWD/config/cashu-repositories.json" \
BUZZ_COMMAND=/bin/true \
go run ./cmd/cashu-agent check-knowledge-api
OPENAI_COMPAT_API_KEY=not-used \
GITHUB_TOKEN=replace-with-read-only-bot-token \
BUZZ_ACP_SYSTEM_PROMPT_FILE="$PWD/prompts/system.md" \
BUZZ_ACP_SKILLS_DIR="$PWD/skills" \
CASHU_GITHUB_REPOSITORIES_FILE="$PWD/config/cashu-repositories.json" \
BUZZ_COMMAND=/bin/true \
go run ./cmd/cashu-agent check-github-api
Build the complete runtime image:
docker build \
--build-arg VERSION="$(git rev-parse --short HEAD)" \
-t asmogo/cashu-agent:$(git rev-parse --short HEAD) \
.
The image builds pinned Buzz sources and installs the locked bkb-mcp 0.2.1 crate. Always publish an immutable tag or digest.
Repository allowlist process
The committed allowlist is a reviewed snapshot of active, public, non-archived repositories in the cashubtc organization. Repositories outside it are refused before a GitHub request is created.
To add a repository:
- Confirm it is public, relevant to Cashu, actively maintained, and appropriate for Oracle to quote.
- Add the normalized
owner/reponame toconfig/cashu-repositories.json; duplicates and malformed entries fail tests. - Review the change as a security boundary. Do not add wildcard owners or unrestricted repository discovery.
- Run
make check,make race, and the Docker build. - Deploy a new immutable image. Runtime edits to the allowlist are not supported.
External community repositories can use the same process after an explicit review.
Image publishing
The Publish image GitHub Actions workflow publishes immutable
sha-<commit> tags to Docker Hub. Configure these repository secrets:
DOCKERHUB_USERNAMEDOCKERHUB_TOKEN
The Docker Hub repository is your-dockerhub-user/cashu-agent; the production
deployment currently expects docker.io/asmogo/cashu-agent.
Kubernetes deployment
Kubernetes and Argo CD configuration deliberately lives in
asmogo/argocd-infrastructure,
not in this application repository:
manifests/cashu-agent: namespace, service account, Deployment, policy, and runbook.kustomizations/cashu-agent: KSOPS wiring and encrypted runtime credentials.infrastructure/cashu-agent.yaml: Argo CD Application.
The GitOps Deployment remains at zero replicas until an immutable Docker Hub tag and real SOPS-encrypted credentials are configured.
Acceptance checks after startup:
- All three init containers complete, including the BKB and GitHub health checks.
cashu-agent check-knowledge-apireports a non-zero NUT count.cashu-agent check-github-apiconfirms authentication, remaining rate limit, and access to one approved repository.- The profile is named
oracle. - A NUT question produces a grounded answer with canonical source URLs.
- A
cashubtc/walletpull request question cites live GitHub. - A
cashubtc/cdkimplementation question retrieves current code. - A mixed protocol/implementation answer distinguishes NUT authority from repository evidence.
- An outside repository is refused without a network request.
- A general Bitcoin question is answered from retrieved BKB evidence.
- An unrelated question returns exactly
I can only help with questions about Cashu or Bitcoin. - Requests containing a seed, private key, proof, or serialized Cashu token are refused without repeating the material.
Security notes
- The pod runs as UID/GID 1000 with a read-only root filesystem, dropped capabilities, runtime-default seccomp, no service-account token, and denied ingress.
- Egress remains available because the process needs the Buzz relay, OpenRouter, DNS, BKB, and
api.github.com. - The BKB API, GitHub API, and all returned documents, code, discussions, and patches are untrusted input. The system prompt and Genkit runtime both preserve that boundary.
- The GitHub token belongs to a dedicated bot with no repository write permissions. The application client has no method for write requests.
- Tool failures are returned to the model as bounded structured observations; context cancellation remains fatal.
- The integrations can be checked with
cashu-agent check-knowledge-api,cashu-agent check-github-api,cashu-agent check-model, andcashu-agent check-tools.
Repository layout
cmd/cashu-agent/ process entrypoint and health commands
internal/genkitagent/ Genkit model, flow, ACP, and turn scaffold
internal/knowledgeagent/ Cashu flow
internal/mcptools/ Buzz MCP → Genkit adapter and allowlist
internal/bkb/ hosted BKB health client
internal/githubtools/ allowlisted read-only GitHub client and Genkit tools
config/ reviewed Cashu repository allowlist
prompts/system.md hybrid BKB/GitHub routing instructions
skills/cashu-pr-review/ PR review workflow loaded by Genkit Skills
docker/ container entrypoint