# init-deep: AGENTS.md Generation Plan **Generated:** 2026-05-22 **Branch:** `main` (`92051d5`) ## Overview Generate hierarchical AGENTS.md files for the NexusGuard SD-WAN Suite monorepo. Scored 4 locations for AGENTS.md: root + 3 submodules. ## Scoring Results | Location | Score | Reason | Action | |----------|-------|--------|--------| | `.` (root) | — | Always create root | CREATE | | `apps/server-core/` | 3+2+2+1=8+ | 54 files (3x), 9 subdirs (2x), go.mod (2x), Dockerfile (1x) | CREATE | | `apps/dashboard-ui/` | 3+2+2+1=8+ | 54 files (3x), 8 subdirs (2x), package.json (2x), tsconfig (1x) | CREATE | | `apps/device-agent/` | 3+0+2+0=5+ | 21 files (3x), 5 subdirs (0x), go.mod (2x) | CREATE (≥15) | | `apps/server-core/api/` | 0 | 17 files (<20) | SKIP (parent covers) | | `apps/dashboard-ui/views/` | 0 | 7 files (<20) | SKIP (parent covers) | | `apps/dashboard-ui/api/` | 0 | 7 files (<20) | SKIP (parent covers) | ## Files to Create/Update No existing AGENTS.md files found. All 4 are new files (`Write`). --- ## File 1: `./AGENTS.md` (Root — 122 lines) ```markdown # PROJECT KNOWLEDGE BASE **Generated:** 2026-05-22 **Commit:** `92051d5` **Branch:** `main` ## OVERVIEW NexusGuard SD-WAN Suite — Enterprise Zero-Trust SD-WAN with WireGuard tunneling, centralized IPAM, and real-time nftables network isolation. Monorepo with 3 git submodules: Go backend (Gin), Vue 3 dashboard, Go device agent. ## STRUCTURE ``` ./ ├── apps/ │ ├── server-core/ # Go/Gin API backend (submodule) │ ├── dashboard-ui/ # Vue 3 + Vite frontend (submodule) │ └── device-agent/ # Go stealth daemon (submodule) ├── docker-compose.yml # Production orchestration ├── docker-compose.dev.yml # Dev (air hot-reload) ├── Makefile # up/down/dev/migrate/reset-db ├── setup.sh # First-run: generate .env + random keys ├── .env.example # DB/JWT/SALT/VITE config template ├── .gitmodules # 3 submodules → git.datadunia.com └── .opencode/ # IDE agent config (tooling, not project code) ``` **CRITICAL**: `apps/*` are **git submodules** — clone with `--recurse-submodules`. ## WHERE TO LOOK | Task | Location | Notes | |------|----------|-------| | API handlers | `apps/server-core/api/` | 17 files: auth, devices, peers, rules, share, provisioning, servers, wg | | Backend core | `apps/server-core/internal/` | auth, config, firewall, heartbeat, ipam, models, wgmanager | | Dev migration | `apps/server-core/main_dev.go` | GORM AutoMigrate (build tag `dev`) | | Firewall rules | `apps/server-core/internal/firewall/` | nftables Linux rules | | Dashboard views | `apps/dashboard-ui/src/views/` | Vue SFC pages | | Dashboard API client | `apps/dashboard-ui/src/api/` | Axios API modules | | Dashboard stores | `apps/dashboard-ui/src/stores/` | Pinia state stores | | Agent client | `apps/device-agent/internal/client/` | Provisioning + heartbeat | | Agent tunnel | `apps/device-agent/internal/tunnel/` | Memory-injected WireGuard | | Shared crypto | `apps/*/shared/crypto/encryptor.go` | AES-256-GCM (duplicated identical) | | CI workflows | `apps/*/.gitea/workflows/build.yml` | Gitea Actions per submodule | | Build config | `apps/dashboard-ui/vite.config.ts` | Vite 8 + Vue + TailwindCSS v4 | | Source of truth | `apps/server-core/docs/` | API_SPEC, KEY_ROTATION, PEER_DISCOVERY | | Plan guardrails | `.sisyphus/plans/` | Anti-patterns, "Must NOT do" rules | ## CODE MAP | Symbol | Type | Location | Role | |--------|------|----------|------| | `main()` (server-core) | func | `apps/server-core/main.go` | Entry: CLI flags + Gin init | | `main()` (device-agent) | func | `apps/device-agent/main.go` | Entry: agent daemon lifecycle | | `config.Load()` | func | `apps/server-core/internal/config/` | Env-based config loader | | `auth.Init()` | func | `apps/server-core/internal/auth/` | JWT sign/verify init | | `firewall.InitNetwork()` | func | `apps/server-core/internal/firewall/` | nftables table/set creation | | `ipam.AllocateIP()` | func | `apps/server-core/internal/ipam/` | IP pool allocation from CIDR | | `wgmanager.SetConfig()` | func | `apps/server-core/internal/wgmanager/` | WireGuard config push | | `models.AutoMigrate()` | func | `apps/server-core/internal/models/` | GORM schema migration | | `encrypt()` / `decrypt()` | func | `apps/*/shared/crypto/encryptor.go` | AES-256-GCM (identical) | ## CONVENTIONS - **Go**: Standard layout (`main.go` in root, `internal/`, `api/`) - **Vue 3**: Composition API + `