e↗entertrainment
← All project stories
Developer tools / PROJECT STORY

SwiftProjectAnalyzer

Explore the structure of Swift projects and turn source relationships into inspectable information for developers and their tools.

Source analysis toolkit12 MIN READDEVELOPMENT ARCHIVE · OCT 2026
PROJECT REVIEW · 18 October 2026

Inside the project

Prepared with the project’s development agent from source and retained evidence. This is a project-owner assessment, not an independent customer review. Dated checks were not rerun for this website.

SwiftProjectAnalyzer is most useful when a Swift codebase has outgrown anyone's mental map of it. It builds one typed semantic model of every type, member and relationship and answers practical questions from it: what depends on what, how healthy the code is, and what would have to come along if one method moved to another project. Its strongest working pieces are fast parser-only scanning with diagrams and linked-data exports, a local code-health layer with 20 rules, a health score, SARIF output and a small set of safe autofixes, and editor intelligence driven through Apple's sourcekit-lsp. Its most original idea is the semantic-MIDI 'code spine', which scores each type and renders the codebase as a piano roll that can be played. It is a working personal tool rather than a product. It builds only on its author's Mac, has no public release, and its index-store mode does not yet cope with very large apps.

What stands out

  • Parser-only scan is practical at app scale: 4,688 files, 17,879 symbols and 1.25M reference edges in 3.6 minutes (heuristic mode, warm cache, run 2026-10-04)
  • One model feeds many outputs: DOT/Mermaid diagrams, JSON-LD, NDJSON, deterministic CBOR-LD, and a reloadable typed snapshot that re-exports in seconds
  • Local code health: 20 stable-ID rules, 0-100 score, trend history, new-vs-fixed baseline diff, SARIF 2.1.0 for GitHub code scanning
  • Conservative autofix (as! to as?, remove '?? nil', drop stray print, trailing semicolons); every fix is single-line and overlap-guarded
  • Two-way LSP: queries sourcekit-lsp for hover, definition, references, completion and formatting, and can itself serve diagnostics and quick-fixes to editors
  • Dependency-closure transplant planning down to a single method, with unresolved items reported explicitly
  • Semantic-MIDI code spine consumed by AssistantApp and playable in the workbench

Current limits

  • Builds only on the author's machine: depends on local-path packages (indexstore-db, SemanticControlCore, Swift-CBORLD)
  • No public release, git remote, licence statement or signing beyond ad-hoc
  • IndexStoreDB-backed resolution did not finish on AssistantApp (>20 min, observed 2026-10-04); parser-only mode is the practical option for large apps
  • Parser-only mode leaves most SDK and external references unresolved (about 79% on one AssistantApp subsystem)
  • Include globs starting with '**/' silently match nothing (bug, identified 2026-10-04)
  • Transplant validation does not run a real destination build
  • No screenshots or recordings exist yet

Features & evidence

Semantic scan and graph export

component-tested

Point it at a Swift project; get a typed graph as DOT/Mermaid diagrams or JSON-LD/NDJSON/CBOR-LD data

Recorded evidence

Source since 2026-03-23 initial commit; Swift Testing suites in Tests/; runtime runs on an AssistantApp subtree and full tree, 2026-10-04 (session evidence)

Snapshots

component-tested

Save the scan once, re-export other formats without rescanning

Recorded evidence

75-file subsystem re-exported to DOT + spine + metrics in 5.5 s, 2026-10-04 (session)

Code health (lint / health / trend / rules / config)

component-tested

Run lint or health; read findings by file, a 0-100 score and severity/category breakdown; record trend points; tune via .spa-quality.toml

Recorded evidence

11 XCTest cases passed 2026-07-14; health on AssistantApp ContextAssistant scored 88.5 (75 files, 381 issues), 2026-10-04 (session)

Baseline diff and SARIF

component-tested

Save a baseline, then report only newly introduced issues; export SARIF for GitHub code scanning

Recorded evidence

SARIF 2.1.0 parsed as valid JSON and baseline diff tests passed 2026-07-14; GitHub workflow file present but never run (no remote)

Autofix

component-tested

Apply four safe mechanical fixes, plus SwiftFormat if installed

Recorded evidence

Rewrites verified on sample files 2026-07-14, including non-ASCII and overlapping-fix cases

Coverage

component-tested

Ingest llvm-cov/xccov JSON or generate coverage by running swift test

Recorded evidence

--run-coverage reported 82.6% on a sample package, 2026-07-14 (session)

IDE intelligence (intel commands)

component-tested

Hover, definition, references, completion, symbols, formatting and workspace symbols via sourcekit-lsp

