diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c099dd6..0859ab2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -150,6 +150,30 @@ jobs: # me. Both legs write into the same draft, so it is only complete once Linux and macOS have # both landed, and I would rather see that than ship whichever finished first. releaseDraft: true + # The standalone CLI, which is a different product surface from the app and has to ship + # alongside it. The app is something you adopt; the binary is a line you paste into a terminal + # you already have open, and someone who is not ready for the first must still be able to do + # the second. It is small, has no webkit and no model in it, and is built from the same tree + # in the same run so the two can never disagree about the protocol between them. + - name: CLI binary + run: cargo build --release --bin identra ${{ matrix.target && format('--target {0}', matrix.target) || '' }} + - name: Name the CLI for its platform + shell: bash + run: | + src="${{ matrix.target && format('target/{0}/release/identra', matrix.target) || 'target/release/identra' }}" + mkdir -p dist + # The name the installer looks for. The triple rather than "linux"/"macos" because it is + # what rustc calls the thing, and a user who downloads one by hand can check it. + cp "$src" "dist/identra-${{ matrix.target || 'x86_64-unknown-linux-gnu' }}" + - name: Attach the CLI to the release + if: startsWith(github.ref, 'refs/tags/v') + uses: softprops/action-gh-release@v2 + with: + files: dist/identra-* + draft: true + tag_name: ${{ github.ref_name }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Keep the bundles on the run itself as well. A draft release is the download people get; this # is what I look at when a build is fine and a tag is not, and it is the only artifact a # workflow_dispatch produces at all. @@ -161,6 +185,7 @@ jobs: ${{ matrix.bundles }}/deb/*.deb ${{ matrix.bundles }}/rpm/*.rpm ${{ matrix.bundles }}/dmg/*.dmg + dist/identra-* # error, not warn. Each leg now looks only where its own bundles land, so finding nothing # means this OS built nothing, which is exactly the failure that shipped a green run with # no Mac download attached to it. Never let that be a warning again. diff --git a/Cargo.lock b/Cargo.lock index 530bf1e..5b96b73 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1863,6 +1863,7 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" name = "identra-core" version = "0.1.2" dependencies = [ + "identra-memory", "portable-pty", "serde", "serde_json", diff --git a/README.md b/README.md index 4fff63f..2c9c7e0 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,8 @@ in its opening handshake, without calling a tool to ask. [![Stack](https://img.shields.io/badge/stack-Rust%20%2B%20Tauri%20%2B%20React-24C8DB.svg)](#how-it-works) [![Status](https://img.shields.io/badge/status-early-orange.svg)](#status) -[Download and run](#download-and-run)  ·  +[Start with one line](#start-with-one-line)  ·  +[Download the app](#download-and-run-the-app)  ·  [Why](#why-i-built-this)  ·  [What it does](#what-it-does)  ·  [Requirements](#requirements)  ·  @@ -27,7 +28,33 @@ Rust engine, Tauri shell, React front end. Apache-2.0. --- -## Download and run +## Start with one line + +You do not have to adopt an app to get the memory. One binary, one line pasted into a project, +and every agent session there opens already holding what that project decided. + +```bash +curl -fsSL https://raw.githubusercontent.com/identra-dev/identra/main/install.sh | sh -s cli +claude mcp add identra -- ~/.local/bin/identra serve +``` + +Then start an agent in that project. The first connect is instant and honest: it tells the agent +how many of your past sessions Identra has read so far and how many are left, which on a project +with history is "none yet, and two hundred to go". Reading starts immediately and runs in the +background while you work, so by your next session there are real facts in the handshake and the +answer to "what do you already know here" is about your project. + +Reading the whole backlog takes a while — one session costs about half a minute of your own +agent's time, and Identra reads a bounded slice per session rather than running a daemon or +spending your quota while you are not looking. + +`identra doctor` says how much it has read, what is holding it up if anything, and — the part +you cannot check yourself — which of your installed CLIs actually shows its model what a server +sends at connect. Not all of them do. + +`claude mcp remove identra` and deleting `.identra/` undoes all of it. Nothing else is touched. + +## Download and run the app ```bash curl -fsSL https://raw.githubusercontent.com/identra-dev/identra/main/install.sh | sh @@ -118,9 +145,12 @@ so nobody starts from zero. column, and agents can open a file themselves to show you what they made. - The workspace saves itself. Close the app, open it next week, your agents, your connections and each agent's own conversation come back where you left them. -- A memory layer watches your sessions and pulls out the durable facts: decisions, rejected - directions, conventions. When you open a fresh agent in a project Identra already knows, it - shows what it remembers before the agent's first prompt. +- A memory layer reads the sessions you have already had in a project and pulls out the durable + facts: decisions, rejected directions, conventions. It uses your own agent CLI to do the + reading, so nothing is downloaded, nothing is sent anywhere it had not already been, and the + extraction is as good as the model you already pay for. When you open a fresh agent in a + project Identra knows, those facts arrive in its opening handshake, before its first prompt. + You can read them yourself in `.identra/MEMORY.md`. - Everything runs on your machine. Your agent API keys stay in your own CLI config. Identra never stores them and never phones home. Installed builds update themselves from Releases, and installing an update is always your click, never automatic. @@ -207,11 +237,15 @@ streams back with a sequence number so a pane can reattach after a reload withou duplicating a line. What each workspace holds — its agents and the connections between them — saves to `.identra/canvas.json` with a debounced atomic write. -Memory is its own crate. After a session it runs one extraction pass, dedupes by content hash, -embeds locally with fastembed, and stores the result in a single SQLite file with a vector -index. If you have no model configured, it stores the raw text instead of guessing. Memory -degrades quietly, it never blocks your work and it never calls out to a server you did not ask -it to. +Memory is its own crate. Extraction runs your own agent CLI headless, with no tools and no MCP +servers, over one session's dialogue at a time; it takes only what you typed and what the agent +wrote back, never tool output or file contents, because a fact ends up in the opening context of +every agent that connects afterwards and a cloned repository must not be able to put words +there. Facts are stamped with the date of the session that taught them, deduped by content hash, +embedded locally with fastembed, and stored in a single SQLite file. Reading a backlog is +bounded per session and checkpointed, so it drains as you work rather than needing a daemon. +Memory degrades quietly, it never blocks your work, and it never calls out to a server you did +not ask it to. ## Where your data lives @@ -233,6 +267,7 @@ so here is the whole list rather than a promise that it is tidy. |------|-----------|----------------| | `.identra/canvas.json` | Which agents are open, which are connected, wallpaper, the seat | No, Identra's | | `.identra/memory.db` | What the project has learned, plus `-wal` and `-shm` sidecars while it is open | No, Identra's | +| `.identra/MEMORY.md` | The same facts as a file you can read, regenerated from the database | No, Identra's | | `.identra/bus.db` | The task board and the message queue, same two sidecars | No, Identra's | | `.identra/opencode.json` | Bus config, kept out of the project root because opencode is pointed at it by env | No, Identra's | | `.identra/revealed` | Marker that the memory panel has introduced itself once | No, Identra's | diff --git a/apps/identra-desktop/frontend/src/App.tsx b/apps/identra-desktop/frontend/src/App.tsx index f2a9221..f84e9d9 100644 --- a/apps/identra-desktop/frontend/src/App.tsx +++ b/apps/identra-desktop/frontend/src/App.tsx @@ -1361,6 +1361,13 @@ export default function App() { // // The most recent one rather than a list. This is a glance that answers "did the thing happen", // and a column of counts is a thing to study. The full list is one hover away. +// How long the arriving state holds before the line settles into the receipt. +// +// Long enough to be seen by someone whose eyes were on the terminal when it fired, short enough +// that it is not still claiming to be news while they read the agent's reply. This is the only +// moment in the product where the mechanism is visible as it happens rather than after it. +const HANDSHAKE_FRESH_MS = 8000; + function HandshakeLine({ handshakes, nodes, @@ -1369,8 +1376,32 @@ function HandshakeLine({ nodes: CanvasNode[]; }) { const now = Math.floor(Date.now() / 1000); + // A receipt says the thing already happened. Nobody watches a receipt appear, and this is the + // one event in Identra worth watching: an agent opens, and before it has read a line of code it + // already holds what the project decided. Everything else the shell shows is a consequence of + // that, and until this landed there was no instant a person could point at and say "there". + // + // Keyed on the id and the timestamp together, so a reconnect of the same agent is a new arrival + // — which it is, and which is exactly the case someone is looking at when they are checking + // whether this works. + const [fresh, setFresh] = useState(null); + const seen = useRef>(new Set()); + useEffect(() => { + for (const [id, h] of Object.entries(handshakes)) { + const key = `${id}:${h.at}`; + if (seen.current.has(key)) continue; + seen.current.add(key); + setFresh(key); + } + }, [handshakes]); + useEffect(() => { + if (fresh === null) return; + const t = window.setTimeout(() => setFresh(null), HANDSHAKE_FRESH_MS); + return () => window.clearTimeout(t); + }, [fresh]); const named = Object.entries(handshakes) .map(([id, h]) => ({ + id, // A handshake from an agent that has since been closed still counts as evidence, so it keeps // its place with whatever name is left rather than being dropped for lack of a tab. name: nodes.find((n) => n.id === id)?.title ?? "an agent", @@ -1379,9 +1410,18 @@ function HandshakeLine({ .sort((a, b) => b.at - a.at); const last = named[0]; if (last === undefined) return null; + // The event is only the event while it is the newest one. An older handshake re-sorting to the + // top would otherwise inherit an arrival that was not its own. + const arriving = + fresh !== null && fresh === `${last.id}:${last.at}` && last.facts > 0; return (
`${h.name}: sent ${h.facts} fact${h.facts === 1 ? "" : "s"}`, @@ -1392,7 +1432,11 @@ function HandshakeLine({ "has not connected" look identical to a person, and only one of them means this works. */} {last.facts === 0 ? `Sent no facts to ${last.name} — nothing learned here yet` - : `Sent ${last.facts} fact${last.facts === 1 ? "" : "s"} to ${last.name}`} + : arriving + ? `${last.name} just opened already knowing ${last.facts} thing${ + last.facts === 1 ? "" : "s" + } about this project` + : `Sent ${last.facts} fact${last.facts === 1 ? "" : "s"} to ${last.name}`} {ago(last.at, now)}
); diff --git a/apps/identra-desktop/frontend/src/MemoryGraph.tsx b/apps/identra-desktop/frontend/src/MemoryGraph.tsx new file mode 100644 index 0000000..d51ed92 --- /dev/null +++ b/apps/identra-desktop/frontend/src/MemoryGraph.tsx @@ -0,0 +1,93 @@ +// What this project has changed its mind about, and where its knowledge came from. +// +// The list beside this answers "what do we know". It cannot answer "what did we used to think", and +// that is the question somebody asks the first time software hands them two hundred facts it +// extracted from a year of their own terminal history. A revision chain is the one thing in this +// data with a shape worth drawing: everything else is a list, and a list should stay one. +// +// It draws no agent-to-agent edge, ever. In Identra an edge between two agents is a permission the +// user granted, enforced in three places in the bus, and drawing that shape where it is not a +// permission is how a person learns to read it as decoration. See `memoryshape.ts`. +import { useMemo } from "react"; +import { buildGraph, type GraphFact } from "./memoryshape"; + +// Room for a readable stack without the panel needing its own scroll region for the diagram. Past +// this, the lane says how many more it holds rather than drawing them at one pixel each. +const PER_LANE = 8; + +export default function MemoryGraph({ + facts, + revised, +}: { + // Every fact in the store, not the browse page. A diagram has no scrollbar to admit a cap with. + facts: GraphFact[]; + revised: Map; +}) { + const graph = useMemo(() => buildGraph(facts, revised), [facts, revised]); + const revisedIds = useMemo( + () => new Set(graph.links.map((l) => l.from)), + [graph.links], + ); + const supersededBy = useMemo( + () => new Map(graph.links.map((l) => [l.from, l.to])), + [graph.links], + ); + const contentOf = useMemo( + () => new Map(facts.map((f) => [f.id, f.content])), + [facts], + ); + + if (graph.total === 0) return null; + + return ( +
+

