{"_id":"@abagraph/cli","name":"@abagraph/cli","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@abagraph/cli","version":"0.1.0","description":"Command-line interface for abagraph — the bitemporal graph + vector memory database for LLM agents.","license":"Apache-2.0","type":"module","bin":{"abagraph":"bin/abagraph.mjs"},"scripts":{"test":"node --test test/*.test.mjs"},"engines":{"node":">=18"},"optionalDependencies":{"pg":"^8","mongodb":"^6"},"keywords":["abagraph","cli","memory","knowledge-graph","agent"],"_id":"@abagraph/cli@0.1.0","gitHead":"5b11f72d739c94097e34a7a43b8a62b49b489539","_nodeVersion":"22.22.3","_npmVersion":"10.9.8","dist":{"integrity":"sha512-xklHYQSG9EUcu6EZYDNI2H60BuzVwresWkPnC6Vprqr/eOtO/TVlq8FT1rEMpMyU7HNkEWvSk0HfZL5fBdWcNg==","shasum":"39141075cbc015c4737adc45ee12f0d202935eca","tarball":"https://registry.npmjs.org/@abagraph/cli/-/cli-0.1.0.tgz","fileCount":4,"unpackedSize":24301,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDO3WbEaWAIJrhWeIGATks7JzA3dZUSnsG1mFYoZjCN9gIgF6jkwbyt7gzUY2Y57XSNZMnceiNr5gJCzJj/UfIS+OU="}]},"_npmUser":{"name":"ashby1","email":"ash@abagraph.com"},"directories":{},"maintainers":[{"name":"ashby1","email":"ash@abagraph.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/cli_0.1.0_1782734967367_0.6008831792999627"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-29T12:09:27.183Z","0.1.0":"2026-06-29T12:09:27.500Z","modified":"2026-06-29T12:09:27.877Z"},"maintainers":[{"name":"ashby1","email":"ash@abagraph.com"}],"description":"Command-line interface for abagraph — the bitemporal graph + vector memory database for LLM agents.","keywords":["abagraph","cli","memory","knowledge-graph","agent"],"license":"Apache-2.0","readme":"# @abagraph/cli\n\nCommand-line interface for **abagraph** — the bitemporal graph + vector memory\ndatabase for LLM agents. Zero dependencies; uses the built-in global `fetch`\n(Node >= 18). Run it without installing via `npx`.\n\n## Getting started\n\nPoint the CLI at your instance and save the config to `~/.abagraph.json`:\n\n```bash\nnpx abagraph init --url https://your.abagraph.com --key <KEY>\n```\n\n`init` writes the config, checks `/api/health`, then prints the REST / MCP /\nstream endpoints from `/api/connect`.\n\nConfiguration precedence is **flag → env → `~/.abagraph.json`**:\n\n| Setting | Flag | Env |\n| --- | --- | --- |\n| Base URL | `--url` | `ABAGRAPH_URL` |\n| API key | `--key` | `ABAGRAPH_KEY` |\n\n## Commands\n\n### Write a fact\n\n```bash\nnpx abagraph assert user:alice prefers dark-mode\nnpx abagraph assert user:alice prefers light-mode --branch experiment\n```\n\n### Query facts\n\n```bash\nnpx abagraph query --subject user:alice --limit 20\nnpx abagraph query --predicate prefers --branch experiment\n```\n\n### Branches (write isolation + time travel)\n\n```bash\nnpx abagraph branch create experiment --parent main\nnpx abagraph branch list\nnpx abagraph branch diff experiment\nnpx abagraph branch promote experiment\nnpx abagraph branch discard experiment\n```\n\n`--as-of <MS>` pins a new branch to a point in time (epoch milliseconds):\n\n```bash\nnpx abagraph branch create snapshot --as-of 1718800000000\n```\n\n### Connection info\n\n```bash\nnpx abagraph connect\n```\n\nPrints the connection snippets from `/api/connect` (REST base, MCP endpoint,\ncopy-paste examples).\n\n### Fact-checking\n\n```bash\nnpx abagraph factcheck --subject user:alice --predicate prefers\n```\n\nPrints the contradiction count and the contradicting facts.\n\n### Migrate existing data (Postgres + pgvector, MongoDB)\n\nPull rows/documents you already have into abagraph as subject–predicate–object\nfacts. The DB drivers are **optional** — install only what you migrate from:\n\n```bash\nnpm i pg        # for postgres\nnpm i mongodb   # for mongo\n```\n\nMap each row to one or more facts with a small DSL. `$col` interpolates a column\n(or dotted document path, e.g. `$address.city`); bare text is a literal; `;`\nseparates templates to emit multiple facts per row:\n\n```bash\nnpx abagraph migrate postgres \\\n  --conn postgres://user:pass@host/db --table companies \\\n  --map 'subject=Company:$id, predicate=industry, object=$industry, confidence=0.9;\n         subject=Company:$id, predicate=employees, object=$headcount' \\\n  --vector-col embedding --vector-dim 1536 --batch 500\n\nnpx abagraph migrate mongo \\\n  --uri mongodb://host/db --collection companies \\\n  --map 'subject=Company:$_id, predicate=industry, object=$industry' \\\n  --filter '{\"active\":true}' --limit 1000\n```\n\nFacts land **tenant-scoped** under your configured key and go through the same\nPII-mask + supersede + embed pipeline as `/api/digest`. Useful flags:\n\n| Flag | Meaning |\n| --- | --- |\n| `--map` | row→triple mapping (required) |\n| `--vector-col` | column/field holding an existing embedding (carried through, no re-embed) |\n| `--vector-dim` | expected embedding length; rows that differ are warned about |\n| `--where` (pg) / `--filter` (mongo) | row filter |\n| `--limit` / `--batch` | cap rows / facts per POST (batch ≤ 500) |\n| `--source` | provenance stamped on every fact |\n| `--dry-run` | print the first mapped facts without writing |\n\n**pgvector → embeddings.** The vector column is read as text (`::text`) and\nparsed to a float array. The source embedding model **must match** your tenant's\nconfigured embedding provider/dimension, or those facts still land (and are\nrecallable by pattern, graph, and `as_of`) but will not surface in semantic\nsearch — the CLI warns when a row's length differs from `--vector-dim`. To avoid\nthe mismatch entirely, drop `--vector-col` and let the server re-embed.\n\n**Paste-a-dump fallback (zero mapping).** For unknown/unstructured schemas, throw\na `pg_dump` or `mongoexport` straight at `/api/digest` raw mode — an LLM extracts\nthe triples (lossy, costs model calls, does not carry embeddings):\n\n```bash\ncurl -H \"Authorization: Bearer <KEY>\" -H \"Content-Type: application/json\" \\\n  -d '{\"content\":\"<file contents>\",\"content_type\":\"application/sql\",\"source\":\"pg_dump\",\n       \"extract_model\":{...BYOK...},\"judge_model\":{...BYOK...}}' \\\n  https://your.abagraph.com/api/digest\n```\n\nUse `migrate` when the schema is known (precise, deterministic, carries vectors);\nuse the dump fallback for a quick \"throw it at the wall\" import.\n\n## Help\n\n```bash\nnpx abagraph help\n```\n\n## License\n\nApache-2.0\n","readmeFilename":"README.md","_rev":"1-f9348520b0505cd4209b8784b4e43a51"}