ArchSutra AI

ArchSutra AI / Handbook

Functional specification

Requirement-level description of every capability, actor, input, output and acceptance test.

Version 0.1.0 · Source: docs/handbook/02-functional-specification.md

1. Purpose and scope#

ArchSutra AI helps people understand and improve the architecture of a software system. It covers audit of existing code, design of new systems, modernization planning, threat modeling and verification of architecture documents.

In scope for v0.1: deterministic repository analysis, skill and agent content, installation into five AI IDEs, report export. Out of scope: server mode, model-provider runtime, local-model runtime, languages beyond import graphs for JS/TS/Python, runtime profiling. See the RFC.

2. Actors#

ActorGoal
DeveloperUnderstand and audit a repository quickly
Architect / tech leadProduce evidence-backed reviews, ADRs and roadmaps
Security reviewerFind injection, secret, TLS and container risks; threat model
Engineering managerSee prioritized risks and a phased plan
CI systemGate pull requests on architecture and security findings
AI IDE (Claude Code, Cursor, Codex, Copilot, Gemini CLI)Load skills/agents and reason with its own model
ContributorAdd rules, agents, adapters

3. Functional requirements#

IDs are stable. "Status" is implemented and tested (T), implemented not live-verified (I), or planned (P).

3.1 Repository analysis (CLI)#

IDRequirementStatus
F-01Walk a repository with limits (5000 files, 512 KB per file, 15 s), skipping ignored directories, binaries and symlinks, and report truncationT
F-02Detect ecosystems from manifests and file extensions (TypeScript, JavaScript, Python, Java, Kotlin, C#, Go, Rust, PHP, Ruby, Swift, Dart)T
F-03Detect frameworks and datastores from dependency manifestsT
F-04Detect infrastructure files (Docker, Compose, Terraform, Kubernetes/Helm, GitHub Actions)T
F-05Build a module-level dependency graph from relative imports (JS/TS) and package imports (Python)T
F-06Detect dependency cycles between modules (Tarjan SCC)T
F-07List blind spots explicitly in every outputT

3.2 Audit#

IDRequirementStatus
F-10Evaluate 19 rules (see rule catalog) and emit findingsT
F-11Each finding has stable ID, title, category, severity, confidence, evidence (path, line, kind, redacted excerpt), impact, why it matters, fix, verification, acceptance criteria, effort, owner type, caveats, referencesT
F-12Never include secret values in any outputT
F-13Produce a scorecard; categories without evidence are not assessedT
F-14--fail-on <severity> returns exit code 1 when a finding meets the thresholdT

3.3 Reporting and export#

IDRequirementStatus
F-20Render audit-report.md, current-state.md (with Mermaid context and container diagrams), README.mdT
F-21Render findings.json conforming to schema v1.0.0T
F-22Render findings.sarif (SARIF 2.1.0)T
F-23Render architecture-register.json with SHA-256 per artifactT
F-24--dry-run writes nothing; --output cannot escape the projectT

3.4 Verification#

IDRequirementStatus
F-30Validate skills (name equals directory, kebab-case, description 1-1024 chars, body under 500 lines)T
F-31Validate agents have the required headingsT
F-32Check that relative Markdown links resolveT
F-33Check Mermaid blocks for known diagram type and balanced brackets (structural only, not rendered)T
F-34Validate any findings.json foundT

3.5 Installation#

IDRequirementStatus
F-40Plan an install per host: create, update, unchanged, conflictT
F-41Refuse to overwrite files not installed by ArchSutra without --force; back up when forcedT
F-42Record SHA-256 in .archsutra/install-manifest.json; make install idempotentT
F-43Uninstall removes only unmodified installed files and the managed AGENTS.md blockT
F-44doctor reports Node version, detected hosts, drift, missing filesT
F-45Write only supported frontmatter for Claude and Copilot agent filesT
F-46Skills load and run inside each live hostI (not verified)

3.6 AI-assisted workflows (skills)#

IDWorkflowSkillNeeds model
F-50Audit existing systemarchitecture-audityes (IDE)
F-51Design new systemarchitecture-designyes
F-52Modernization / migration planarchitecture-modernizationyes
F-53Threat model (STRIDE, LLM/agent threats)threat-modelingyes
F-54Verify architecture artifactsarchitecture-verificationyes
F-55CLI refuses to fake model-dependent commands (design, review, threat-model, modernize, compare, cost, drift) and exits 3no

3.7 Agent team#

Twelve roles with a fixed contract (purpose, when to invoke, inputs, tools and policy, outputs, quality criteria, escalation): Prime, Atlas, Blueprint, Sentinel, Cloud, Data, Nexus, Neural, Scale, Ledger, Forge, Verify. Prime orchestrates; if the host cannot spawn subagents, Prime performs specialist reviews sequentially.

4. Non-functional requirements#

IDAttributeRequirementEvidence
N-01PrivacyNo network calls or telemetry in the CLIcode review; no network imports; threat model
N-02SafetyRead-only except export, install, uninstall, inside the projecttests T1, T5
N-03PerformanceBounded by file count, size and timetest walk ... respects file limit
N-04PortabilityWindows, macOS, Linux; Node 20+CI matrix
N-05Supply chainZero runtime dependenciesCI npm ls --omit=dev
N-06DeterminismSame input, same findings and IDsrepeated eval runs
N-07Accessibility (docs site)Semantic HTML, keyboard navigation, contrast, reduced motionsite notes

5. Primary scenarios#

S1. First audit. A developer runs archsutra audit .. They see a summary, scorecard and findings with file:line. Exit code 0.

S2. CI gate. A pipeline runs archsutra audit . --fail-on high. A high finding returns exit code 1 and fails the job. SARIF can be uploaded to GitHub code scanning.

S3. Deep review in an IDE. A user installs the skills, then asks ArchSutra Prime for a full audit. The assistant runs archsutra audit . --json, verifies each finding by reading the cited lines, adds architecture reasoning, diagrams, ADR recommendations and a roadmap.

S4. Safe adoption. A team runs install --dry-run, reviews the plan, installs, later edits a skill, and uninstall leaves their edit in place.

6. Acceptance tests#

Each requirement marked T maps to an automated test in test/archsutra.test.mjs or test/eval.test.mjs. The mapping is in Testing and proof.