+ {/* The count is the honesty: it says what was drawn, so nobody reads the picture as the + whole store when it is not. */} + {graph.total} fact{graph.total === 1 ? "" : "s"} from{" "} + {graph.lanes.length} source{graph.lanes.length === 1 ? "" : "s"} + {revisedIds.size > 0 + ? `, ${revisedIds.size} since revised` + : ", none revised"} + . +

+
    + {graph.lanes.map((lane) => ( +
  • + {lane.label} + + {lane.facts.slice(0, PER_LANE).map((f) => ( + + ))} + {lane.facts.length > PER_LANE && ( + + +{lane.facts.length - PER_LANE} + + )} + +
  • + ))} +
+
+ ); +} diff --git a/apps/identra-desktop/frontend/src/Onboarding.tsx b/apps/identra-desktop/frontend/src/Onboarding.tsx index c46c097..b55279e 100644 --- a/apps/identra-desktop/frontend/src/Onboarding.tsx +++ b/apps/identra-desktop/frontend/src/Onboarding.tsx @@ -21,7 +21,11 @@ import type { AgentInfo } from "./api"; // // A page rather than a shell command, deliberately: an install line drifts by OS, by version and // by package manager, and a wrong one on the first screen is worse than no line at all. -const LEAD = { id: "claude", name: "Claude Code", where: "claude.com/claude-code" }; +const LEAD = { + id: "claude", + name: "Claude Code", + where: "claude.com/claude-code", +}; const FRONTED = ["claude", "codex", "gemini", "opencode"]; type Props = { diff --git a/apps/identra-desktop/frontend/src/SettingsPanel.tsx b/apps/identra-desktop/frontend/src/SettingsPanel.tsx index c81b604..28529be 100644 --- a/apps/identra-desktop/frontend/src/SettingsPanel.tsx +++ b/apps/identra-desktop/frontend/src/SettingsPanel.tsx @@ -67,7 +67,9 @@ export default function SettingsPanel({ onClose }: { onClose: () => void }) { // On change rather than on blur, so it saves as you type and there is no // half-typed name lost to closing the panel. `apply` already rolls back and says // why if a write fails. - onChange={(e) => void apply({ ...settings, name: e.target.value })} + onChange={(e) => + void apply({ ...settings, name: e.target.value }) + } />