pilotswarm-hybrid-datastore
Skill14 starsChanged 8 months agoMITView on GitHub
Use when a PilotSwarm app needs stock PostgreSQL for runtime storage plus HorizonDB for enhanced facts, semantic/lexical search, and the knowledge graph. Covers env topology, horizonConfigFromEnv wiring, harvester agents, Azure secret/resource guidance, and the rule that Docker defaults remain stock Postgres.
- Reads credentials
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Use this skill when an app needs the production hybrid topology:
- Distinctive: line 32
Keep the slots separate in app code, env templates, docs, and deployment assets:
- Very specific: line 92
Add a separate optional hybrid block or .env.horizondb.example for HorizonDB:
- Very specific: line 119
When the app needs durable source ingestion, consult pilotswarm-knowledge-harvester and generate a …
- Distinctive: line 163
Do not change Dockerfiles or the starter image just to support the hybrid store.
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
PilotSwarm Hybrid Datastore
Use this skill when an app needs the production hybrid topology:
- Runtime store: stock PostgreSQL via
DATABASE_URLfor Duroxide state, CMS/session catalog, ordinary facts fallback, and default Docker/local runs. - Enhanced facts store: HorizonDB via
HORIZON_DATABASE_URLfor lexical, semantic, and hybrid fact search. - Graph store: HorizonDB via
HORIZON_GRAPH_DATABASE_URLfor the open knowledge graph and harvester crawl receipts.
This is an opt-in provider configuration. It does not require a custom PilotSwarm Docker image. The starter/local Docker path should continue to run on stock PostgreSQL by default unless the user explicitly asks for a HorizonDB environment.
Canonical References
- Configuration guide:
https://github.com/microsoft/PilotSwarm/blob/main/docs/developer/reference/configuration.md#enhanced-facts--knowledge-graph-optional - Horizon Harvester sample:
https://github.com/microsoft/PilotSwarm/tree/main/examples/horizon-harvester - Harvester deployment guide:
https://github.com/microsoft/PilotSwarm/blob/main/docs/developer/deploy/harvester.md - Horizon provider package:
https://github.com/microsoft/PilotSwarm/tree/main/packages/horizon-store - Environment examples:
.env.exampleand.env.horizondb.example
Provider Slots
Keep the slots separate in app code, env templates, docs, and deployment assets:
| Slot | Env | Provider | Purpose |
| Runtime | DATABASE_URL | stock PostgreSQL | Duroxide orchestration state, CMS/session catalog, runtime facts fallback |
| Enhanced facts | HORIZON_DATABASE_URL | HorizonDB | facts_search, facts_similar, durable embed loop |
| Graph | HORIZON_GRAPH_DATABASE_URL | HorizonDB | graph namespaces, graph read/write tools, harvester crawl receipts |
DATABASE_URL remains mandatory for PilotSwarm runtime storage. HorizonDB does
not replace it. When no HORIZON_* vars are present, the same app should still
start with stock PostgreSQL and no enhanced facts/graph tools.
Worker, Client, And Management Wiring
For SDK apps, wire the same Horizon facts target into worker, client, and
management client by spreading horizonConfigFromEnv() everywhere the runtime
accepts storage/provider options:
import {
PilotSwarmClient,
PilotSwarmManagementClient,
PilotSwarmWorker,
horizonConfigFromEnv,
} from "pilotswarm-sdk";
const store = process.env.DATABASE_URL;
const horizon = horizonConfigFromEnv();
const worker = new PilotSwarmWorker({
store,
githubToken: process.env.GITHUB_TOKEN,
...horizon,
});
// Direct { store } construction is for co-located/dev/test processes only
// (like this single-process example). App code that talks to a shared
// deployment uses Web API mode instead — it needs no database URLs at all:
// new PilotSwarmClient({ apiUrl })
// new PilotSwarmManagementClient({ apiUrl })
// Enhanced facts/search/graph reach remote clients through the deployment's
// Web API data-plane (createWebFactStore / createWebGraphStore).
const client = new PilotSwarmClient({ store, ...horizon });
const management = new PilotSwarmManagementClient({ store, ...horizon });The direct client/management paths ignore worker-only graph/embed settings safely, but they must agree on the facts target so cleanup, lineage reads, and management diagnostics do not hit the wrong database. Remote clients never see these settings — the portal's Web API brokers facts/search/graph for them.
Env Template Guidance
For normal local and starter-Docker scaffolds, keep .env.example stock-PG first:
DATABASE_URL=postgres://postgres:postgres@localhost:5432/pilotswarm
GITHUB_TOKEN=Add a separate optional hybrid block or .env.horizondb.example for HorizonDB:
# Runtime store: stock PostgreSQL
DATABASE_URL=postgres://postgres:postgres@localhost:5432/pilotswarm
# Enhanced facts/search store: HorizonDB
HORIZON_DATABASE_URL=postgres://<user>:<pass>@<horizon-host>:5432/<db>?sslmode=require
HORIZON_FACTS_SCHEMA=horizon_facts
# Graph store: HorizonDB
HORIZON_GRAPH_DATABASE_URL=postgres://<user>:<pass>@<horizon-host>:5432/<db>?sslmode=require
HORIZON_GRAPH_SCHEMA=horizon_graph
# Optional durable embed loop
HORIZON_EMBED_ENDPOINT=
HORIZON_EMBED_MODEL=text-embedding-3-small
HORIZON_EMBED_DIM=1536
HORIZON_EMBED_API_KEY=The facts and graph schemas must be distinct when they share one HorizonDB
database. The defaults horizon_facts and horizon_graph are intentionally
separate.
Harvester Agent Pattern
When the app needs durable source ingestion, consult pilotswarm-knowledge-harvester
and generate a plugin/agents/<source>-harvester.agent.md with:
---
schemaVersion: 1
version: 1.1.0
name: source-harvester
description: Crawls source documents into durable facts and the graph.
crawler: true
---Load-bearing rules:
- Harvester agents write raw source captures under
corpus/<source>/..., notintake/*. - Graph store is required for the harvester crawl queue and graph tools.
- Enhanced facts are recommended for
facts_search/facts_similar, but graph crawl and reconciliation can run with base facts plus graph. - Harvester cycles must mark crawl receipts with the exact
{ scopeKey, etag }values returned byfacts_read_uncrawled. - Deleted crawl rows (
deletedAt) must callgraph_remove_evidence(scopeKey, namespace)before marking crawled. - Recurring harvests use
cron/cron_at, never a hand-rolled polling loop.
Azure / AKS Guidance
For Azure deployments, document and validate two database targets:
- Runtime PostgreSQL (
DATABASE_URL): ordinary Azure Database for PostgreSQL or another stock PostgreSQL-compatible service. - HorizonDB (
HORIZON_DATABASE_URL/HORIZON_GRAPH_DATABASE_URL): enhanced facts/search and graph. This may be one HorizonDB cluster with separate schemas, or separate clusters when the user wants stronger isolation.
Kubernetes secret guidance should include both runtime and optional Horizon vars,
using kubectl create secret generic ... --from-env-file=.env.remote when values
contain shell-significant delimiters. If HorizonDB is unavailable or its required
extensions are not allow-listed, the worker can still deploy against stock
PostgreSQL; enhanced facts, graph tools, and harvester agents remain disabled.
Docker Constraint
Do not change Dockerfiles or the starter image just to support the hybrid store. The shipped image should continue to boot with stock PostgreSQL. Hybrid mode is selected by env/provider configuration at runtime.
Checklist
DATABASE_URLdocumented as runtime stock PostgreSQL.HORIZON_DATABASE_URLdocumented only for enhanced facts/search.HORIZON_GRAPH_DATABASE_URLdocumented only for graph/harvester crawl.- Worker, client, and management client spread
horizonConfigFromEnv(). - Harvester/crawler agent has
crawler: trueand source-specific corpus namespace. - Azure secret docs include both runtime and Horizon vars.
- Docker/starter docs still default to stock PostgreSQL.
In this repository50 other files it gives its agents.
- packages/sdk/examples/repo-workspaces/seed/home/AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- agent-repair-loopSkill
- duroxide-orchestration-versioningSkill
- editorial-standardsSkill
- finance-research-standardsSkill
- valuation-methodsSkill
- pilotswarm-architectureSkill
- deployment-safetySkill
- incident-responseSkill
- add-activitySkill
- add-eventSkill
- add-testSkill
- add-toolSkill
- agent-versioningSkill
- azure-ps-test-runner-vmSkill
- debug-orchestrationSkill
- debug-testSkill
- horizondb-idiosyncrasiesSkill
- horizon-facts-eval-sweepSkill
- investigate-duroxide-runtimeSkill
- pilotswarm-aks-deploySkill
- pilotswarm-aks-resetSkill
- pilotswarm-new-env-deploySkill
- pilotswarm-perfSkill
- pilotswarm-portal-app-regSkill
- pilotswarm-portal-auth-assignmentsSkill
- pilotswarm-releaseSkill
- pilotswarm-tuiSkill
- pilotswarm-vpn-client-profileSkill
- schema-migrationSkill
- notesSkill
- share-a-fileSkill
- cost-latency-analysisSkill
- graph-debugSkill
- orchestration-session-lifecycleSkill
- resourcemgrSkill
- sweeperSkill
- canvas-appsSkill
- html-visualsSkill
- pilotswarm-agent-versioningSkill
- pilotswarm-aks-identitySkill
- pilotswarm-azure-deployerSkill
- pilotswarm-azure-lessonsSkill
- pilotswarm-cli-builderSkill
- pilotswarm-duroxide-versioningSkill
- pilotswarm-knowledge-harvesterSkill
- pilotswarm-portal-builderSkill
- pilotswarm-sdk-builderSkill
- pilotswarm-three-tierSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

