{
  "agent": {
    "name": "general-purpose",
    "outputSchema": {
      "properties": {
        "justifications": {
          "type": "object"
        },
        "prioritized": {
          "properties": {
            "mustHave": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "niceToHave": {
              "items": {
                "type": "string"
              },
              "type": "array"
            }
          },
          "type": "object"
        },
        "recommendedAgents": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "recommendedMethodology": {
          "type": "string"
        },
        "recommendedProcesses": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "recommendedSkills": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "remediations": {
          "items": {
            "properties": {
              "painPointId": {
                "type": "string"
              },
              "process": {
                "type": "string"
              },
              "recommendation": {
                "type": "string"
              }
            },
            "type": "object"
          },
          "type": "array"
        }
      },
      "required": [
        "recommendedProcesses",
        "recommendedSkills",
        "recommendedMethodology"
      ],
      "type": "object"
    },
    "prompt": {
      "context": {
        "availableProcessCategories": [
          "gsd (Get Stuff Done - general project workflows: new-project, discuss, plan, execute, verify, audit, map-codebase, iterative-convergence)",
          "methodologies (TDD, agile, spec-driven, evolutionary, domain-driven, self-assessment, etc.)",
          "cradle (installation and onboarding: user-install, project-install)",
          "specializations/data-science-ml",
          "specializations/devops-sre-platform",
          "specializations/ux-ui-design",
          "specializations/product-management",
          "specializations/data-engineering-analytics",
          "specializations/technical-documentation",
          "specializations/domains/science",
          "specializations/domains/business",
          "specializations/domains/social-sciences-humanities"
        ],
        "miningResult": {
          "bottlenecks": [
            {
              "description": "Long-press BACK timer (LONG_PRESS_MS = 800) is hand-rolled and duplicated across BreathHoldDelegate.mc, DepthDelegate.mc, DistanceDelegate.mc, plus onKey/onKeyPressed/onKeyReleased tri-state handling. Any state-machine regression must be fixed in each copy.",
              "frequency": "Touched on every back-button behavior change (see git-less history of v1 settings + v2 settings additions)",
              "id": "BN-1",
              "impact": "Maintenance duplication; risk of inconsistent button behavior across v1 and v2 builds.",
              "location": "source/BreathHoldDelegate.mc lines 8-13,60-79; source_fenix5/DepthDelegate.mc lines 8-13,70-92; source_fenix5/DistanceDelegate.mc lines 8-13,68-86"
            },
            {
              "description": "FIT developer field ids are hard-coded inline in each view's startRecording() instead of a shared FitFields helper. APP_DESIGN_V2.md §9 already proposes FitFields.mc (optional) but it has not been created.",
              "frequency": "Every new FIT field addition (e.g., max_depth_m, dive_time_s, surface_interval_s)",
              "id": "BN-2",
              "impact": "Cross-mode field id drift risk; changing an id requires editing 4-5 files; documentation is the only source of truth for the shared id space.",
              "location": "source_fenix5/DepthView.mc:206-245, DistanceView.mc:168-206, StaticView.mc:147-172, BreathingView.mc:181-204; design in APP_DESIGN_V2.md:306-328"
            },
            {
              "description": "DepthModel.calibrateSurface() takes a single rawAmbientPressure sample instead of averaging, contrary to PORT_FENIX5.md §4 ('take a short average 3-5 samples'). Single-sample calibration is sensitive to wave/temperature jitter.",
              "frequency": "Every dive start (calibrateSurface called on every breath-up -> surface transition)",
              "id": "BN-3",
              "impact": "Reduced depth accuracy and noisy surface zero reference, particularly in chop or quick weather changes.",
              "location": "source_fenix5/DepthModel.mc:14-22; documented better approach in PORT_FENIX5.md:90-103"
            },
            {
              "description": "FIT session 'name' string is hard-coded per view (BreathHold, FreediveDepth, FreediveDistance, FreediveStatic, BreathingTrainer) and shows up in Connect as the activity title. No central registry or i18n layer.",
              "frequency": "Naming/label change in Connect",
              "id": "BN-4",
              "impact": "Label changes require edits in 5 places; no @Strings.* indirection used at this level (manifests reference @Strings.AppName but the FIT names are inline).",
              "location": "source/BreathHoldView.mc:163, source_fenix5/BreathingView.mc:176, DepthView.mc:202, DistanceView.mc:163, StaticView.mc:143"
            }
          ],
          "branchPatterns": "N/A (no git history)",
          "commitPatterns": "N/A (no git history)",
          "contributors": [
            {
              "areas": [
                "fenix3 v1 single-mode breath-hold + pool-length app (source/)",
                "fenix5 v2 multi-discipline menu app (source_fenix5/)",
                "All design/implementation documentation (README.md, IMPLEMENTATION_PLAN.md, PORT_FENIX5.md, APP_DESIGN_V2.md)",
                "Build tooling (build.sh, build_fenix5.sh, .gitignore)",
                "FIT developer field-id schema (APP_DESIGN_V2.md §9)"
              ],
              "commitCount": 0,
              "name": "Unknown (no git history)"
            }
          ],
          "evolution": {
            "growthAreas": [
              "source_fenix5/ (22 files, ~70 KB) is roughly 3.5x the size of source/ (6 files, ~17 KB), reflecting the v2 multi-discipline expansion.",
              "Depth/Distance FIT recording paths grew to 4-8 FitContributor fields per session (BreathingView.mc ~5 fields, DepthView.mc ~8 fields, DistanceView.mc ~8 fields, StaticView.mc ~5 fields) versus 4 fields in the original source/BreathHoldView.mc.",
              "Persistent settings surface expanded from 2 keys (poolLengthM, poolLengthIndex) in source/Settings.mc to 10 keys + an array in source_fenix5/AppSettings.mc."
            ],
            "majorEvents": [
              {
                "date": "Pre-v2 (initial fenix3 build)",
                "evidence": "source/BreathHoldApp.mc, source/BreathHoldView.mc, source/Settings.mc, source/PoolLength*.mc, manifest.xml (minApiLevel=1.4.0)",
                "id": "EV-1",
                "summary": "Initial single-mode breath-hold + pool-length app on fēnix 3 / fēnix 3 HR (API 1.4.0). Source under source/, manifest.xml declares fenix3 + fenix3_hr products."
              },
              {
                "date": "v2 design phase",
                "evidence": "APP_DESIGN_V2.md sections 10-11 (Implementation Phases), README.md lines 5/105 ('New design ... v2')",
                "id": "EV-2",
                "summary": "Multi-discipline v2 design formalized in APP_DESIGN_V2.md (Depth / Distance / Static Apnoe / Breathing Trainer menu). Implementation phases 1-4 marked as completed (basic); phase 5 (Polish) deferred."
              },
              {
                "date": "fēnix 5 port",
                "evidence": "source_fenix5/Fenix5App.mc, MainMenuView.mc, DepthView.mc, DistanceView.mc, StaticView.mc, BreathingView.mc, AppSettings.mc, DepthModel.mc, manifest_fenix5.xml, monkey_fenix5.jungle, build_fenix5.sh",
                "id": "EV-3",
                "summary": "Source duplicated to source_fenix5/ with separate manifest_fenix5.xml + monkey_fenix5.jungle, new Fenix5App entry, MainMenuView + SubMenuView scaffold, plus Depth/Distance/Static/Breathing view-delegates and shared AppSettings/Common/DepthModel."
              },
              {
                "date": "Pool-length horizontal distance feature (intermediate)",
                "evidence": "source/BreathHoldDelegate.mc (long-press BACK), source/PoolLengthView.mc, source/PoolLengthDelegate.mc, BreathHoldView.mc startRecording() lines 152-184, IMPLEMENTATION_PLAN.md section 11",
                "id": "EV-4",
                "summary": "Manual pool-length counter added to fēnix 3 build via long-press BACK settings picker, FIT developer fields horizontal_distance_m (id 2) and length_count (id 3)."
              }
            ],
            "technologyChanges": [
              "Connect IQ API migration 1.4.0 (fēnix 3) -> 2.4.0+ (fēnix 5/5S/5X/5 Plus) to unlock Activity.Info.rawAmbientPressure for real depth measurement (PORT_FENIX5.md).",
              "Pressure source migration: Sensor.Info.pressure (sea-level calibrated, depth-unusable) -> Activity.Info.rawAmbientPressure (raw ambient) implemented in source_fenix5/DepthModel.mc.",
              "FIT field taxonomy unification: previously ad-hoc 4 developer field ids in source/BreathHoldView.mc; in source_fenix5/ a single 17-id allocation table in APP_DESIGN_V2.md §9 is shared across Depth/Distance/Static/Breathing sessions.",
              "Build pipeline: monkey.jungle (single manifest) split into monkey.jungle + monkey_fenix5.jungle with separate build scripts (build.sh -> build_fenix5.sh)."
            ]
          },
          "implicitRules": [
            "v1 fenix3 code in source/ is preserved but frozen - README.md and APP_DESIGN_V2.md both state 'v2 ... fenix 3 v1 code is preserved but not extended'.",
            "Two parallel Monkey C projects are maintained side-by-side via separate jungle + manifest pairs (monkey.jungle+manifest.xml, monkey_fenix5.jungle+manifest_fenix5.xml); cross-building between them is intentionally avoided.",
            "Personal sideload only - APP_DESIGN_V2.md and IMPLEMENTATION_PLAN.md both forbid Connect IQ Store submission ('Garmin does not allow diving/breath-hold apps in the Connect IQ Store'). Developer key (.der/.pem) is excluded from git via .gitignore.",
            "FIT custom developer fields only - the codebase intentionally does NOT write the Garmin standard distance field for Distance mode (PORT_FENIX5.md §5; README.md 'Pool horizontal distance').",
            "Manual input for horizontal distance - GPS does not work underwater and accelerometer dead-reckoning is rejected (README.md, PORT_FENIX5.md §2); therefore the user must press UP per length.",
            "Pool-density fresh/salt toggle is treated as a forward-compatibility placeholder for fenix3 (IMPLEMENTATION_PLAN.md §0 'fresh/salt toggle retained for future extensibility; not used for depth on fenix3') but is live in fenix5 via AppSettings.waterType.",
            "Single-button long-press detection uses a fixed 800 ms threshold (LONG_PRESS_MS) and an explicit backTimer to disambiguate short/long BACK presses; this convention is copied verbatim from BreathHoldDelegate to DepthDelegate and DistanceDelegate.",
            "Depth calculation must clamp negative splash noise to 0 (DepthModel.mc:33; PORT_FENIX5.md:96) - implicit rule shared between docs and code.",
            "Sensor permissions are declared as Sensor/ActivityRecording/FitContributor in BOTH manifests; permissions are kept minimal and identical across v1 and v2.",
            "The fenix5plus manifest in source_fenix5/manifest_fenix5.xml only lists fenix5plus as a product even though APP_DESIGN_V2.md and README.md describe the full fenix5 family; build_fenix5.sh exposes BUILD_VARIANTS to extend at build time but the default ship target is fenix5plus."
          ],
          "metadata": {
            "derivationSource": "code + documentation only (no .git directory at /mnt/flash1/code/garmin-freedive-app)",
            "filesScanned": 35,
            "gitHistoryAvailable": false,
            "primarySources": [
              "README.md",
              "IMPLEMENTATION_PLAN.md",
              "PORT_FENIX5.md",
              "APP_DESIGN_V2.md",
              "manifest.xml + manifest_fenix5.xml",
              "monkey.jungle + monkey_fenix5.jungle",
              "build.sh + build_fenix5.sh",
              "source/*.mc (6 files)",
              "source_fenix5/*.mc (22 files)"
            ]
          },
          "painPoints": [
            {
              "category": "build / verification",
              "description": "Code in source_fenix5/ has been 'reviewed for API 2.4.0+ compatibility but NOT compiled' because the Connect IQ SDK requires the GUI SDK Manager and X11. There is no way to verify the v2 build from a CLI / headless environment.",
              "discoveredVia": "APP_DESIGN_V2.md section 10 phase 5 'Open TODOs: ... Code was reviewed for API 2.4.0+ but not compiled (Connect IQ SDK not installed in this environment).'; build_fenix5.sh echoes 'SDK Manager requires a graphical display; it will not run in a headless container without X11/Xvfb.'",
              "id": "PP-1",
              "severity": "high"
            },
            {
              "category": "configuration drift",
              "description": "All five sensor/activity/fit permissions are declared in BOTH manifest.xml and manifest_fenix5.xml but the v2 manifest narrows supported devices to a single product (fenix5plus) while documentation claims a full six-device matrix (fenix5/5S/5X/5 Plus/5S Plus/5X Plus).",
              "discoveredVia": "manifest_fenix5.xml iq:products contains only fenix5plus; README.md lines 107-114 and APP_DESIGN_V2.md §2 promise the full 5-series matrix.",
              "id": "PP-2",
              "severity": "medium"
            },
            {
              "category": "data integrity",
              "description": "FIT developer field-id conflicts could occur if more than one view-mode shares a session: ids 0 (discipline), 9 (breathhold_time_s), 10 (breath_up_time_s), 12 (last_hr_bpm) are repeated across DepthView, DistanceView, StaticView, BreathingView. The allocation table in APP_DESIGN_V2.md §9 documents this but there is no compile-time check.",
              "discoveredVia": "Cross-grep of createField calls in source_fenix5/*.mc; design intent in APP_DESIGN_V2.md:306-328.",
              "id": "PP-3",
              "severity": "medium"
            },
            {
              "category": "accuracy / UX",
              "description": "DepthModel.calibrateSurface() averages only a single sample and the calibrate-once-per-session flow has no manual re-calibrate hotkey (long-press START was proposed in PORT_FENIX5.md §6 but never implemented in DepthDelegate.mc).",
              "discoveredVia": "source_fenix5/DepthModel.mc:14-22; PORT_FENIX5.md:90-103 + §9 'manual re-calibrate' decision item; DepthDelegate.mc only handles START, ESC, LAP.",
              "id": "PP-4",
              "severity": "medium"
            },
            {
              "category": "engineering process",
              "description": "No automated tests, no CI, no linter, no formatter exist for either source tree. Regression risk for the hand-rolled long-press timer and per-view state machines is unbounded.",
              "discoveredVia": ".pi-subagents/artifacts/431b6660_scout_1_output.md (no linting/testing/formatting configured); absence of any *test* files; only build artifacts.",
              "id": "PP-5",
              "severity": "medium"
            },
            {
              "category": "maintainability",
              "description": "Connect IQ Watch App session is hard-coded per view with raw Sport/SubSport constants (ActivityRecording.SPORT_SWIMMING etc.). No central place enumerates modes -> (sport, subSport) tuples; tweaking requires editing 4 view files.",
              "discoveredVia": "grep of SPORT_/SUB_SPORT_ across source_fenix5/*.mc shows 4 distinct inline definitions.",
              "id": "PP-6",
              "severity": "low"
            },
            {
              "category": "feature completeness",
              "description": "SettingsView in source_fenix5/ (SettingsView.mc) shows only 3 of the 10+ persisted keys (pool length, water type, distance DOWN). Defaults like defaultBreathUpS, defaultRecoveryS, breathingRestSeries, breathingHoldTargetS, staticBreathUpS, staticRecoveryS are loaded but no UI exists to edit them.",
              "discoveredVia": "source_fenix5/AppSettings.mc (10 fields, rest-series array) vs source_fenix5/SettingsView.mc (3 items).",
              "id": "PP-7",
              "severity": "low"
            },
            {
              "category": "documentation",
              "description": "README.md still leads with the v1 fenix3 build instructions before introducing the v2 fenix5 build, and the disclaimer section was written for a single-watch hobby project but the v2 app now ships for the whole fenix5 family. Sideload instructions do not list per-variant filenames.",
              "discoveredVia": "README.md line 105 'fenix 5 v2 build' is appended after the v1 sideload walkthrough.",
              "id": "PP-8",
              "severity": "low"
            }
          ],
          "releasePatterns": "N/A (no git history)"
        },
        "profile": {
          "architecture": {
            "dataFlow": "AppBase.onStart -> Settings/AppSettings.load() reads object-store properties via Application.getApp().getProperty(). User input flows through InputDelegate.onKeyPressed -> onShow timers (1 Hz) call onTimer() which samples Sensor.getInfo().heartRate, computes depth via DepthModel.depthM() (rawAmbientPressure differential), updates session FitContributor fields (setData on RECORD and SESSION messages), and triggers WatchUi.requestUpdate(). The per-View state machine (STATE_IDLE / STATE_BREATH_UP / STATE_HOLD / STATE_DIVE / STATE_RECOVERY / STATE_DONE) advances on START; session.start() / session.stop() / session.save() / session.discard() controls FIT persistence. Long-press BACK uses a Timer.Timer (LONG_PRESS_MS=800) to open Settings via pushView. On exit, AppSettings.save() persists via Application.getApp().setProperty(). No traditional database; all persistence is the Connect IQ object store, and analytics are written into FIT files via FitContributor.",
            "entryPoints": [
              "source/BreathHoldApp.mc — Application.AppBase entry for v1, declared by manifest.xml",
              "source_fenix5/Fenix5App.mc — Application.AppBase entry for v2, declared by manifest_fenix5.xml",
              "build.sh — bash build driver for v1 (fenix3 + fenix3_hr)",
              "build_fenix5.sh — bash build driver for v2 (defaults to fenix5plus; commented hook for full fenix5 family)"
            ],
            "modules": [
              {
                "dependencies": [
                  "resources/"
                ],
                "description": "Original single-mode breath-hold timer (prep/hold/recovery) with manual pool-length distance, HR sampling, and FIT session recording for Garmin fenix3 / fenix3_hr (CIQ API 1.4.0).",
                "name": "v1 fenix3 breath-hold app (source/)",
                "path": "source/"
              },
              {
                "dependencies": [
                  "resources/"
                ],
                "description": "Multi-discipline freedive app with MainMenu launching Depth, Distance, Static Apnoe, and Breathing Trainer modes. Includes depth calculation from Activity.Info.rawAmbientPressure, settings persistence, and FIT recording for fenix5plus (CIQ SDK 2.4.0+).",
                "name": "v2 fenix5 main-menu app (source_fenix5/)",
                "path": "source_fenix5/"
              },
              {
                "description": "String resources (AppName) referenced from both jungle manifests.",
                "name": "Shared resources (resources/)",
                "path": "resources/"
              }
            ],
            "pattern": "Multi-target monolithic watch-app repository (two parallel Monkey C apps sharing only resources/, with separate manifest + jungle pairs; intentionally not a true monorepo with shared modules)."
          },
          "bottlenecks": [
            {
              "description": "Long-press BACK timer (LONG_PRESS_MS = 800) is hand-rolled and duplicated across BreathHoldDelegate.mc, DepthDelegate.mc, DistanceDelegate.mc, plus onKey/onKeyPressed/onKeyReleased tri-state handling. Any state-machine regression must be fixed in each copy.",
              "frequency": "Touched on every back-button behavior change (history of v1 settings + v2 settings additions)",
              "id": "bn-source-1",
              "impact": "Maintenance duplication; risk of inconsistent button behavior across v1 and v2 builds.",
              "location": "source/BreathHoldDelegate.mc lines 8-13, 60-79; source_fenix5/DepthDelegate.mc lines 8-13, 70-92; source_fenix5/DistanceDelegate.mc lines 8-13, 68-86"
            },
            {
              "description": "FIT developer field ids are hard-coded inline in each view's startRecording() instead of a shared FitFields helper. APP_DESIGN_V2.md §9 already proposes FitFields.mc (optional) but it has not been created.",
              "frequency": "Every new FIT field addition (e.g. max_depth_m, dive_time_s, surface_interval_s)",
              "id": "bn-source_fenix5-1",
              "impact": "Cross-mode field id drift risk; changing an id requires editing 4-5 files; documentation is the only source of truth for the shared id space.",
              "location": "source_fenix5/DepthView.mc:206-245, DistanceView.mc:168-206, StaticView.mc:147-172, BreathingView.mc:181-204; design in APP_DESIGN_V2.md:306-328"
            },
            {
              "description": "DepthModel.calibrateSurface() takes a single rawAmbientPressure sample instead of averaging, contrary to PORT_FENIX5.md §4 ('take a short average 3-5 samples'). Single-sample calibration is sensitive to wave/temperature jitter.",
              "frequency": "Every dive start (calibrateSurface called on every breath-up -> surface transition)",
              "id": "bn-source_fenix5-2",
              "impact": "Reduced depth accuracy and noisy surface zero reference, particularly in chop or quick weather changes.",
              "location": "source_fenix5/DepthModel.mc:14-22; documented better approach in PORT_FENIX5.md:90-103"
            },
            {
              "description": "FIT session 'name' string is hard-coded per view (BreathHold, FreediveDepth, FreediveDistance, FreediveStatic, BreathingTrainer) and shows up in Connect as the activity title. No central registry or i18n layer.",
              "frequency": "Naming/label change in Connect",
              "id": "bn-source_fenix5-3",
              "impact": "Label changes require edits in 5 places; no @Strings.* indirection used at this level (manifests reference @Strings.AppName but the FIT names are inline).",
              "location": "source/BreathHoldView.mc:163, source_fenix5/BreathingView.mc:176, DepthView.mc:202, DistanceView.mc:163, StaticView.mc:143"
            }
          ],
          "cicd": {
            "babysitterIntegration": {
              "enabled": false,
              "processIds": [],
              "triggerOn": []
            },
            "configPaths": [],
            "pipelines": [],
            "provider": "none"
          },
          "claudeMdInstructions": [
            "Enforce existing Monkey C conventions: one class per .mc file, PascalCase filename matching class name, alphabetical Toybox using imports, UPPER_SNAKE_CASE constants, camelCase functions and variables, 4-space indentation.",
            "Do not edit frozen v1 source/ — it is preserved but not extended (per README and APP_DESIGN_V2.md).",
            "All UI navigation must use WatchUi.pushView / popView / switchToView with SLIDE_LEFT/SLIDE_RIGHT slide directions.",
            "All persistence must go through Application.getApp().getProperty / setProperty — no file I/O.",
            "Long-press BACK is the project-wide convention for opening settings; do not change the LONG_PRESS_MS threshold without updating DepthDelegate, DistanceDelegate, and BreathHoldDelegate in lockstep.",
            "FIT developer field IDs must follow the shared allocation table in APP_DESIGN_V2.md §9; reuse is by design but every id must be defined exactly once (move toward a FitFields helper).",
            "Use defensive `has` symbol-presence guards and null checks (no try/catch available in Monkey C).",
            "Respect the fēnix5-only depth focus (fenix6/7/8/Tactix are avoided per APP_DESIGN_V2.md §11).",
            "Project is sideload-only; do not propose Connect IQ Store submission (forbidden by Garmin policy for diving apps)."
          ],
          "conventions": {
            "additionalRules": [
              "Enforce existing Monkey C conventions (per interview response): one class per .mc file, PascalCase filename matching class, alphabetical Toybox using imports, UPPER_SNAKE_CASE constants, camelCase functions and variables, 4-space indentation.",
              "Min API level pinned per build: fenix3 = 1.4.0 (manifest.xml), fenix5 = 2.4.0 (manifest_fenix5.xml uses minSdkVersion='2.4.0').",
              "Each Monkey C module exposes exactly one class; the file name matches the class name in PascalCase.",
              "The fenix3 and fenix5 codebases are intentionally separate to avoid the `has`-check optimizer surprises described in PORT_FENIX5.md §1 (no shared module layer; both source/ and source_fenix5/ have their own Settings/AppSettings, App entry, views, and delegates).",
              "FIT developer field IDs are reserved in a single shared ID space (APP_DESIGN_V2.md §9) to prevent collisions across modes.",
              "Long-press BACK (>=800 ms) is a project-wide convention for opening settings from any idle / breath-up screen; short BACK exits or discards.",
              "FENIX5-only focus per APP_DESIGN_V2.md §11: development targets fēnix 5/5S/5X/5 Plus/5S Plus/5X Plus; fenix6/7/8/Tactix are explicitly avoided for depth (reportedly capped ~3 m).",
              "All persistence goes through Application.getApp().getProperty/setProperty; no file I/O.",
              "All UI navigation is via WatchUi.pushView / popView / switchToView with SLIDE_LEFT/SLIDE_RIGHT slide directions; no in-place re-rendering between major screens.",
              "Distro is sideload-only; no Connect IQ Store release (diving apps prohibited per README)."
            ],
            "codeStyle": {
              "braces": "K&R / Allman-mix — opening brace on the same line for control flow, method bodies open on the next line. Function bodies and class bodies both use newlines before the first statement (e.g. `function initialize() {` then body)",
              "classStructure": "Const block -> instance vars declared with `var name;` -> constructor initialize() -> View lifecycle (onShow/onHide/onUpdate) -> state methods -> finishSession/discardSession -> onXxxButton handlers",
              "comments": "Sparse. Section markers (// ----) are not used; inline `// TODO` comments appear occasionally. Code in source_fenix5/Common.mc and DepthModel.mc uses units comments (e.g. `// kg/m³`, `// s`)",
              "destructuring": "Not used",
              "fileHeader": "Every source file begins with a `using` block; no copyright header",
              "imports": "Explicit `using Toybox.X;` directives at the top of each .mc file. Import order is alphabetical within the Toybox group.",
              "indentation": "4 spaces (consistent across all .mc files)",
              "lineEndings": "LF (Unix)",
              "typeAnnotations": "Static types not declared — Monkey C is dynamically typed; types are inferred from literals and FitContributor.DATA_TYPE_* constants"
            },
            "errorHandling": "Connect IQ Monkey C has no try/catch for application exceptions; the project uses defensive null-guards and the `has` symbol-presence operator. Patterns observed: (1) `if (Sensor has :setEnabledSensors)` guards API-version-dependent calls (Fenix5App.mc:14, BreathHoldApp.mc:15). (2) `if (info has :rawAmbientPressure && info.rawAmbientPressure != null)` guards fēnix 5 raw-pressure access (DepthModel.mc:14, :24). (3) Optional FitContributor fields checked for `null` before `setData` (e.g. DepthView.mc:182-187). (4) Settings.load() checks each property for null and falls back to defaults (AppSettings.mc:30-62). (5) `discardSession()` defensively nulls `session` after stop+discard, stops the timer, and resets state. (6) Long-press BACK uses an 800 ms Timer to disambiguate short vs. long press, with a 500 ms swallow window in PoolLengthDelegate to ignore the BACK release that follows the long-press (PoolLengthDelegate.mc:43-49).",
            "git": {
              "branching": "N/A — repository is not initialized as a git working tree in this checkout (no .git/ directory present)",
              "commitConventions": "N/A",
              "gitignore": "Ignores bin/, *.prg, *.iq, *.pem, *.der, swap files, .DS_Store, .vscode/settings.json. Note: developer_key.der and developer_key.pem are present in the working tree despite being listed in .gitignore.",
              "vcs": "Not a git repository (git rev-parse reports 'not a git repository')"
            },
            "importOrder": [
              "using Toybox.Activity;",
              "using Toybox.ActivityRecording;",
              "using Toybox.Application;",
              "using Toybox.FitContributor;",
              "using Toybox.Graphics;",
              "using Toybox.Lang;",
              "using Toybox.Sensor;",
              "using Toybox.System;",
              "using Toybox.Timer;",
              "using Toybox.WatchUi;"
            ],
            "naming": {
              "classes": "PascalCase, e.g. BreathHoldApp, MainMenuView, DepthDelegate, DepthModel, AppSettings, Common",
              "constants": "UPPER_SNAKE_CASE, e.g. STATE_BREATH_UP, ITEM_DEPTH, PRESET_25, LONG_PRESS_MS, G, RHO_FRESH, RHO_SALT",
              "disciplineCodes": "Short all-caps discipline labels stored in the FIT discipline field: CWT, FIM, CWT-B, CWT-M, CNF, DYN-B, DYN-M, DNF, STA, BREATHE",
              "fieldIds": "Numeric developer field IDs allocated per APP_DESIGN_V2.md §9 (0..16, 20, 21); e.g. depth_m=1, hr_bpm=2, max_depth_m=3, dive_time_s=4, surface_interval_s=5, horizontal_distance_m=6, length_count=7, stroke_count=8, breathhold_time_s=9, breath_up_time_s=10, recovery_time_s=11, last_hr_bpm=12, cycles_completed=13, total_hold_time_s=14, hold_target_s=15, contraction_count=16, lap_hold_s=20, lap_rest_s=21",
              "files": "PascalCase matching the single class inside (e.g. BreathHoldView.mc -> class BreathHoldView). One class per file.",
              "functions": "camelCase, e.g. onShow, onUpdate, onTimer, startRecording, finishSession, discardSession, onStartButton, onUpButton, onDownButton, calibrateSurface, depthM",
              "variables": "camelCase; instance vars declared with `var x;` at the top of the class (e.g. discipline, breathUpTime, currentDepthM, lastHeartRate). Static helpers in Common / DepthModel / AppSettings."
            },
            "testingConventions": "No automated test suite, no tests/ or spec/ directory, no test files. The project relies on Connect IQ simulator runs (monkeydo) and real-device sideload testing. README §Build steps describes the manual flow."
          },
          "createdAt": "2026-07-27T06:02:27.000Z",
          "description": "A Monkey C-based freediving companion watch application for Garmin fēnix 3 / fēnix 3 HR (v1) and fēnix 5 / 5S / 5X / 5 Plus / 5S Plus / 5X Plus (v2) devices. Provides a breath-hold timer, depth measurement from raw ambient pressure (Activity.Info.rawAmbientPressure), manual pool-length distance tracking, a static apnoe mode, and a CO2/O2 breathing trainer, with FIT activity recording for upload to Garmin Connect. Two parallel source trees (source/ and source_fenix5/) are maintained side-by-side with separate manifest + jungle pairs; v1 fenix3 code is frozen and v2 fenix5 code is the active development target.",
          "externalIntegrations": [
            {
              "category": "build-tooling",
              "enabled": true,
              "id": "ext-ciq-sdk-manager",
              "name": "Garmin Connect IQ SDK Manager",
              "purpose": "GUI tool to install/refresh the Connect IQ SDK and device simulators"
            },
            {
              "category": "build-tooling",
              "enabled": true,
              "id": "ext-ciq-sdk",
              "name": "Garmin Connect IQ SDK (monkeyc compiler)",
              "purpose": "Compiles .mc source to .prg artifacts per build script"
            },
            {
              "category": "distribution",
              "enabled": false,
              "id": "ext-ciq-store",
              "name": "Garmin Connect IQ Store",
              "purpose": "Distribution channel — explicitly NOT used (diving/breath-hold apps are not allowed in the store per Garmin policy)"
            },
            {
              "category": "hardware-sensor",
              "enabled": true,
              "id": "ext-hrm",
              "name": "ANT+ HRM-Tri / HRM-Swim chest strap",
              "purpose": "External heart-rate source during breath-hold and dive sessions"
            },
            {
              "category": "data-sync",
              "enabled": true,
              "id": "ext-connect",
              "name": "Garmin Connect",
              "purpose": "Receives uploaded FIT files with custom developer fields and renders activity records"
            },
            {
              "category": "identity",
              "enabled": true,
              "id": "ext-developer-garmin",
              "name": "developer.garmin.com (developer key signing)",
              "purpose": "Issues / verifies the developer signing key pair used to sign .prg artifacts"
            }
          ],
          "goals": [
            {
              "category": "quality",
              "description": "Create and test the application for errors as far as possible — review and statically check both source/ (v1) and source_fenix5/ (v2) Monkey C code for syntax, API-level, and convention issues.",
              "id": "goal-quality-1",
              "priority": "high",
              "status": "active"
            },
            {
              "category": "quality",
              "description": "Verify v2 (source_fenix5/) compatibility with Connect IQ API 2.4.0+ via static review and check for known API pitfalls (e.g. rawAmbientPressure availability, FitContributor field-id reuse).",
              "id": "goal-quality-2",
              "priority": "high",
              "status": "active"
            },
            {
              "category": "quality",
              "description": "Preserve and validate the frozen v1 fenix3 source/ build (API 1.4.0) — ensure changes in shared docs or resources do not regress the legacy build.",
              "id": "goal-quality-3",
              "priority": "medium",
              "status": "active"
            },
            {
              "category": "feature",
              "description": "Provide accurate depth measurement by deriving metres from Activity.Info.rawAmbientPressure against a per-session surface calibration (DepthModel.depthM / calibrateSurface).",
              "id": "goal-feature-1",
              "priority": "high",
              "status": "active"
            },
            {
              "category": "feature",
              "description": "Support the four-discipline v2 menu (Depth, Distance/DYN/DNF, Static Apnoe, Breathing Trainer) with a shared MainMenuView + SubMenu scaffold.",
              "id": "goal-feature-2",
              "priority": "high",
              "status": "active"
            },
            {
              "category": "feature",
              "description": "Persist user preferences across sessions via Application.getApp().getProperty / setProperty (pool length, water type, distance DOWN action, breathing series, static times).",
              "id": "goal-feature-3",
              "priority": "medium",
              "status": "active"
            },
            {
              "category": "feature",
              "description": "Record FIT activity files using Toybox.ActivityRecording + Toybox.FitContributor with custom developer field IDs allocated per APP_DESIGN_V2.md §9.",
              "id": "goal-feature-4",
              "priority": "high",
              "status": "active"
            },
            {
              "category": "distribution",
              "description": "Produce sideload-ready .prg artifacts for each BUILD_VARIANTS device via build.sh (fenix3 / fenix3_hr) and build_fenix5.sh (fenix5plus default).",
              "id": "goal-distribution-1",
              "priority": "medium",
              "status": "active"
            }
          ],
          "installedAgents": [],
          "installedProcesses": [],
          "installedSkills": [],
          "painPoints": [
            {
              "category": "build / verification",
              "description": "Code in source_fenix5/ has been 'reviewed for API 2.4.0+ compatibility but NOT compiled' because the Connect IQ SDK requires the GUI SDK Manager and X11. There is no way to verify the v2 build from a CLI / headless environment.",
              "discoveredVia": "APP_DESIGN_V2.md section 10 phase 5 'Open TODOs: ... Code was reviewed for API 2.4.0+ but not compiled (Connect IQ SDK not installed in this environment).'; build_fenix5.sh echoes 'SDK Manager requires a graphical display; it will not run in a headless container without X11/Xvfb.'",
              "id": "pp-build-1",
              "severity": "high",
              "suggestedRemediation": "Add a static Monkey C parser / AST check (e.g. monkeyc --validate-only or a CI lint step) and/or containerise the SDK with Xvfb to enable headless monkeyc invocations."
            },
            {
              "category": "configuration drift",
              "description": "All five sensor/activity/fit permissions are declared in BOTH manifest.xml and manifest_fenix5.xml but the v2 manifest narrows supported devices to a single product (fenix5plus) while documentation claims a full six-device matrix (fenix5/5S/5X/5 Plus/5S Plus/5X Plus).",
              "discoveredVia": "manifest_fenix5.xml iq:products contains only fenix5plus; README.md lines 107-114 and APP_DESIGN_V2.md §2 promise the full 5-series matrix.",
              "id": "pp-config-1",
              "severity": "medium",
              "suggestedRemediation": "Either expand the iq:products list to match the documented matrix or update README/APP_DESIGN_V2.md to match the shipped fenix5plus-only configuration."
            },
            {
              "category": "data integrity",
              "description": "FIT developer field-id conflicts could occur if more than one view-mode shares a session: ids 0 (discipline), 9 (breathhold_time_s), 10 (breath_up_time_s), 12 (last_hr_bpm) are repeated across DepthView, DistanceView, StaticView, BreathingView. The allocation table in APP_DESIGN_V2.md §9 documents this but there is no compile-time check.",
              "discoveredVia": "Cross-grep of createField calls in source_fenix5/*.mc; design intent in APP_DESIGN_V2.md:306-328.",
              "id": "pp-data-1",
              "severity": "medium",
              "suggestedRemediation": "Extract a FitFields.mc helper (already proposed in APP_DESIGN_V2.md §9) that owns the id allocation and exposes named accessors so ids are defined exactly once."
            },
            {
              "category": "accuracy / UX",
              "description": "DepthModel.calibrateSurface() averages only a single sample and the calibrate-once-per-session flow has no manual re-calibrate hotkey (long-press START was proposed in PORT_FENIX5.md §6 but never implemented in DepthDelegate.mc).",
              "discoveredVia": "source_fenix5/DepthModel.mc:14-22; PORT_FENIX5.md:90-103 + §9 'manual re-calibrate' decision item; DepthDelegate.mc only handles START, ESC, LAP.",
              "id": "pp-accuracy-1",
              "severity": "medium",
              "suggestedRemediation": "Average 3-5 rawAmbientPressure samples in calibrateSurface and wire a long-press START handler in DepthDelegate to call calibrateSurface mid-session."
            },
            {
              "category": "engineering process",
              "description": "No automated tests, no CI, no linter, no formatter exist for either source tree. Regression risk for the hand-rolled long-press timer and per-view state machines is unbounded.",
              "discoveredVia": "Absence of any *test* files; only build artifacts in bin/; no .github, .gitlab-ci.yml, Jenkinsfile, .circleci, or azure-pipelines.yml.",
              "id": "pp-process-1",
              "severity": "medium",
              "suggestedRemediation": "Introduce at minimum a parser-level smoke check (monkeyc --validate-only or a connectiq-parser script) and a minimal headless build step that runs in CI on every change."
            },
            {
              "category": "maintainability",
              "description": "Connect IQ Watch App session is hard-coded per view with raw Sport/SubSport constants (ActivityRecording.SPORT_SWIMMING etc.). No central place enumerates modes -> (sport, subSport) tuples; tweaking requires editing 4 view files.",
              "discoveredVia": "Grep of SPORT_/SUB_SPORT_ across source_fenix5/*.mc shows 4 distinct inline definitions.",
              "id": "pp-maintainability-1",
              "severity": "low",
              "suggestedRemediation": "Add a ModeRegistry (or extend Common.mc) that maps each discipline (CWT, DYN-B, ...) to its (sport, subSport) tuple and have all views read from it."
            },
            {
              "category": "feature completeness",
              "description": "SettingsView in source_fenix5/ (SettingsView.mc) shows only 3 of the 10+ persisted keys (pool length, water type, distance DOWN). Defaults like defaultBreathUpS, defaultRecoveryS, breathingRestSeries, breathingHoldTargetS, staticBreathUpS, staticRecoveryS are loaded but no UI exists to edit them.",
              "discoveredVia": "source_fenix5/AppSettings.mc (10 fields, rest-series array) vs source_fenix5/SettingsView.mc (3 items).",
              "id": "pp-feature-1",
              "severity": "low",
              "suggestedRemediation": "Extend SettingsView/SettingsEditDelegate to expose the remaining persisted keys (breathing series, static times, recovery defaults)."
            },
            {
              "category": "documentation",
              "description": "README.md still leads with the v1 fenix3 build instructions before introducing the v2 fenix5 build, and the disclaimer section was written for a single-watch hobby project but the v2 app now ships for the whole fenix5 family. Sideload instructions do not list per-variant filenames.",
              "discoveredVia": "README.md line 105 'fenix 5 v2 build' is appended after the v1 sideload walkthrough.",
              "id": "pp-docs-1",
              "severity": "low",
              "suggestedRemediation": "Reorganise README to lead with the active v2 fenix5 build, document per-variant .prg filenames for sideload, and refresh the disclaimer for the fenix5-family target."
            }
          ],
          "processes": [
            {
              "description": "Run build.sh to compile source/ for fenix3 and fenix3_hr using monkeyc.",
              "id": "process-build-fenix3",
              "name": "Build v1 fenix3 artifacts"
            },
            {
              "description": "Run build_fenix5.sh to compile source_fenix5/ for each BUILD_VARIANTS device (default fenix5plus) using monkeyc.",
              "id": "process-build-fenix5plus",
              "name": "Build v2 fenix5plus artifacts"
            },
            {
              "description": "Copy the compiled .prg into the watch's GARMIN/APPS/ folder over USB mass storage and launch from Activities > Apps.",
              "id": "process-sideload",
              "name": "Sideload .prg to watch"
            }
          ],
          "projectName": "Garmin Freedive Watch App",
          "repositories": [
            {
              "id": "repo-root",
              "name": "garmin-freedive-app",
              "path": "/mnt/flash1/code/garmin-freedive-app",
              "sourceTrees": [
                {
                  "appId": "b896271ba7e04e12988fd03fb8714fc3",
                  "entry": "BreathHoldApp",
                  "id": "source-tree-v1",
                  "jungle": "monkey.jungle",
                  "manifest": "manifest.xml",
                  "minApiLevel": "1.4.0",
                  "path": "source/",
                  "target": "fenix3 / fenix3_hr"
                },
                {
                  "appId": "b896271ba7e04e12988fd03fb8714fc4",
                  "entry": "Fenix5App",
                  "id": "source-tree-v2",
                  "jungle": "monkey_fenix5.jungle",
                  "manifest": "manifest_fenix5.xml",
                  "minSdkVersion": "2.4.0",
                  "path": "source_fenix5/",
                  "target": "fenix5plus (configurable to fenix5/5s/5x/5splus/5xplus via BUILD_VARIANTS)"
                }
              ],
              "vcs": "none (no .git directory present; git rev-parse reports 'not a git repository')"
            }
          ],
          "services": [],
          "team": [
            {
              "name": "Project Owner",
              "responsibilities": [
                "Owns both source/ and source_fenix5/ codebases",
                "Authors all design and implementation documentation (README.md, APP_DESIGN_V2.md, IMPLEMENTATION_PLAN.md, PORT_FENIX5.md)",
                "Maintains build tooling (build.sh, build_fenix5.sh, .gitignore)",
                "Defines the FIT developer field-id schema (APP_DESIGN_V2.md §9)",
                "Sideloads .prg artifacts to a personal Garmin device for verification"
              ],
              "role": "sole maintainer"
            }
          ],
          "techStack": {
            "buildTools": [
              "monkeyc (Connect IQ compiler)",
              "monkeydo (simulator, mentioned in README)",
              "Connect IQ SDK Manager (GUI / X11 required)",
              "OpenSSL",
              "Java 11+",
              "bash"
            ],
            "databases": [
              {
                "evidence": "Application.getApp().getProperty / setProperty in source/Settings.mc and source_fenix5/AppSettings.mc",
                "name": "Connect IQ Application Object Store",
                "role": "user settings persistence",
                "type": "embedded key-value"
              },
              {
                "evidence": "session.createSession + session.createField in BreathHoldView, DepthView, DistanceView, StaticView, BreathingView",
                "name": "FIT activity files",
                "role": "session analytics output for Garmin Connect upload",
                "type": "FIT (Garmin)"
              }
            ],
            "frameworks": [
              {
                "category": "watch-app-framework",
                "evidence": "using Toybox.{Application,WatchUi,Graphics,System,Lang,Timer,Sensor,ActivityRecording,FitContributor,Activity} across 28 .mc files",
                "name": "Garmin Connect IQ SDK (Toybox)",
                "role": "Application / WatchUi / Sensor / ActivityRecording / FitContributor runtime",
                "version": "1.4.0 (fenix3) / 2.4.0+ (fenix5)"
              },
              {
                "category": "build-manifest",
                "evidence": "monkey.jungle, monkey_fenix5.jungle",
                "name": "Connect IQ Jungle build system",
                "role": "Project description format read by monkeyc"
              },
              {
                "category": "signing",
                "evidence": "openssl genrsa / pkcs8 commands in build.sh and build_fenix5.sh",
                "name": "OpenSSL",
                "role": "Self-signed developer key generation (.pem / .der)"
              },
              {
                "category": "runtime-dependency",
                "evidence": "build scripts assert java -version 2>&1 | head -1",
                "name": "Java 11+",
                "role": "Required by the Connect IQ SDK Manager / monkeyc compiler"
              }
            ],
            "infrastructure": [
              {
                "category": "distribution",
                "name": "Local USB sideload",
                "role": "Copy .prg files into watch's GARMIN/APPS/ over USB mass storage"
              }
            ],
            "languages": [
              {
                "evidence": "28 .mc files; ~2,714 LOC",
                "name": "Monkey C",
                "role": "primary",
                "version": "Connect IQ API 1.4.0 (fenix3) / 2.4.0+ (fenix5)"
              },
              {
                "evidence": "build.sh, build_fenix5.sh",
                "name": "Bash",
                "role": "build-scripting"
              },
              {
                "evidence": "manifest.xml, manifest_fenix5.xml, resources/resources.xml",
                "name": "XML",
                "role": "manifest-and-resources"
              },
              {
                "evidence": "README.md, APP_DESIGN_V2.md, IMPLEMENTATION_PLAN.md, PORT_FENIX5.md",
                "name": "Markdown",
                "role": "documentation"
              }
            ],
            "packageManagers": []
          },
          "tools": {
            "build": [
              "monkeyc (Connect IQ compiler)",
              "monkeydo (Connect IQ simulator runner)",
              "bash (build.sh, build_fenix5.sh)",
              "OpenSSL (developer key generation)"
            ],
            "formatting": [],
            "ide": [
              "VS Code + Garmin Monkey C extension (recommended)",
              "Eclipse + Monkey C plugin (alternate)"
            ],
            "linting": [],
            "testing": []
          },
          "updatedAt": "2026-07-27T06:02:27.000Z",
          "version": 1,
          "workflows": [
            {
              "description": "Local bash script that invokes the Connect IQ SDK's monkeyc compiler to produce .prg files for the Garmin fenix3 and fenix3_hr targets and generates a self-signed developer key if missing.",

[Showing lines 1-736 of 2479 (50.0KB limit). Use offset=737 to continue.]


I have the task.json with all the context. Let me read the rest to get the workflows and other relevant info.