Understand any codebase instantly. System intelligence for codebases, built for humans and AI.
TypeScript aiai-memoryclaude-codeclicode-analysiscode-mappingcode-memorycodebase-understandingcodexdeveloper-toolsllmopenclawpersistent-memoryprogram-analysissoftware-architecturesystem-intelligencesystem-mapping
feat: ix reset — wipe graph for clean re-ingest
kagebinary2330d0701c35
diff --git a/ix-cli/src/cli/commands/reset.ts b/ix-cli/src/cli/commands/reset.tsnew file mode 100644index 00000000..dcf57b02--- /dev/null+++ b/ix-cli/src/cli/commands/reset.ts@@ -0,0 +1,35 @@+import type { Command } from "commander";+import chalk from "chalk";+import { IxClient } from "../../client/api.js";+import { getEndpoint } from "../config.js";++export function registerResetCommand(program: Command): void {+ program+ .command("reset")+ .description("Wipe all graph data (nodes + edges) for a clean re-ingest")+ .option("-y, --yes", "Skip confirmation prompt")+ .action(async (opts: { yes?: boolean }) => {+ if (!opts.yes) {+ process.stdout.write(+ chalk.yellow("This will delete all nodes and edges. Are you sure? (y/N) ")+ );+ const answer = await new Promise<string>(resolve => {+ process.stdin.setEncoding("utf8");+ process.stdin.once("data", (chunk: string) => resolve(chunk.trim()));+ });+ if (answer.toLowerCase() !== "y") {+ console.log(chalk.dim("Aborted."));+ return;+ }+ }++ const client = new IxClient(getEndpoint());+ try {+ await client.reset();+ console.log(chalk.green("✓") + " Graph wiped. Run " + chalk.bold("ix ingest . --recursive") + " to re-ingest.");+ } catch (err: any) {+ console.error(chalk.red("Error:"), err.message);+ process.exitCode = 1;+ }+ });+}diff --git a/ix-cli/src/cli/register/oss.ts b/ix-cli/src/cli/register/oss.tsindex fd6c5894..b67b53d9 100644--- a/ix-cli/src/cli/register/oss.ts+++ b/ix-cli/src/cli/register/oss.ts@@ -26,6 +26,7 @@ import { registerWatchCommand } from "../commands/watch.js";import { registerDockerCommand } from "../commands/docker.js";import { registerWorkflowsHelpCommand } from "../commands/workflows.js";import { registerMapCommand } from "../commands/map.js";+import { registerResetCommand } from "../commands/reset.js";const PRO_COMMANDS: { name: string; desc: string }[] = [{ name: "briefing", desc: "Session-resume briefing" },@@ -78,6 +79,7 @@ export function registerOssCommands(program: Command): void {registerDockerCommand(program);registerWorkflowsHelpCommand(program);registerMapCommand(program);+ registerResetCommand(program);// Hide advanced commands from default helpconst advancedSet = new Set(ADVANCED_COMMANDS);diff --git a/ix-cli/src/client/api.ts b/ix-cli/src/client/api.tsindex 0e2e9138..0af60ea7 100644--- a/ix-cli/src/client/api.ts+++ b/ix-cli/src/client/api.ts@@ -178,6 +178,10 @@ export class IxClient {return this.post("/v1/map", {});}+ async reset(): Promise<{ ok: boolean; message: string }> {+ return this.post("/v1/reset", {});+ }+async stats(): Promise<any> {return this.get("/v1/stats");}diff --git a/memory-layer/src/main/scala/ix/memory/api/ResetRoutes.scala b/memory-layer/src/main/scala/ix/memory/api/ResetRoutes.scalanew file mode 100644index 00000000..9b1847e1--- /dev/null+++ b/memory-layer/src/main/scala/ix/memory/api/ResetRoutes.scala@@ -0,0 +1,23 @@+package ix.memory.api++import cats.effect.IO+import io.circe.Json+import io.circe.syntax._+import org.http4s.HttpRoutes+import org.http4s.circe.CirceEntityCodec._+import org.http4s.dsl.io._++import ix.memory.db.ArangoClient++class ResetRoutes(client: ArangoClient) {++ val routes: HttpRoutes[IO] = HttpRoutes.of[IO] {++ /** POST /v1/reset — Truncate all graph data (nodes + edges). Dev use only. */+ case POST -> Root / "v1" / "reset" =>+ (for {+ _ <- client.truncateGraph()+ r <- Ok(Json.obj("ok" -> true.asJson, "message" -> "Graph reset. All nodes and edges deleted.".asJson))+ } yield r).handleErrorWith(ErrorHandler.handle(_))+ }+}diff --git a/memory-layer/src/main/scala/ix/memory/api/Routes.scala b/memory-layer/src/main/scala/ix/memory/api/Routes.scalaindex f2dd63db..f97e5f3c 100644--- a/memory-layer/src/main/scala/ix/memory/api/Routes.scala+++ b/memory-layer/src/main/scala/ix/memory/api/Routes.scala@@ -44,11 +44,12 @@ object Routes {val patchCommitRoutes = new PatchCommitRoutes(writeApi).routesval listRoutes = new ListRoutes(queryApi).routesval mapRoutes = new MapRoutes(mapService).routes+ val resetRoutes = new ResetRoutes(client).routeshealth <+> contextRoutes <+> entityRoutes <+>diffRoutes <+> conflictRoutes <+> decideRoutes <+> searchRoutes <+>truthRoutes <+> patchRoutes <+> decisionListRoutes <+> expandRoutes <+>statsRoutes <+> patchCommitRoutes <+> listRoutes <+> goalRoutes <+>- mapRoutes+ mapRoutes <+> resetRoutes}}diff --git a/memory-layer/src/main/scala/ix/memory/db/ArangoClient.scala b/memory-layer/src/main/scala/ix/memory/db/ArangoClient.scalaindex 833bc01a..eacfee62 100644--- a/memory-layer/src/main/scala/ix/memory/db/ArangoClient.scala+++ b/memory-layer/src/main/scala/ix/memory/db/ArangoClient.scala@@ -106,6 +106,14 @@ class ArangoClient private (db: ArangoDatabase) {}def ensureSchema(): IO[Unit] = ArangoSchema.ensure(db)++ /** Truncate all graph collections (nodes + edges). Destructive — dev use only. */+ def truncateGraph(): IO[Unit] =+ IO.blocking {+ db.collection("nodes").truncate()+ db.collection("edges").truncate()+ ()+ }}object ArangoClient {