@nomos-arc/arc 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +10 -0
- package/.nomos-config.json +5 -0
- package/CLAUDE.md +108 -0
- package/LICENSE +190 -0
- package/README.md +569 -0
- package/dist/cli.js +21120 -0
- package/docs/auth/googel_plan.yaml +1093 -0
- package/docs/auth/google_task.md +235 -0
- package/docs/auth/hardened_blueprint.yaml +1658 -0
- package/docs/auth/red_team_report.yaml +336 -0
- package/docs/auth/session_state.yaml +162 -0
- package/docs/certificate/cer_enhance_plan.md +605 -0
- package/docs/certificate/certificate_report.md +338 -0
- package/docs/dev_overview.md +419 -0
- package/docs/feature_assessment.md +156 -0
- package/docs/how_it_works.md +78 -0
- package/docs/infrastructure/map.md +867 -0
- package/docs/init/master_plan.md +3581 -0
- package/docs/init/red_team_report.md +215 -0
- package/docs/init/report_phase_1a.md +304 -0
- package/docs/integrity-gate/enhance_drift.md +703 -0
- package/docs/integrity-gate/overview.md +108 -0
- package/docs/management/manger-task.md +99 -0
- package/docs/management/scafffold.md +76 -0
- package/docs/map/ATOMIC_BLUEPRINT.md +1349 -0
- package/docs/map/RED_TEAM_REPORT.md +159 -0
- package/docs/map/map_task.md +147 -0
- package/docs/map/semantic_graph_task.md +792 -0
- package/docs/map/semantic_master_plan.md +705 -0
- package/docs/phase7/TEAM_RED.md +249 -0
- package/docs/phase7/plan.md +1682 -0
- package/docs/phase7/task.md +275 -0
- package/docs/prompts/USAGE.md +312 -0
- package/docs/prompts/architect.md +165 -0
- package/docs/prompts/executer.md +190 -0
- package/docs/prompts/hardener.md +190 -0
- package/docs/prompts/red_team.md +146 -0
- package/docs/verification/goveranance-overview.md +396 -0
- package/docs/verification/governance-overview.md +245 -0
- package/docs/verification/verification-arc-ar.md +560 -0
- package/docs/verification/verification-architecture.md +560 -0
- package/docs/very_next.md +52 -0
- package/docs/whitepaper.md +89 -0
- package/overview.md +1469 -0
- package/package.json +63 -0
- package/src/adapters/__tests__/git.test.ts +296 -0
- package/src/adapters/__tests__/stdio.test.ts +70 -0
- package/src/adapters/git.ts +226 -0
- package/src/adapters/pty.ts +159 -0
- package/src/adapters/stdio.ts +113 -0
- package/src/cli.ts +83 -0
- package/src/commands/apply.ts +47 -0
- package/src/commands/auth.ts +301 -0
- package/src/commands/certificate.ts +89 -0
- package/src/commands/discard.ts +24 -0
- package/src/commands/drift.ts +116 -0
- package/src/commands/index.ts +78 -0
- package/src/commands/init.ts +121 -0
- package/src/commands/list.ts +75 -0
- package/src/commands/map.ts +55 -0
- package/src/commands/plan.ts +30 -0
- package/src/commands/review.ts +58 -0
- package/src/commands/run.ts +63 -0
- package/src/commands/search.ts +147 -0
- package/src/commands/show.ts +63 -0
- package/src/commands/status.ts +59 -0
- package/src/core/__tests__/budget.test.ts +213 -0
- package/src/core/__tests__/certificate.test.ts +385 -0
- package/src/core/__tests__/config.test.ts +191 -0
- package/src/core/__tests__/preflight.test.ts +24 -0
- package/src/core/__tests__/prompt.test.ts +358 -0
- package/src/core/__tests__/review.test.ts +161 -0
- package/src/core/__tests__/state.test.ts +362 -0
- package/src/core/auth/__tests__/manager.test.ts +166 -0
- package/src/core/auth/__tests__/server.test.ts +220 -0
- package/src/core/auth/gcp-projects.ts +160 -0
- package/src/core/auth/manager.ts +114 -0
- package/src/core/auth/server.ts +141 -0
- package/src/core/budget.ts +119 -0
- package/src/core/certificate.ts +502 -0
- package/src/core/config.ts +212 -0
- package/src/core/errors.ts +54 -0
- package/src/core/factory.ts +49 -0
- package/src/core/graph/__tests__/builder.test.ts +272 -0
- package/src/core/graph/__tests__/contract-writer.test.ts +175 -0
- package/src/core/graph/__tests__/enricher.test.ts +299 -0
- package/src/core/graph/__tests__/parser.test.ts +200 -0
- package/src/core/graph/__tests__/pipeline.test.ts +202 -0
- package/src/core/graph/__tests__/renderer.test.ts +128 -0
- package/src/core/graph/__tests__/resolver.test.ts +185 -0
- package/src/core/graph/__tests__/scanner.test.ts +231 -0
- package/src/core/graph/__tests__/show.test.ts +134 -0
- package/src/core/graph/builder.ts +303 -0
- package/src/core/graph/constraints.ts +94 -0
- package/src/core/graph/contract-writer.ts +93 -0
- package/src/core/graph/drift/__tests__/classifier.test.ts +215 -0
- package/src/core/graph/drift/__tests__/comparator.test.ts +335 -0
- package/src/core/graph/drift/__tests__/drift.test.ts +453 -0
- package/src/core/graph/drift/__tests__/reporter.test.ts +203 -0
- package/src/core/graph/drift/classifier.ts +165 -0
- package/src/core/graph/drift/comparator.ts +205 -0
- package/src/core/graph/drift/reporter.ts +77 -0
- package/src/core/graph/enricher.ts +251 -0
- package/src/core/graph/grammar-paths.ts +30 -0
- package/src/core/graph/html-template.ts +493 -0
- package/src/core/graph/map-schema.ts +137 -0
- package/src/core/graph/parser.ts +336 -0
- package/src/core/graph/pipeline.ts +209 -0
- package/src/core/graph/renderer.ts +92 -0
- package/src/core/graph/resolver.ts +195 -0
- package/src/core/graph/scanner.ts +145 -0
- package/src/core/logger.ts +46 -0
- package/src/core/orchestrator.ts +792 -0
- package/src/core/plan-file-manager.ts +66 -0
- package/src/core/preflight.ts +64 -0
- package/src/core/prompt.ts +173 -0
- package/src/core/review.ts +95 -0
- package/src/core/state.ts +294 -0
- package/src/core/worktree-coordinator.ts +77 -0
- package/src/search/__tests__/chunk-extractor.test.ts +339 -0
- package/src/search/__tests__/embedder-auth.test.ts +124 -0
- package/src/search/__tests__/embedder.test.ts +267 -0
- package/src/search/__tests__/graph-enricher.test.ts +178 -0
- package/src/search/__tests__/indexer.test.ts +518 -0
- package/src/search/__tests__/integration.test.ts +649 -0
- package/src/search/__tests__/query-engine.test.ts +334 -0
- package/src/search/__tests__/similarity.test.ts +78 -0
- package/src/search/__tests__/vector-store.test.ts +281 -0
- package/src/search/chunk-extractor.ts +167 -0
- package/src/search/embedder.ts +209 -0
- package/src/search/graph-enricher.ts +95 -0
- package/src/search/indexer.ts +483 -0
- package/src/search/lexical-searcher.ts +190 -0
- package/src/search/query-engine.ts +225 -0
- package/src/search/vector-store.ts +311 -0
- package/src/types/index.ts +572 -0
- package/src/utils/__tests__/ansi.test.ts +54 -0
- package/src/utils/__tests__/frontmatter.test.ts +79 -0
- package/src/utils/__tests__/sanitize.test.ts +229 -0
- package/src/utils/ansi.ts +19 -0
- package/src/utils/context.ts +44 -0
- package/src/utils/frontmatter.ts +27 -0
- package/src/utils/sanitize.ts +78 -0
- package/test/e2e/lifecycle.test.ts +330 -0
- package/test/fixtures/mock-planner-hang.ts +5 -0
- package/test/fixtures/mock-planner.ts +26 -0
- package/test/fixtures/mock-reviewer-bad.ts +8 -0
- package/test/fixtures/mock-reviewer-retry.ts +34 -0
- package/test/fixtures/mock-reviewer.ts +18 -0
- package/test/fixtures/sample-project/src/circular-a.ts +6 -0
- package/test/fixtures/sample-project/src/circular-b.ts +6 -0
- package/test/fixtures/sample-project/src/config.ts +15 -0
- package/test/fixtures/sample-project/src/main.ts +19 -0
- package/test/fixtures/sample-project/src/services/product-service.ts +20 -0
- package/test/fixtures/sample-project/src/services/user-service.ts +18 -0
- package/test/fixtures/sample-project/src/types.ts +14 -0
- package/test/fixtures/sample-project/src/utils/index.ts +14 -0
- package/test/fixtures/sample-project/src/utils/validate.ts +12 -0
- package/tsconfig.json +20 -0
- package/vitest.config.ts +12 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# nomos-arc.ai: How It Works
|
|
2
|
+
|
|
3
|
+
## 1. Introduction to nomos-arc.ai (`arc`)
|
|
4
|
+
|
|
5
|
+
**nomos-arc.ai** is a production-grade **AI-Native Engineering Pipeline** that transforms AI-assisted coding from an ad-hoc activity into a structured, auditable, and reliable process.
|
|
6
|
+
|
|
7
|
+
The project provides a CLI tool called `arc` (The Architect) that acts as an orchestration layer, managing the lifecycle of coding tasks performed by AI agents like Claude Code or GitHub Copilot CLI.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 2. Core Philosophy: The Wrapper Model
|
|
12
|
+
|
|
13
|
+
nomos-arc is built on a key architectural insight: **don't rebuild what existing AI tools already do well — orchestrate them.**
|
|
14
|
+
|
|
15
|
+
Instead of calling LLM APIs directly to edit files, `arc` spawns these powerful AI binaries inside isolated environments. It manages the "scaffolding" around the developer:
|
|
16
|
+
* **Rules Injection:** Forcing the AI to follow your project's specific engineering standards.
|
|
17
|
+
* **Isolated Branching:** Keeping AI work away from your production code until it's ready.
|
|
18
|
+
* **Automated Review:** Using one AI model to build and another to critique, creating a system of checks and balances.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 3. High-Level Architecture
|
|
23
|
+
|
|
24
|
+
### 3.1. Orchestration Layer
|
|
25
|
+
The `arc` CLI manages the state machine of every task. It tracks progress from the moment a task is initialized until it is either merged or discarded.
|
|
26
|
+
|
|
27
|
+
### 3.2. Deterministic Governance (Rules Engine)
|
|
28
|
+
nomos-arc.ai uses a multi-level rules engine to ensure every AI session complies with your standards:
|
|
29
|
+
1. **Global Rules:** Base engineering standards (e.g., "All functions must have return types").
|
|
30
|
+
2. **Domain Rules:** Tech-specific rules (e.g., frontend-specific or backend-specific standards).
|
|
31
|
+
3. **Session Rules:** Constraints specific to a single task.
|
|
32
|
+
|
|
33
|
+
### 3.3. Shadow Branching (Git Worktrees)
|
|
34
|
+
To protect the main codebase, nomos-arc uses **Git Worktrees**. When you start a task, nomos-arc creates a "shadow branch" in a separate directory. The AI agent operates with full project context (it can see all your files), but its changes are physically isolated.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## 4. The Standard Workflow Loop
|
|
39
|
+
|
|
40
|
+
nomos-arc.ai codifies the plan-review-refine loop that senior engineers do mentally:
|
|
41
|
+
|
|
42
|
+
1. **`arc init <task-id>`**:
|
|
43
|
+
* Create a new task specification file (`.md`).
|
|
44
|
+
* Set up a dedicated shadow branch and Git Worktree.
|
|
45
|
+
* Lock in the rules version for this task.
|
|
46
|
+
|
|
47
|
+
2. **`arc plan <task-id>`**:
|
|
48
|
+
* Assemble a prompt containing your rules + the task requirements.
|
|
49
|
+
* Spawn the AI Planner (e.g., Claude Code) in the shadow branch.
|
|
50
|
+
* The developer interacts with the AI to complete the task.
|
|
51
|
+
* nomos-arc captures the final changes as a `.diff` artifact.
|
|
52
|
+
|
|
53
|
+
3. **`arc review <task-id>`**:
|
|
54
|
+
* A separate AI model (the Reviewer) analyzes the diff against the rules.
|
|
55
|
+
* It provides a structured JSON report with a quality score and specific issues.
|
|
56
|
+
* If the score is below the threshold, the task moves to "Refinement".
|
|
57
|
+
|
|
58
|
+
4. **`arc apply <task-id>`**:
|
|
59
|
+
* Once approved (and the developer is happy), the changes are merged into the main branch.
|
|
60
|
+
* nomos-arc cleans up the worktree and shadow branch.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 5. Technical Highlights
|
|
65
|
+
|
|
66
|
+
* **PTY Emulation**: nomos-arc uses `node-pty` to run AI tools in a real terminal environment, allowing it to capture output while maintaining a full interactive experience for the developer.
|
|
67
|
+
* **State Persistence**: All task progress is stored in a machine-readable JSON format, ensuring a complete audit trail of what was asked, what rules were applied, and what the AI produced.
|
|
68
|
+
* **Cost Control**: nomos-arc monitors token usage per task and can enforce budget limits to prevent runaway AI spending.
|
|
69
|
+
* **Shadow Branching Isolation**: By using external worktrees, nomos-arc prevents IDE confusion and accidental source modification.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## 6. Why Use nomos-arc.ai?
|
|
74
|
+
|
|
75
|
+
* **Structure**: Turns chaotic prompting into a repeatable engineering process.
|
|
76
|
+
* **Quality Gates**: Prevents AI-generated "hallucinations" or architectural drift from reaching production.
|
|
77
|
+
* **Traceability**: Provides a full record of AI contributions for security and compliance audits.
|
|
78
|
+
* **Consistency**: Ensures the entire team's AI usage aligns with the same coding standards.
|