Skip to content

About

Read, evaluate, and refactor every code repository.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

Code Scalpel logo

Code Scalpel

English · 简体中文

Read · Evaluate · Refactor every code repository.
Turn multilingual source code into one engineering workbench for static analysis, knowledge graphs, project profiles, document and diagram authoring, AI agents, and task observability.

Product Tour · Core Capabilities · System Design · Run Locally · Quality Gates

Go 1.25 Gin Next.js 14 React 18 PostgreSQL and Neo4j License: AGPL-3.0

What Code Scalpel Solves

Knowledge in a mature codebase is usually scattered across source files, dependency relationships, commit history, personal notes, architecture diagrams, and the minds of a few engineers who know the system well. Traditional code browsers can open files, but they struggle to answer these questions together:

  • What problem does this repository solve, and where are its core boundaries and major modules?
  • Who calls a symbol, how do dependencies propagate across packages, and what could a change affect?
  • How can analysis become readable, reusable, and editable profiles, documents, and diagrams?
  • What context is AI reading, which tools is it running, and what tasks and artifacts has it produced?
  • Are multilingual analysis workers, generation jobs, and supporting services healthy?

Code Scalpel treats a Codeset as the boundary of a code asset. Multilingual workers analyze source code into structured semantic data and a Neo4j graph. Project Profile, File Browser, Graph Explorer, Cody, Studio, Articles, Diagrams, Paradigms, and agent workflows all consume that shared knowledge. Product pages are not a collection of disconnected tools; they are different views of the same engineering knowledge for different jobs.

Product principle How Code Scalpel delivers it
A code repository is the fundamental unit of work A Codeset unifies source, analysis jobs, files, graphs, profiles, artifacts, and project spaces
Human-readable and machine-readable outputs matter equally Long-form profiles, code views, and diagrams serve people; OpenAPI, graph queries, and structured artifacts serve automation
Semantics come before text matching Types, symbols, calls, imports, packages, control flow, and domain relationships enter a shared graph and query layer
Understanding and authoring form a closed loop Analysis can continue into Studio, document collections, diagram sets, paradigms, and the Market instead of ending as a disposable report
AI must be observable Sessions, steps, tools, Memory, asynchronous tasks, and service health all have explicit inspection points
Dependency failures must be visible Health checks, task states, and quality gates fail closed instead of presenting silent degradation as success

Product Tour

Every screen below comes from locally running Code Scalpel Web and API services. None is a static mockup assembled for this README.

Start with a Code Repository

Landing: One Entry Point for Understanding, Evaluation, and Refactoring

The landing page establishes the central idea behind Code Scalpel: the same code knowledge should be readable by engineers and reliably consumable by agents, automation, and other systems.

Code Scalpel landing page

Codesets: Manage and Filter Code Assets

Codesets collect connected repositories and filter them by type, language, framework, source, license, visibility, and analysis status. Projects enter the analysis pipeline through ZIP upload or a Git source, while the inventory shows progress, scale, and update time.

Code Scalpel codeset inventory with filters and repository cards

Project Profile: Turn Source Code into a Navigable, In-Depth Project Profile

A project profile is more than a summary. It organizes purpose, use cases, architecture, modules, interfaces, runtime flows, risks, and a reading path into a long-form analysis while preserving source-file navigation so every conclusion can lead back to code evidence.

Code Scalpel project profile with outline, generated analysis, and source files

File Browser: Read Code and Documentation in Repository Context

File Browser places the directory tree, source and Markdown reading, search, Outline, analysis views, annotations, and Cody conversations on one page. Engineers can move from a file into symbols and graphs or carry the current context into later authoring work.

Code Scalpel file browser with repository tree and source viewer

Graph Explorer: See System Structure through Symbol Relationships