Recorded evidence

Hover returned type plus doc comment 2026-07-14 (session); not covered by committed tests

Analyzer language server (serve-lsp)

component-tested

Run as an LSP server so editors show findings and quick-fixes

Recorded evidence

Scripted JSON-RPC client confirmed initialize, analyzer/health, analyzer/graph and codeAction, 2026-07-14 (session)

Transplant planner/applier

source

Select Module.Type#method and a destination; review the dependency closure; optionally apply

Recorded evidence

Source present since 2026-03-23; runtime not verified by this agent

Semantic-MIDI code spine

component-tested

Score each type and export a spine archive for AssistantApp; view and play it in the workbench

Recorded evidence

CodeSpineProducerTests in Tests/; 638-chunk / 443-relation spine produced 2026-10-04 (session)

Workbench app

unknown

Native macOS window covering pipeline, code health, intelligence and spine sections

Recorded evidence

Source and 9 UI-logic tests present; dist/ app bundle reports version 4afa5a3 (initial commit) so may predate current UI; not launched or visually verified by this agent

Release packaging

source

Local script builds a checksummed tarball

Recorded evidence

Test tarball dist/SwiftProjectAnalyzer-v0.1.0-test-darwin-arm64.tar.gz built 2026-07-14T20:38Z; never published

Review updates & corrections
  • No new commits since 17 Oct: still 2 commits, latest e4c1eec (2026-09-14); later work remains uncommitted
  • Still no screenshots, video or audio in the repo or intake folders
  • Correction: Swift-CBORLD now has its own collected entry (2026-10-17/responses/swift-cborld-collected.md), so it no longer counts as uncovered
  • Clarification: the 10-04 runtime numbers come from this agent's session runs, not committed evidence; publish them as 'author-measured' or re-verify
  • Clarification: the workbench bundle in dist/ predates later UI work, so describe sections from source, not from a verified running app

Workflow walkthrough

A guide to the native workflow. These steps describe the app; only the recordings and images embedded on this page are available as website demonstrations.

  1. Open the workbench and choose a project root; the run rail shows the exact command before it runs
  2. Run a 'graph scan' preset to produce a DOT diagram and a reusable snapshot
  3. Open Code Health to see the score and filterable findings, then export SARIF
  4. In Symbol Intel, hover a symbol to get compiler type information from sourcekit-lsp
  5. Load the produced semantic-MIDI spine in Semantic Spine, view the piano roll, and play it
  6. Status: proposed native capture only. Nothing is playable on the website and no capture exists
Planned captures · not yet available
  • One window for the whole pipeline: pick a preset and see the exact command before it runs.
  • Code health computed locally: score, severity breakdown and findings by file.
  • A typed semantic graph: calls, conformances and extensions.
  • Listening to code structure: the semantic-MIDI spine played as a piano roll.
  • Sample SARIF / Markdown quality report.

Development biography · earlier archive

Development profile compiled from project source and retained records in October 2026. Dates and test results describe those records; they do not imply a new build, live acceptance test or public release.

Biography

Large Swift projects outgrow the developer's mental map of them. When code is spread across many checkouts, agent worktrees and sibling packages, ordinary questions get hard to answer. What does this type actually depend on? Can this method be lifted into another app without dragging half the codebase with it? Is this branch getting healthier or worse? IDEs answer some of these one file at a time, and code-quality services answer others for one repository in the cloud. SwiftProjectAnalyzer answers them locally, on the developer's own Mac, from a single semantic model.

