Skip to content

armgit / Ix

Public Imported from GitHub
0

Understand any codebase instantly. System intelligence for codebases, built for humans and AI.

adding to match readme

riley0227ad8a2d0c4ccb
diff --git a/build.sbt b/build.sbt
index f3d768a1..6fdc24c3 100644
--- a/build.sbt
+++ b/build.sbt
@@ -45,7 +45,16 @@ lazy val memoryLayer = (project in file("memory-layer"))
assembly / mainClass := Some("ix.memory.Main"),
assembly / assemblyJarName := "ix-memory-layer.jar",
assembly / assemblyMergeStrategy := {
- case PathList("META-INF", _*) => MergeStrategy.discard
- case _ => MergeStrategy.first
+ case PathList("META-INF", "services", _*) => MergeStrategy.concat
+ case PathList("META-INF", "vertx", _*) => MergeStrategy.first
+ case PathList("META-INF", "MANIFEST.MF") => MergeStrategy.discard
+ case PathList("META-INF", "NOTICE", _*) => MergeStrategy.discard
+ case PathList("META-INF", "LICENSE", _*) => MergeStrategy.discard
+ case PathList("META-INF", "NOTICE.txt") => MergeStrategy.discard
+ case PathList("META-INF", "LICENSE.txt") => MergeStrategy.discard
+ case PathList("META-INF", "NOTICE.md") => MergeStrategy.discard
+ case PathList("META-INF", "LICENSE.md") => MergeStrategy.discard
+ case PathList("META-INF", _*) => MergeStrategy.first
+ case _ => MergeStrategy.first
}
)
diff --git a/dev.sh b/dev.sh
new file mode 100755
index 00000000..57047dd2
--- /dev/null
+++ b/dev.sh
@@ -0,0 +1,51 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+cd "$SCRIPT_DIR"
+
+case "${1:-up}" in
+ up)
+ if ! command -v docker &> /dev/null; then
+ echo "Error: Docker is not installed."
+ exit 1
+ fi
+ if ! docker info &> /dev/null 2>&1; then
+ echo "Error: Docker is not running."
+ exit 1
+ fi
+
+ echo "Starting ArangoDB..."
+ docker compose up -d arangodb
+
+ echo "Waiting for ArangoDB..."
+ for i in $(seq 1 20); do
+ if curl -sf http://localhost:8529/_api/version > /dev/null 2>&1; then
+ echo "ArangoDB is ready at http://localhost:8529"
+ break
+ fi
+ sleep 1
+ done
+
+ echo ""
+ echo "Starting Memory Layer via sbt..."
+ ARANGO_HOST=localhost \
+ ARANGO_PORT=8529 \
+ ARANGO_DATABASE=ix_memory \
+ ARANGO_USER=root \
+ ARANGO_PASSWORD="" \
+ PORT=8090 \
+ sbt "memoryLayer/run"
+ ;;
+ stop)
+ docker compose stop arangodb
+ echo "ArangoDB stopped."
+ ;;
+ *)
+ echo "Usage: ./dev.sh [up|stop]"
+ echo ""
+ echo " up Start ArangoDB in Docker + Memory Layer via sbt (default)"
+ echo " stop Stop ArangoDB container"
+ exit 1
+ ;;
+esac
diff --git a/docker-compose.yml b/docker-compose.yml
index 1663a134..7e829dbe 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -5,3 +5,35 @@ services:
- "8529:8529"
environment:
ARANGO_NO_AUTH: "1"
+ volumes:
+ - arangodb-data:/var/lib/arangodb3
+ healthcheck:
+ test: ["CMD", "wget", "--spider", "-q", "http://localhost:8529/_api/version"]
+ interval: 5s
+ timeout: 3s
+ start_period: 10s
+ retries: 5
+
+ memory-layer:
+ build: ./memory-layer
+ ports:
+ - "8090:8090"
+ environment:
+ ARANGO_HOST: arangodb
+ ARANGO_PORT: "8529"
+ ARANGO_DATABASE: ix_memory
+ ARANGO_USER: root
+ ARANGO_PASSWORD: ""
+ PORT: "8090"
+ depends_on:
+ arangodb:
+ condition: service_healthy
+ healthcheck:
+ test: ["CMD", "curl", "-sf", "http://localhost:8090/v1/health"]
+ interval: 10s
+ timeout: 3s
+ start_period: 15s
+ retries: 5
+
+volumes:
+ arangodb-data:
diff --git a/memory-layer/Dockerfile b/memory-layer/Dockerfile
new file mode 100644
index 00000000..8b8088fe
--- /dev/null
+++ b/memory-layer/Dockerfile
@@ -0,0 +1,8 @@
+FROM eclipse-temurin:17-jre-jammy
+RUN apt-get update && apt-get install -y --no-install-recommends curl && rm -rf /var/lib/apt/lists/*
+WORKDIR /app
+COPY target/scala-2.13/ix-memory-layer.jar app.jar
+EXPOSE 8090
+HEALTHCHECK --interval=10s --timeout=3s --start-period=15s --retries=3 \
+ CMD curl -sf http://localhost:8090/v1/health || exit 1
+CMD ["java", "-jar", "app.jar"]
diff --git a/stack.sh b/stack.sh
new file mode 100755
index 00000000..53f1cd9a
--- /dev/null
+++ b/stack.sh
@@ -0,0 +1,83 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+cd "$SCRIPT_DIR"
+
+JAR_PATH="memory-layer/target/scala-2.13/ix-memory-layer.jar"
+
+check_docker() {
+ if ! command -v docker &> /dev/null; then
+ echo "Error: Docker is not installed."
+ exit 1
+ fi
+ if ! docker info &> /dev/null 2>&1; then
+ echo "Error: Docker is not running."
+ exit 1
+ fi
+}
+
+build_jar() {
+ local force="${1:-false}"
+ if [ "$force" = "true" ] || [ ! -f "$JAR_PATH" ]; then
+ echo "Building Memory Layer JAR..."
+ sbt "memoryLayer/assembly" 2>&1 | tail -5
+ else
+ echo "JAR already exists, skipping build. Use 'rebuild' to force."
+ fi
+}
+
+wait_for_health() {
+ echo "Waiting for services to become healthy..."
+ for i in $(seq 1 30); do
+ if curl -sf http://localhost:8090/v1/health > /dev/null 2>&1; then
+ echo ""
+ echo "Ix backend is ready!"
+ echo " Memory Layer: http://localhost:8090"
+ echo " ArangoDB: http://localhost:8529"
+ return 0
+ fi
+ printf "."
+ sleep 2
+ done
+ echo ""
+ echo "Warning: Health check timed out. Check 'docker compose logs' for details."
+ return 1
+}
+
+case "${1:-up}" in
+ up)
+ check_docker
+ build_jar
+ echo "Starting Ix backend..."
+ docker compose up -d --build
+ wait_for_health
+ ;;
+ down)
+ docker compose down
+ echo "Ix backend stopped."
+ ;;
+ logs)
+ docker compose logs -f
+ ;;
+ rebuild)
+ check_docker
+ build_jar true
+ echo "Rebuilding and starting Ix backend..."
+ docker compose up -d --build
+ wait_for_health
+ ;;
+ status)
+ docker compose ps
+ ;;
+ *)
+ echo "Usage: ./stack.sh [up|down|logs|rebuild|status]"
+ echo ""
+ echo " up Build JAR (if needed) and start all services (default)"
+ echo " down Stop all services"
+ echo " logs Tail service logs"
+ echo " rebuild Force rebuild JAR and restart services"
+ echo " status Show service status"
+ exit 1
+ ;;
+esac
diff --git a/templates/CLAUDE.md.template b/templates/CLAUDE.md.template
new file mode 100644
index 00000000..112edbf9
--- /dev/null
+++ b/templates/CLAUDE.md.template
@@ -0,0 +1,15 @@
+# Ix Memory System
+
+This project uses Ix Memory for persistent, time-aware context.
+
+## Project
+- Name: {{PROJECT_NAME}}
+
+## MANDATORY RULES
+1. BEFORE answering any question about this codebase → call ix_query
+2. AFTER making any design/architecture decision → call ix_decide
+3. When noticing contradictory information → call ix_conflicts
+4. NEVER guess about codebase facts when Ix has structured data
+5. After modifying code → call ix_ingest on changed files
+6. At start of each session → review ix://session/context for prior work
+7. When the user states a goal → call ix_truth to record it
diff --git a/templates/claude_desktop_config.json.template b/templates/claude_desktop_config.json.template
new file mode 100644
index 00000000..eeeedc15
--- /dev/null
+++ b/templates/claude_desktop_config.json.template
@@ -0,0 +1,12 @@
+{
+ "mcpServers": {
+ "ix-memory": {
+ "command": "ix",
+ "args": ["mcp", "start"],
+ "env": {
+ "IX_ENDPOINT": "{{IX_ENDPOINT}}",
+ "IX_PROJECT": "{{IX_PROJECT}}"
+ }
+ }
+ }
+}