Graph Explorer provides Graph, Map, and Card projections, with entity filters and inspection for files, packages, classes, interfaces, methods, calls, and dependencies. The backend query layer also addresses engineering questions such as neighbors, subgraphs, call paths, impact analysis, dependency cycles, complexity, hotspots, implementation relationships, field access, and snapshot differences.

Code Scalpel knowledge graph explorer with entity filters and relationship canvas

Move from Understanding to Authoring

Studio: A Typed Canvas for Documents, Diagrams, and AI Collaboration

Studio switches between personal and Codeset project spaces. Document, Mermaid, D2, Graphviz, PlantUML, Markmap, draw.io, and Excalidraw assets use editors and previewers suited to their formats. The AI panel shares file context, selection references, quick edits, and task feedback.

Code Scalpel Studio with asset tree, document canvas, and AI assistant

Diagram Sets: A Multi-Engine Diagram Library

Diagram Sets manage source, rendered output, tags, versions, visibility, and publication state across multiple diagram engines. A diagram can save checkpoints, publish to the Market, fork, reindex, continue editing in Studio, or become a Paradigm.

Code Scalpel diagram library with multi-engine previews and filters

Articles: Organize Engineering Material into Searchable Document Collections

Articles organize content by collection, topic, tag, source, and visibility. They support Markdown preview, publishing, pinning, forking, automatic tagging, and structure extraction. Documents and Codeset notes share search and filter entry points and can also be refined into paradigms.

Code Scalpel article collection with topics, filters, document list, and preview

Paradigms: Turn One-Off Results into Reusable Patterns

Paradigms connect Codesets, Documents, and Diagrams. Users can derive patterns from existing assets, maintain versions and relationships, or combine multiple paradigms into a new draft so project experience becomes discoverable and composable knowledge instead of a one-time deliverable.

Code Scalpel paradigm shelf with reusable knowledge cards and filters

Sharing, Agents, and Runtime Observability

Market: A Shared Shelf across Asset Types

Market brings published Codesets, Diagrams, Documents, and Skills into one search, filtering, and sorting experience. Public assets can be viewed, copied, or forked and then evolved in a personal workspace.

Code Scalpel market with published codesets, diagrams, documents, and skills

Tack: The Agent Control Plane

Tack is the overview for the agent runtime. It brings together Skills, Tools, Memory, Hooks, model and Provider bindings, tool routing, and recent changes. The control plane makes both what an agent can do and what it actually depends on inspectable.

Code Scalpel Tack overview with skill, tool, memory, and provider statistics

Skills: Discoverable, Copyable, and Executable Agent Capabilities

A Skill describes a reusable capability through a role prompt, allowed tools, and behavioral boundaries. The catalog supports categories, search, details, copying, and execution. Together with Tools, Memory, model configuration, and Agent Sessions, it forms the runtime.

Code Scalpel skill catalog with categories and capability cards

Tasks: Observe Analysis, Generation, and Agent Work in One Place

Tasks aggregates Analysis, Generation, Agent, Profile Card, Routine, and other task types with filters for state, time, Codeset, language, and Worker. Failed, queued, running, and completed work remains explicit instead of collapsing into an ambiguous status.

Code Scalpel task monitor with status filters and task records

Services: Health from the API to Worker Pools

Services reports the health of the API, PostgreSQL, Redis, Neo4j, MinIO, renderers, the generation Worker, and multilingual analysis Workers. It also provides operational entry points for Prometheus, Grafana, Neo4j Browser, object storage, and related services.

Code Scalpel service health page with runtime dependencies and worker pools

Core Capabilities