The project's operating rules describe it as "a semantic graph + reasoning system, not just a parser". Its stated priorities are "correctness over cleverness", "structure over heuristics" and "explicitness over inference". In practice that means four things:

  • Every symbol gets a deterministic identifier (swift://Module.SymbolPath).
  • Every relationship is a typed, directional edge.
  • Source provenance (file, line, range) is never thrown away.
  • Anything the tool could not resolve is marked explicitly instead of guessed.

How it works. A collection pass walks each file's syntax tree and classifies classes, structs, enums, protocols, actors, extensions, methods, initialisers, properties, typealiases, associated types, enum cases, operators and macros. Results are cached per file, so repeat scans are fast. A resolution pass links references to definitions. When an Xcode or SwiftPM index store is available it can use Apple's IndexStoreDB for compiler-grade resolution, and otherwise it falls back to syntax heuristics. The resulting graph can be written out in several formats:

  • JSON-LD or NDJSON, for linked-data tools.
  • Deterministic CBOR-LD, for compact, self-describing interchange.
  • An internal typed CBOR snapshot, which can be reloaded without rescanning.
  • DOT or Mermaid diagrams, to view.

Transplants are the most distinctive feature. Give SPA a selector such as Module.Type#method, a destination project and a destination module. It computes the method's dependency closure, meaning the symbols, files and imports that must come with it, and produces a transplant plan. That plan lists unresolved dependencies, access-level problems and platform constraints. The plan can be saved, reviewed, and then applied. The design principle is that "transplant safety depends on closure completeness, not graph size". The README is candid about the remaining gap: validation does not yet run a real swift build of the destination.

The semantic-MIDI code spine is the unusual part. SPA can project a codebase into one "chunk" per top-level type and score each chunk on confidence, novelty, portability, adaptation cost, dependency pressure and collision risk. Those scores are routed through the SemanticControlCore policy engine and turned into MIDI-style frames, written as a *.semantic-midi-spine.json (and optionally a CBOR-LD) archive. AssistantApp imports that archive into its node map. In the workbench's Semantic Spine tab the projection appears as a piano roll and can be played, or exported as a Standard MIDI File. A codebase can literally be heard.

Code quality and IDE intelligence were added in July 2026 as a layer on the same model:

  • Rules. 20 rules covering bug risk (force unwraps, force casts, empty catch blocks), anti-patterns, a hardcoded-credential check, complexity, dead code, performance, style and coverage.
  • Reports. A 0–100 health score, a recorded trend history, and a "new versus fixed" baseline diff for pull requests.
  • Exports. SARIF 2.1.0 for GitHub code scanning, plus Markdown and JSON-LD.
  • Autofixes. A deliberately small set: as!→as?, removing ?? nil, dropping stray print, and removing trailing semicolons.
  • Bridges. Uses SwiftLint and SwiftFormat when they are installed.
  • IDE intelligence. Drives Apple's sourcekit-lsp as a subprocess for hover, definition, references, completion, formatting and workspace symbols. It can also run as a language server itself, publishing its findings as editor diagnostics with quick-fix code actions.

Audience. Swift developers and agent-assisted workflows working across many related packages and checkouts. In particular, the studio’s own ecosystem: AssistantApp, SemanticControlCore and MacResilience.

A typical journey. A developer opens the workbench and picks a project root. On the Dashboard they choose a preset such as "graph scan" or "full pass". The run rail shows the exact command that will run and how many artifacts it will write. The run produces a DOT graph, a reusable snapshot and diagnostics. In Code Health they see the score and a filterable list of findings, export SARIF, and record a trend point. In Symbol Intel they hover over a symbol for compiler type information. In Transplant they plan moving one method into another package and read the closure and its warnings before choosing to apply it. In Semantic Spine they load the spine, view its piano roll, and play it. Every run, with its command, duration, exit status and outputs, lands in History.

Features — what a visitor can see or try

Everything below is authored in this repository unless it is marked as a dependency.

Pipeline (CLI and workbench)

  • Scan & graph export. Visible output: DOT/Mermaid diagrams and JSON-LD/CBOR-LD files.
  • Snapshots (--snapshot-out, --snapshot-in). Re-export without rescanning.
  • Diagnostics. Unresolved references, cycles, suggestions.
  • Metrics / entropy report and semantic fingerprints. Fingerprints use BLAKE3/BLAKE2 from dependencies.
  • Schema validation report.
  • Transplant planner and applier, down to a single method.

Semantic Spine

  • Producer: Sources/SwiftProjectAnalyzer/Spine/.
  • Workbench tab: load, piano roll, play, export Standard MIDI File .

Code quality (Sources/SwiftProjectAnalyzer/Quality/)

  • Commands: lint, health, trend, fix, rules, config.
  • SARIF/Markdown/JSON-LD export, .spa-quality.toml/.json repo config, baseline diff, coverage ingest and generation.
  • SwiftLint and SwiftFormat are optional external tools (dependencies, not authored).

Intelligence (Sources/SwiftProjectAnalyzer/LSP/, Intelligence/)

  • intel hover | definition | references | symbols | completion | format | wsymbols.
  • serve-lsp. The README says the workbench offers copyable VS Code / Neovim / Zed configuration for it.
  • sourcekit-lsp is Apple's binary, driven as a subprocess (a dependency, not authored).

Workbench app (Sources/SwiftProjectAnalyzerUI/)

  • Pipeline sections: Dashboard, Scan, Artifacts, Transplant, History.
  • Quality sections: Code Health, Rule Catalog, Trend, Autofix (behind a confirmation), Quality Config.
  • Intelligence sections: Symbol Intel, Language Server.
  • Semantics section: Semantic Spine.
  • Light/dark palette with a System / Light / Dark override.

Library: SwiftProjectAnalyzerKit, with CodeIntelligence as the facade for other apps.

Technical foundations

  • Swift package, three products: the Kit library, the CLI executable and the UI executable. One test target.
  • Third-party packages (from git): swift-syntax (SwiftSyntax/SwiftParser), swift-atomics, blake3-swift, Blake2.swift, SwiftCBOR.
  • Local-path packages (owner's own or local checkouts):
  • indexstore-db (Apple open source, pinned to a toolchain dev snapshot)
  • SemanticControlCore (owner's policy engine; local git with no remote)
  • Swift-CBORLD at the project archive
  • Consequence of the local-path packages: the project builds only on the studio’s Mac. docs/DEPLOYMENT.md explains this and gives the steps for hosted CI.
  • LSP integration uses its own small JSON-RPC layer over stdio rather than linking sourcekit-lsp's libraries, to avoid a swift-syntax version conflict .

Maturity by feature (evidence-dated; unknown marked)

FeatureTestsBuiltRuntime-verifiedReleased
Scan / graph export / snapshots / diagnostics / metrics / fingerprints / transplantSwift Testing suites present (27 @Test cases across 7 files). Last pass date unknown to meYesGraph/snapshot/spine runs on an AssistantApp subtree (75 files) succeeded on 2026-10-04 in my session. Transplant apply not verified by meNo
IndexStoreDB-backed resolutionUnknownYesDoes not finish on large projects (observed 2026-10-04 on AssistantApp: >20 min). Heuristic mode completed a 4,688-file scan in 3.6 minNo
Semantic-MIDI spineCodeSpineProducerTests and spine overlay tests existYes638-chunk spine produced 2026-10-04No
Code quality layer (20 rules, health, trend, baseline, SARIF, autofix, coverage)11 XCTest cases passed on 2026-07-14 (my session)Yeslint/health/fix/SARIF verified 2026-07-14. Coverage runner verified on a sample packageNo
sourcekit-lsp client + serve-lspScripted JSON-RPC checks run in session (2026-07-14), not committed as testsYesHover and code actions verified 2026-07-14No
Workbench app9 UI-logic @Test cases existBundle exists at dist/SwiftProjectAnalyzer Workbench.app. Its version string is 4afa5a3, which is the initial commit, so the bundle may predate the latest UI workNot verified by me. No screenshots existNo
Release packaging—Test tarball dist/SwiftProjectAnalyzer-v0.1.0-test-darwin-arm64.tar.gz (built 2026-07-14T20:38Z)—Not published. The repo has no git remote and no public URL

Git state: two commits. 4afa5a3 "Initial Commit" (2026-03-23) and e4c1eec "Snapshot: all work since the initial commit (March to 14 Sep 2026)". Later work (CBOR-LD codec, workbench surfaces) appears to be uncommitted. Version: there are no tags. "v0.1.0-test" was only a packaging test label.

Roadmap, limitations, FAQs

Roadmap (stated or implied in docs; aspirations only):

  • CBOR-LD graph export (now partly done).
  • A graph query engine.
  • More transplant automation, including a real destination swift build during validation.
  • Multi-model reasoning (planner / worker / verifier).
  • NodeMap integration .
  • Hosted CI once the local packages are pushed .
  • Index-store resolution that scales to large apps (bug identified 2026-10-04).

Known limitations:

  • Builds only on the studio’s machine (local-path packages).
  • IndexStoreDB resolution does not complete on large projects.
  • Heuristic mode leaves most external and SDK references unresolved (about 79% on one AssistantApp subsystem).
  • --include globs with a leading **/ match nothing (bug).
  • Transplant validation does not run a real build.
  • Autofix covers only four mechanical fixes.
  • No public release, licence or signing beyond ad-hoc.

FAQs:

  • Is it a DeepSource or SwiftLint replacement? Not as a service. It runs locally, borrows ideas (baseline diffs, SARIF, health score) and can call SwiftLint/SwiftFormat, but its core is a semantic graph and transplant engine.
  • Does it need Xcode's index? No. Parser-only mode (--no-indexstore) works everywhere and is currently the recommended mode for large apps.
  • What is the "semantic-MIDI spine"? A per-type scoring of the codebase rendered as MIDI-like frames, so structure can be visualised as a piano roll and played. AssistantApp consumes it.
  • Can it edit my code? Only when asked: transplants need --apply, and autofix sits behind an explicit confirmation in the workbench.
  • Can I download it? Not yet. There is no public release.

Explore the connections.

Browse all project stories ↗