# TeamForge code map This document maps a TeamForge question to the **smallest relevant current source area and tests**. Product intent and user-acceptance scenarios: [owner interview contract](docs/PRODUCT_DECISIONS_2026-11-23.md) ([한국어](docs/PRODUCT_DECISIONS_2026-11-23.ko.md)). This is a proposed direction, not implementation evidence; see [STATUS](docs/STATUS.md) for live capability and release readiness. It is a navigation reference, not a release-status document. Routes describe checked-in source, not necessarily the published package or unmerged integration PRs. M5 preview, signed Guest refresh and checkpoint rotation are distinct; do not infer a complete operational M4-to-M5 transition from preview or storage primitives. - Current capability/readiness: **[docs/STATUS.md](docs/STATUS.md)** - End-to-end conceptual behavior: **[docs/HOW_IT_WORKS.md](docs/HOW_IT_WORKS.md)** - Exact runtime/protocol/release selections: **[`release-contract.json`](release-contract.json)** - Current architecture and trust boundaries: **[docs/architecture.md](docs/architecture.md)** - Source setup and validation workflow: **[docs/SOURCE.md](docs/SOURCE.md)** - Product feature-to-regression review: **[docs/FEATURE_REGRESSIONS.md](docs/FEATURE_REGRESSIONS.md)** (small machine-readable subset; no pass claims) - Named validation scenarios: **[docs/TEST_LAB.md](docs/TEST_LAB.md)** - Planned direction: **[docs/ROADMAP.md](docs/ROADMAP.md)** ## Start here by question | Question | Read first | Then inspect | | --- | --- | --- | | What is TeamForge and what is ready? | [README.md](README.md), [docs/STATUS.md](docs/STATUS.md) | `release-contract.json`, relevant GitHub Issues | | What happens end to end when someone hosts, joins, transfers a Project or reconnects? | [docs/HOW_IT_WORKS.md](docs/HOW_IT_WORKS.md) | [docs/architecture.md](docs/architecture.md), then the relevant module below | | How do the major processes fit together structurally? | [docs/architecture.md](docs/architecture.md) | [docs/architecture-decisions.md](docs/architecture-decisions.md) | | How does Unity connect to realtime authority? | [Unity package README](unity-package/com.eunsung.teamforge/README.md) | `TeamForgeConnectionService.cs`, `server/src/teamforge-server.mjs`, `server/src/session-authority.mjs` | | Where is Presence implemented? | `Editor/Presence/TeamForgePresenceService.cs` | `server/src/session-authority.mjs` | | Where is Transform / Lock synchronization implemented? | `Editor/TransformSync/TeamForgeTransformSyncService.cs` | `Editor/Authority/TeamForgeAuthorityView.cs`, `server/src/session-authority.mjs` | | Where is same-Scene Hierarchy synchronization implemented? | `Editor/HierarchySync/TeamForgeHierarchySyncService.cs` | `server/src/hierarchy-model.mjs`, `server/src/session-authority.mjs` | | Where are the WP6 Component foundations and preflight checks reused by live M1–M3 synchronization? | `docs/ROADMAP.md` (WP6) | `server/src/component-foundation.mjs`, `server/src/component-property-foundation.mjs`, `server/src/component-structure-foundation.mjs`, `server/src/component-operation-preflight.mjs`, `server/src/component-authority-preflight.mjs`, paired `server/test/component-*foundation.test.mjs`, `server/test/component-*preflight.test.mjs` and `server/test/component-property-snapshot.test.mjs` (**identity, typed/bounded snapshots, exact target lookup, structural/property candidates and read-only replay/lease checks; live admission and mutations are owned by the collaboration runtime below**) | | Where are live Collider property, structure and primitive operations admitted and applied? | `server/src/component-collaboration.mjs`, `server/src/component-property-transaction.mjs` | `Editor/ComponentSync/`, `Editor/PrimitiveSync/`; `server/test/component-collaboration.test.mjs`, `server/test/primitive-collaboration.test.mjs`, Unity Collider E2E tests | | Where is M4 confirmed-state recovery implemented? | `server/src/durable-session-runtime.mjs`, `server/src/durable-session-store.mjs` | `server/src/teamforge-server.mjs`, `server/test/durable-session-store.test.mjs`, `server/test/primitive-collaboration.test.mjs`, `Editor/Connection/` | | Where are unconfirmed local edits and object identities preserved? | `Editor/TransformSync/TeamForgeSessionRecoveryWindow.cs`, `Editor/HierarchySync/TeamForgeHierarchyIdentityRegistry.cs` | Recovery stores, Collider bindings and scoped recovery tests below; local records are not server authority | | Where is Scene compatibility checked before joining? | `Editor/UX/TeamForgeBaselineFingerprint.cs`, `Editor/UX/TeamForgeJoinCode.cs` | `host-orchestrator.mjs`, `bootstrap-invite.mjs`, `host-orchestrator.test.mjs` | | Where are M5 Host checkpoint preview and Guest revision review? | `host-checkpoint-preview.mjs`, `MainWindow.ProjectUpdate.cs` | `project-peer.mjs`, `guest-orchestrator.mjs`, `host-checkpoint-preview.test.mjs`, `guest-refresh.test.mjs` | | Where are Active generation selection, activation and destination ownership enforced? | `managed-project.mjs`, `guest-destination.mjs` | `project-peer.mjs`, `managed-project.test.mjs`, `guest-refresh.test.mjs`, `UnityLaunchPolicy.cs` | | How does Project bootstrap / direct transfer work? | [project-peer/README.md](project-peer/README.md) | Host/Guest orchestrators, direct transfer client/server, content store | | Where is signed Project coordination handled? | [server/README.md](server/README.md) | `server/src/project-coordinator-core.mjs`, `project-peer/src/coordinator-client.mjs` | | How does the Windows Guest Launcher work? | [launcher/README.md](launcher/README.md) | `MainWindow.xaml.cs`, Launcher Core policy classes, Guest orchestrator | | Where are diagnostics / recovery implemented? | [launcher/README.md](launcher/README.md) | `DiagnosticsRecovery.cs`, `DiagnosticSupportBundle.cs`, `MainWindow.Diagnostics.cs`, `TeamForgeRecoveryUx.cs`, `guest-orchestrator.mjs` | | Where is the support-bundle privacy boundary tested? | [launcher/README.md](launcher/README.md) | `launcher/tests/TeamForge.Diagnostics.Tests/` | | Where is Windows path resilience implemented? | [launcher/README.md](launcher/README.md) | `PathResilience.cs`, `ExecutionAliasManager.cs`, `path-resilience-contract.json` | | How do I choose or run a named validation scenario? | [docs/TEST_LAB.md](docs/TEST_LAB.md) | `test-lab.json`, `scripts/test-lab.mjs`, `quality-gates.json` | | How do I validate a fresh source clone? | [docs/SOURCE.md](docs/SOURCE.md) | `scripts/validate-public-source.mjs`, `npm run validate`, current CI | | How do I validate a staged release tree? | [docs/SOURCE.md](docs/SOURCE.md), [builds/README.md](builds/README.md) | `scripts/validate-repository.mjs`, `npm run validate:release` | | How are substantial changes planned/classified? | [docs/ENGINEERING_GUIDE.md](docs/ENGINEERING_GUIDE.md) | `docs/templates/CHANGE_PLAN.md`, `quality-gates.json`, `scripts/classify-change.mjs` | | Where is durable cross-session agent memory? | [docs/AGENT_MEMORY.md](docs/AGENT_MEMORY.md) | Re-verify the referenced canonical source before acting | | How do hourly agents select work and avoid overlapping Issue/PR ownership? | [docs/AGENT_WORK_QUEUE.md](docs/AGENT_WORK_QUEUE.md) | `scripts/agent-workqueue.mjs` (read-only planning and claim check), live GitHub PR/Issue comments | | How are documentation changes governed? | [docs/DOCUMENTATION_GUIDE.md](docs/DOCUMENTATION_GUIDE.md) | `docs/templates/DOCUMENTATION_PLAN.md`, `scripts/validate-documentation.mjs` | | Where should a security review start? | [.github/SECURITY.md](.github/SECURITY.md), [docs/architecture.md](docs/architecture.md) | filesystem/invite/runtime/environment/path trust-boundary code | | Where are tests? | [docs/TEST_LAB.md](docs/TEST_LAB.md), [.github/CONTRIBUTING.md](.github/CONTRIBUTING.md) | Unity `Tests/`, `server/test/`, `project-peer/test/`, `launcher/test/`, `launcher/tests/` | ## Runtime topology ```text Unity Editor package ├─ Realtime Protocol v1 over WebSocket ──> TeamForge Server │ ├─ Session Authority │ └─ Project Coordinator metadata │ └─ Host bridge ──> Project Peer Seed Windows Guest Launcher └─ Guest bridge ──> Project Peer client ── direct HTTP Project payload ──> Host Seed ``` Project payload bytes do not pass through the TeamForge Server. See **[docs/architecture.md](docs/architecture.md)** for the authoritative topology and trust-boundary description. ## Unity Editor package Root: `unity-package/com.eunsung.teamforge/` Primary responsibilities: Editor-facing collaboration UI, connection lifecycle, observed authority state, Presence, Transform/Lock behavior, supported same-Scene Hierarchy collaboration, and Host-side UX/orchestration. Key entry points: - `Editor/UI/TeamForgeWindow.cs` — primary Collaboration window - `Editor/UX/TeamForgeHomeWindow.cs` — guided UX entry surface - `Editor/UX/TeamForgeHostFlow.cs` — Host review/start/stop bridge, remembered Seed-port handoff, and firewall-onboarding ordering - `Editor/UX/TeamForgeWindowsFirewall.cs` — exact Windows Private/LocalSubnet Coordinator/Seed rule reconciliation and explicit removal - `Editor/UX/TeamForgeHostLanDiagnostics.cs` — read-only LAN target/result policy, explicit async checks, cancellation and stale-result isolation - `Editor/UX/TeamForgeHostLanDiagnosticsView.cs` — Home LAN snapshot controls and privacy-safe Doctor report integration - `Editor/Connection/TeamForgeConnectionService.cs` — connection lifecycle, handshake/routing, reconnect/backoff, main-thread dispatch and request-specific Ping/Pong observations - `Editor/Authority/TeamForgeAuthorityView.cs` — client-side observed authority state - `Editor/Presence/TeamForgePresenceService.cs` — connected-user / selection / Scene awareness - `Editor/TransformSync/TeamForgeTransformSyncService.cs` — Transform observation/application and lock/revision interaction - `Editor/HierarchySync/TeamForgeHierarchySyncService.cs` — supported same-Scene structural synchronization and identity checks - `Editor/PrimitiveSync/TeamForgePrimitiveTemplateRuntime.cs` — built-in Cube/Sphere visual creation and exact mesh validation on reconnect - `Editor/ComponentSync/TeamForgeColliderSyncService.cs` — M1 live Collider observation, scoped remote apply, conditional own Undo/Redo, reconnect and project-local recovery inbox - `Editor/ComponentSync/TeamForgeColliderStructureSyncService.cs` — M2 logical Collider lifecycle and same-revision M3 topology apply after Hierarchy reconciliation - `Editor/ComponentSync/TeamForgeColliderProperty.cs` / `TeamForgeColliderPropertyWire.cs` — exact allowlisted property identity/value application and bounded heterogeneous JSON codec - `Editor/ComponentSync/TeamForgeColliderSyncWindow.cs` — explicit Collider join, status and local recovery review - `Editor/UX/TeamForgeBaselineFingerprint.cs` / `TeamForgeJoinCode.cs` — saved Scene path, GUID and hash checks and realtime join compatibility - `Editor/UX/TeamForgeGuestHandoff.cs` / `TeamForgeVerifiedGuestReconnect.cs` — verified Guest handoff and reconnect boundary - `Editor/UX/TeamForgeHostFlow.CheckpointPreview.cs` — read-only signed Project checkpoint preview bridge, not a commit/rotation implementation - `Editor/HierarchySync/TeamForgeHierarchyIdentityRegistry.cs` — logical-to-local object identity and persisted alias cache; current authority is separate - `Editor/TransformSync/TeamForgeSessionRecoveryWindow.cs` / `TeamForgeTransformRecoveryStore.cs` — unconfirmed local Transform intents and explicit review/resubmission - `Editor/HierarchySync/TeamForgeHierarchyRecoveryFile.cs` and Rename/Reparent/Sibling recovery stores — bounded local Hierarchy recovery records - `Editor/UX/TeamForgeRecoveryUx.cs` — Unity-side diagnostics/recovery presentation - `Editor/Testing/TeamForgeTestLab.cs` — same-PC clone allocation/copy/bootstrap and Editor launch orchestration - `Editor/Testing/TeamForgeTestLabPackageSnapshot.cs` — clone-only local TeamForge package snapshot, strict manifest value-span replacement and preserved lock pins - `Tests/Editor/TeamForgeCloneEditorProbeTests.cs` — opt-in CI clone export and separate Editor loaded-package assertions, without session/bootstrap/launch setup - `Tests/Editor/TeamForgeColliderLiveE2ETests.cs` / `TeamForgeColliderStructureE2ETests.cs` — supported live component/primitive workflows and recovery sequences - `Tests/Editor/TeamForgeTransformRecoveryStoreTests.cs`, `TeamForgeHierarchyRecoveryTests.cs`, `TeamForgeHierarchyRenameRecoveryStoreTests.cs`, `TeamForgeHierarchyReparentRecoveryStoreTests.cs`, `TeamForgeHierarchySiblingRecoveryStoreTests.cs` — local recovery records and reconciliation contracts - `Tests/Editor/TeamForgeIdentityAuthorityAuditTests.cs`, `TeamForgeDurableSessionWireTests.cs`, `TeamForgeGuestHandoffRecoveryTests.cs` — identity, durable wire and verified handoff - `Tests/` — Unity Editor regression/contract tests Before changing identity, revision, lock or reconnect semantics, read the corresponding Server authority code and [docs/architecture.md](docs/architecture.md). ## Realtime / coordination server Root: `server/` Primary responsibilities: authenticated HTTP/WebSocket hosting, Session Authority (in-memory by default, opt-in SQLite for supported confirmed Session recovery), and signed Project metadata coordination. The server is **not** the Project payload store or relay. Key files: - `src/index.mjs` — process startup/shutdown and composition - `src/teamforge-server.mjs` — HTTP/WebSocket shell, timers and authority/coordinator effect execution - `src/session-authority.mjs` — Presence, revision, locks, Transform, Hierarchy and tombstone authority - `src/durable-session-runtime.mjs` / `src/durable-session-store.mjs` — opt-in signed Session checkpoint recovery and atomic SQLite state/outcome storage - `src/component-collaboration.mjs` — signed Scene admission, negotiated property operations/snapshots, conditional compensation and receiver reports over the common Session authority - `src/serialized-collider-scene.mjs` — bounded direct Collider YAML value/owner verification reused from WP6; production runtime does not depend on root development scripts - `src/component-property-transaction.mjs` — component ledger and conditional property/structure operations; inspect alongside the realtime adapter - `test/primitive-collaboration.test.mjs` — M2/M3 combined lifecycle and durable integration cases - `test/durable-session-store.test.mjs` — SQLite checkpoint, receipt and recovery contracts - `src/hierarchy-model.mjs` — Hierarchy state validation and operation preparation - `src/project-coordinator-core.mjs` — Project/Owner/Publisher/Baseline/Peer coordination state - `src/project-coordinator.mjs` — wrapper around the coordinator core - `src/protocol.mjs` — server-side protocol constants/helpers - `src/config.mjs` — environment/config parsing and bounds - `test/` — server/authority/protocol tests - `test/realtime-transport-recovery.test.mjs` — owned loopback TCP fault fixture, heartbeat/lock cleanup and authoritative Node peer rejoin/replay; Test Lab scenario `realtime-transport-recovery` - `test/component-collaboration.test.mjs` / `scripts/ci-component-peer.mjs` — real Node WebSocket M1 regressions and the separate one-Unity + Node-peer CI fixture ## Project Peer / direct Project transfer `src/stored-publication.mjs` owns transport-free approved publication selection and signed manifest/descriptor loading. Both `ProjectPeerEngine` and M1 server admission reuse it; a standalone server does not require Peer WebSocket clients. Root: `project-peer/` Primary responsibilities: bootstrap contracts, Host/Guest orchestration, direct HTTP Project transfer, manifest/chunk integrity, staging, activation, trust and Project filesystem safety. Key files: - `src/project-peer.mjs` — publication preparation, approved pointer, Seed lifecycle and signed revision synchronization - `src/managed-project.mjs` — staging/materialization, verification and Active generation pointer; distinct from approved publication metadata - `src/process-bound-lock.mjs` — activation and approved-pointer lock files whose ownership ends with the owning process (named pipe on Windows, abstract socket on Linux); ambiguous legacy locks still stay busy - `src/guest-destination.mjs` — managed-root ownership, destination validation and protection of unmanaged content - `src/swarm-downloader.mjs` / `src/transfer-source.mjs` — verified chunk acquisition, scheduling, retry and source abstraction - `src/host-checkpoint-preview.mjs` / `src/publication-plan.mjs` — read-only checkpoint review and publication approval fingerprints - `src/unity-project-descriptor.mjs` — source Project descriptor validation and updates; distinct from the signed baseline descriptor - `src/process-lifecycle.mjs` — owned Coordinator and Seed process lifecycle - `src/host-orchestrator-cli.mjs` — Unity-facing Host bridge dispatch - `src/host-orchestrator.mjs` — Host orchestration behavior - `src/guest-orchestrator-cli.mjs` — Launcher-facing Guest bridge dispatch - `src/guest-orchestrator.mjs` — Guest receive/activation/recovery behavior - `src/bootstrap-invite.mjs` — signed Collaboration Invite validation - `src/coordinator-client.mjs` — signed metadata interaction with the TeamForge Server - `src/direct-transfer-client.mjs` — Direct HTTP transfer-source adapter and error normalization - `src/direct-transfer-server.mjs` — Direct HTTP descriptor/manifest/inventory/chunk source - `src/content-store.mjs` — content-addressed local Project storage primitives - `src/path-policy.mjs` — content discovery, pinned full-file Owner-key JSON inspection and source identity snapshots - `src/manifest.mjs` — discovery-bound source hashing and manifest construction - `src/filesystem-safety.mjs` — canonical path / redirected-segment safety primitives - `src/unity-version-policy.mjs` — shared source Publisher/preflight Unity-line admission; full version identity remains with existing transfer and launch checks - `src/path-resilience-contract.json` — shared Windows/Unity path-risk contract - `test/` — bootstrap/transfer/trust/recovery/path tests - `test/guest-refresh.test.mjs`, `test/managed-project.test.mjs` — signed update approval, activation and preservation contracts - `test/host-checkpoint-preview.test.mjs`, `test/host-orchestrator.test.mjs`, `test/project-engine.test.mjs`, `test/manifest-source-safety.test.mjs` — preview, publication and source safety - `test/swarm-downloader.test.mjs` — chunk scheduling, retries and transfer integrity Changes to invite validation, path handling, staging, activation, hashing or runtime execution are security-sensitive and should be reviewed as trust-boundary changes. ## Windows Guest Launcher Root: `launcher/` Primary responsibilities: user-facing Guest flow, verified bundled Runtime execution, managed destination/path handling, trust presentation, privacy-bounded support diagnostics, and final Unity handoff. Key files: - `src/TeamForge.Launcher/MainWindow.xaml(.cs)` — WPF Guest UI and orchestration glue - `src/TeamForge.Launcher/MainWindow.UnityLaunch.cs` — context-bound Editor selection, Active/Existing-Active opening, cancellation and completion/cleanup ownership; Core retains verification/path/process policy - `src/TeamForge.Launcher/AccessCodeInput.xaml(.cs)` — masked/revealed input presentation and clear/hide lifecycle; credential/bridge lifetime stays in MainWindow - `src/TeamForge.Launcher.Core/ReceiveProgressPresentation.cs` — bounded receive percentages and explicit transfer/verification feedback; progress cannot authorize activation or launch - `src/TeamForge.Launcher/MainWindow.Diagnostics.cs` — Copy diagnostics / manual support-bundle UI handling - `src/TeamForge.Launcher/MainWindow.ProjectUpdate.cs` / `ProjectUpdateReviewDialog.xaml` — revision-specific Guest review; separate from Publisher trust - `src/TeamForge.Launcher/TrustDialog.xaml` — explicit Publisher/Project trust UI - `src/TeamForge.Launcher.Core/BridgeClient.cs` — child bridge process / bounded NDJSON client - `src/TeamForge.Launcher.Core/RuntimeLayout.cs` — Runtime manifest/layout/hash verification - `src/TeamForge.Launcher.Core/EnvironmentPolicy.cs` — child-process environment policy - `src/TeamForge.Launcher.Core/PathSafety.cs` — containment/reparse/path safety - `src/TeamForge.Launcher.Core/PathResilience.cs` — path budget/capability/strategy routing - `src/TeamForge.Launcher.Core/ExecutionAliasManager.cs` — TeamForge-owned execution alias creation/revalidation - `src/TeamForge.Launcher.Core/DiagnosticsRecovery.cs` — stable recovery actions and bounded diagnostics history - `src/TeamForge.Launcher.Core/DiagnosticSupportBundle.cs` — manual local ZIP construction and redaction/safe-state contract - `src/TeamForge.Launcher.Core/UnityLaunchPolicy.cs` — final Unity executable/project validation and process launch - `runtime-loader.mjs` — bundled Runtime verification and Guest bridge import - `test/`, `tests/` — Node and .NET Launcher tests, including `TeamForge.Diagnostics.Tests` - `tests/TeamForge.Launcher.Ui.Tests/` — Windows STA WPF input, credential cleanup and MainWindow startup/shutdown tests; `ShutdownTests.cs` drives the real BridgeClient with a bounded synthetic child - `tests/TeamForge.Launcher.Ui.Tests/UnityLaunchTests.cs` — gated handoff/context races using real temporary Active/refresh/path policies and synthetic probe/start effects; owned version-probe child cancellation ## Repository / release tooling - `test-lab.json` + `scripts/test-lab.mjs` — named validation-scenario discovery/orchestration; `scripts/test-lab-environment.mjs` owns environment preflight and installed Editor discovery - `scripts/unity-clone-probe.py` — run-owned clone receipts, exact fresh NUnit evidence and bounded cleanup for the baseline Authority CI lane; hermetic host regressions live in `scripts/test_unity_clone_probe.py` - `scripts/prepare-unity-runner.sh` — guarded disposable hosted-runner disk preparation before Unity image extraction - `quality-gates.json` + `scripts/classify-change.mjs` — path-based risk / evidence routing aid - `scripts/validate-documentation.mjs` — documentation ownership/discovery/link contract - `scripts/validate-engineering.mjs` — engineering process / quality-gate contract - `scripts/validate-public-source.mjs` — normal fresh-clone source/document/contract validation - `scripts/validate-repository.mjs` — fully staged release-candidate validation - `scripts/build-launcher.mjs`, `scripts/verify-launcher.mjs`, `scripts/stage-release.mjs` — WP-neutral release entry points - `.github/workflows/` — source CI, Unity automation, dependency/security checks and release publication Do not infer a physical field PASS from source/release-tooling automation. Current release effect belongs in [docs/STATUS.md](docs/STATUS.md). ## Maintainability navigation rule File count is not a quality metric. Keep the map organized around stable subsystem owners, not around line-count-driven extraction. A large cohesive file may be clearer than several tiny wrappers; a large file becomes debt when distinct responsibilities/lifecycles/dependencies can be separated without obscuring the operation. Conversely, if one concept spreads across many small files, group it behind a meaningful component/subdirectory and a small discoverable public surface rather than growing a flat helper maze. Preserve conceptual meaning while navigating and refactoring. Code that looks structurally similar is not automatically one concept: Project identity, revision, lock, Presence, Transform/Hierarchy authority, transfer, staging/activation, recovery, and trust boundaries can share mechanics while remaining intentionally distinct. Prefer a shared abstraction only when responsibility, lifecycle, invariants, and reason to change align. When a similarity is deliberate but the concepts must remain separate, keep the established TeamForge names and note the distinction near the relevant owner entry rather than normalizing everything into a generic helper/model. When an extraction changes where a maintainer should start reading, update the relevant entry above. The CI maintainability review warns about growth/scope/fragmentation signals but intentionally does not fail a PR for architecture style alone. ## Reading rules For an implementation task: 1. use [docs/HOW_IT_WORKS.md](docs/HOW_IT_WORKS.md) first when the end-to-end behavior is unclear; 2. find the smallest relevant module here; 3. read its module README and nearest tests; 4. read [docs/architecture.md](docs/architecture.md) if the change crosses authority, identity, transport, persistence, path or trust boundaries; 5. read historical phase/work-state notes only when the history itself matters. For source setup and validation commands, use **[docs/SOURCE.md](docs/SOURCE.md)** rather than this file.