Domain Delivered capabilities
Codeset lifecycle Creation, ZIP/Git ingestion, upload, analysis triggers, task queries, visibility, and metadata management
Multilingual static analysis Go, Java, Rust, TypeScript/JavaScript, C, C++, Python, and multilingual Workers; symbols, types, calls, imports, control flow, and extended analysis
Project understanding Project Profile, file tree, source and Markdown reading, Outline, code annotations, Cody Q&A, generated artifacts, and revision chains
Knowledge graph Graph/Map/Card, search, neighbors, subgraphs, communities, call paths, impact, complexity, coupling, dead code, hotspots, snapshots, and diffs
Studio Personal/project spaces, typed document and diagram Canvas, source/Live views, AI edits, annotations, collaborative snapshots, and revisions
Diagrams Mermaid, D2, Graphviz, PlantUML, Markmap, draw.io, and Excalidraw; versions, thumbnails, publication, forking, and search
Documents Collections, topics, tags, preview, publication, pinning, forking, extraction, automatic tagging, comments, collaborators, and revisions
Paradigms Derivation from assets, version management, relationships, merged drafts, confirmation, and publication
Agent platform Sessions, steps, streaming output, cancellation, Skills, Tools, Memory, Providers, model bindings, policies, and tool routing
Routines Scheduled/manual triggers, Handlers, run records, forking, and recent execution history
Market Unified publication, discovery, and reuse of Codesets, Diagrams, Documents, and Skills
Observability Global task center, service health, Worker Pools, Prometheus metrics, Grafana, and structured logs
API and CLI JWT-protected /api/v1 API; CLI coverage for authentication, Codesets, uploads, analysis, graph, and Job workflows
Internationalization UI resources for Simplified Chinese, Traditional Chinese, English, Japanese, Korean, and Russian

Data, AI, and Security Boundaries

Data layer Storage and purpose Default boundary
Business and task state PostgreSQL Accessed through JWT-protected domain APIs, never directly from the frontend
Code and uploaded objects MinIO or S3-compatible storage Object-storage credentials stay on the server; browsers use controlled upload and download paths
Semantic relationships Neo4j Written and queried through Graph APIs and analysis Workers
Cache and rate limits Redis Used by server-side components; durable jobs and events remain in PostgreSQL
Agent Memory and Sessions PostgreSQL + Agent API Memory, steps, tool calls, and artifacts can be inspected and deleted independently
LLM Providers OpenAI-compatible / Claude / Qwen / GLM / MiniMax / custom endpoints AI features clearly report unavailability when unconfigured; ordinary code and content modules do not depend on Provider success
Web authentication Bearer JWT All APIs use the /api/v1 prefix; cross-origin cookie credentials are not used
Local configuration .env (excluded from Git) Deployers must supply database, JWT, object storage, internal token, and model secrets

System Design

Code Scalpel is a modular Go + Next.js monorepo. Caddy or an equivalent L7 edge routes Web, API, SSE, and collaboration traffic to the Next.js BFF, Gin API, and Hocuspocus. Gin owns authentication and domain orchestration; PostgreSQL also acts as the durable job and event bus for analysis and generation Workers. Neo4j stores semantic graphs, MinIO/S3 stores source and artifacts, and Redis serves API-side caching and rate limiting.

Code Scalpel source-backed system architecture

Technology Stack

Layer Primary technologies
Web Next.js 14 App Router, React 18, TypeScript, Tailwind CSS, React Query, and Zustand
Editing and rendering CodeMirror 6, Monaco, Plate, Excalidraw, Mermaid, D2, Graphviz, PlantUML, Markmap, and draw.io
Graphs and visualization Neo4j, G6, MapLibre, and React Flow
API Go 1.25, Gin, GORM, JWT, and OpenAPI
Workers Go plus independent containers for Java, Rust, TypeScript, C/C++, Python, and multilingual analysis
Data PostgreSQL, Neo4j, Redis, and MinIO/S3
Collaboration and operations Hocuspocus/Yjs, Prometheus, Grafana, and Docker Compose

Monorepo Layout

Directory Responsibility
backend/ Gin API, domain services, analysis/generation Workers, CLI, databases, and deployment infrastructure
frontend/ Next.js Web, Studio, Codeset, Graph, Articles, Diagrams, Tack, Tasks, and Market
.github/ CI and repository automation
scripts/ Monorepo-level maintenance and validation scripts

