src/
├── index.ts # Public TypeScript ESM library exports
├── cli.ts # 24-command POSIX CLI parser & runner (n1 / numberone)
├── core/
│ ├── types.ts # 47 EventTypes, Zod schemas, WorkspaceProjection & config types
│ ├── ulid.ts # Monotonic 128-bit Crockford Base32 ULID generator
│ ├── hash.ts # Canonical JSON serializer & SHA-256 primitives
│ ├── stream-store.ts # Append-only SHA-256 event store, CAS blobs & chain verifier
│ ├── replay-engine.ts # Pure deterministic fold engine & snapshotDigest cache guard
│ ├── lesson-engine.ts # Relevance scorer, dead-end matcher & crash-to-fix correlator
│ ├── authority-engine.ts # L1-L4 precedence gate & affirmative-clause arbitrator
│ └── documentary.ts # Chronological chaptered Workspace Documentary compiler
├── persistence/
│ ├── types.ts # PersistenceAdapter, SyncLedger & integrity contracts
│ ├── fabric.ts # Bidirectional push/pull coordinator & fallback manager
│ ├── directory-adapter.ts # Zero-network local / Git-worktree / NFS Kanban Scrum adapter
│ ├── github-adapter.ts # GitHub Issues + Projects v2 GraphQL + GHES adapter
│ └── jira-adapter.ts # Jira REST v3 + ADF + Agile Sprints + JQL adapter
├── watchers/
│ ├── fs-watcher.ts # Real-time debounced FS sensor, unified diffs & offline reconcile
│ ├── daemon.ts # Detached daemon manager with /proc/<pid>/stat tick verification
│ ├── git-hooks.ts # Non-clobbering chained Git lifecycle hooks & history importer
│ ├── command-runner.ts # Sanitized child runner, UTF-8 ring buffers & shell crash hooks
│ └── transcript-ingestor.ts # Claude/Codex/JSONL/Markdown session transcript parser
├── crew/
│ ├── types.ts # Officer, PeerChallenge, ChallengeResolution & Proof contracts
│ ├── base-officer.ts # Abstract officer base, virtual-file matcher & KPI scorer
│ ├── engineering-officer.ts # Runtime, lockfile, container & shutdown readiness expert
│ ├── security-officer.ts # Secrets, SHA-pinned CI, permissions, sinks & container AppSec expert
│ ├── bridge-officer.ts # Tests, CI stability, release automation & rollback CD expert
│ ├── party-mode.ts # 3-round BMAD Party Mode orchestrator & challenge verifier
│ ├── evolution-engine.ts # Counterfactual/empirical KPI-gated officer evolution engine
│ └── llm-provider.ts # Optional OpenAI-compatible / Anthropic / Gemini / vLLM adapter
├── harness/
│ ├── number-one.ts # High-level NumberOneAgent orchestrator facade
│ ├── mcp-server.ts # Hardened stdio JSON-RPC 2.0 MCP server (12 tools, 4 resources)
│ └── shims.ts # Idempotent AGENTS.md, CLAUDE.md, Cursor, Copilot & .mcp.json shims
└── utils/
├── redactor.ts # Linear-time secret scrubber & child env sanitizer
├── safe-regex.ts # ReDoS validator & O(N*M) linear-time glob matcher
├── http.ts # SSRF IP guard, origin-scoped env vars & retry/jitter fetch
├── lock.ts # Atomic linkSync/O_EXCL locks with /proc start-tick validation
├── fs-helpers.ts # Atomic temp+fsync+rename writes, realpath & O_NOFOLLOW confinement
├── diff.ts # Bounded line-level unified diff engine
└── ignore.ts # .gitignore + .numberone path filter