Run Locally

Requirements

  • Docker Engine + Docker Compose v2;
  • Go 1.25.11 for local backend development;
  • Node.js 22 and npm for local frontend development;
  • Sufficient disk and network capacity for the first full build of all multilingual Workers.

Get the Source

git clone git@github.com:quboliu/code-scalpel.git
cd code-scalpel
make setup
make hooks

Start the Backend and Dependencies

cp backend/deployments/.env.example backend/deployments/.env
make backend-stack-up

The backend API is available at http://localhost:8080 by default:

curl http://localhost:8080/health
curl http://localhost:8080/ready

Start the Frontend

Development mode:

make frontend-dev

Container mode:

scripts/compose.sh -f frontend/docker-compose.yml up -d --build

The frontend always uses http://localhost:3000. For local development, the recommended setup uses the Caddy edge proxy on :8000 to place Web, API, and the collaborative WebSocket on one origin. Local frontend commands keep dependencies, the mirrored execution workspace, Next output, and test artifacts under ${HOME}/.local/state/code-scalpel-build/projs/code-scalpel/; the Aranya source tree contains no compatibility symlink.

Default Local Ports

Service Port
Web 3000
API 8080
Edge proxy 8000
PostgreSQL 5433
Neo4j Browser / Bolt 7474 / 7687
Redis 6379
MinIO API / Console 9000 / 9001
Prometheus / Grafana 9090 / 3001

See backend/README.md and frontend/README.md for complete deployment and configuration guidance.

Quality Gates

make check          # Fast static checks and unit tests for both applications
make test           # Go and frontend unit tests
make build          # Backend binaries and frontend production build
make gate           # Complete monorepo pre-push gate
make backend-gate   # Go vet, lint, build, test, and coverage threshold
make frontend-gate  # Lint, typecheck, OpenAPI drift, Vitest, build, and conditional Studio ST

Key constraints:

  • OpenAPI routes and generated types are checked for drift;
  • Backend coverage has a hard threshold;
  • Enabled dependency-backed tests must fail when they cannot reach a real dependency; they may not silently skip;
  • Studio-related changes trigger a real-stack smoke test, and full acceptance can run npm --prefix frontend run test:st;
  • The Git pre-push hook runs the monorepo gate by default.

Security and Privacy

  • Never commit real .env files, private keys, access tokens, Provider keys, production databases, or raw user payloads;
  • All external APIs use Bearer tokens, and CORS does not enable cookie credentials;
  • Replace example Compose passwords, JWT secrets, internal tokens, and object-storage credentials before any external deployment;
  • Report vulnerabilities privately through GitHub Security Advisories instead of disclosing exploit details in a public Issue;
  • See backend/THIRD_PARTY_NOTICES.md for third-party component and asset notices.

License

Code Scalpel is licensed under the GNU Affero General Public License v3.0. If you modify this project and make it available to users over a network, the AGPLv3 requires you to offer those users the complete corresponding source code for that version. Third-party dependencies and assets remain subject to their respective licenses.

Graph project credits

  • CodeGraph informed how Code Scalpel models symbols and relationships and how its agents look up callers and callees before reading source files. Code Scalpel’s analysis workers build the graph and its agents query it in Neo4j. © 2026 Colby Mchenry. CodeGraph repository · MIT license
  • Understand-Anything is the source of code adapted for the Cards view, including the theme presets and fuzzy-search field weights. Cards uses these dashboard features with Code Scalpel’s own code, knowledge, and domain graphs. © 2026 Yuxiang Lin and Infinite Universe, Inc. Understand-Anything repository · MIT license
MIT notice for code adapted from Understand-Anything
MIT License

Copyright (c) 2026 Yuxiang Lin
Copyright (c) 2026 Infinite Universe, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

About

Read, evaluate, and refactor every code repository.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages