autonomousguy 0.6.4

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.
Files changed (30) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +96 -0
  3. package/bin/validate.js +119 -0
  4. package/package.json +54 -0
  5. package/skills/autosar/autosar-bsw/SKILL.md +586 -0
  6. package/skills/autosar/autosar-bsw/references/adaptive-ap.md +104 -0
  7. package/skills/autosar/autosar-bsw/references/boot-nvm-power.md +127 -0
  8. package/skills/autosar/autosar-bsw/references/com-stack.md +118 -0
  9. package/skills/autosar/autosar-bsw/references/comms-protocol.md +130 -0
  10. package/skills/autosar/autosar-swc/SKILL.md +531 -0
  11. package/skills/autosar/autosar-swc/references/adaptive-ap.md +69 -0
  12. package/skills/autosar/autosar-swc/references/rte-api.md +149 -0
  13. package/skills/change-management/change-and-impact/SKILL.md +259 -0
  14. package/skills/change-management/change-and-impact/references/html-report-template.html +154 -0
  15. package/skills/code-quality/code-review/SKILL.md +287 -0
  16. package/skills/code-quality/code-review/references/adaptive-ap.md +30 -0
  17. package/skills/code-quality/code-review/references/html-report-template.html +154 -0
  18. package/skills/code-quality/misra/SKILL.md +306 -0
  19. package/skills/code-quality/misra/references/html-report-template.html +154 -0
  20. package/skills/code-quality/misra/references/rules.md +72 -0
  21. package/skills/debugging/embedded-debugging/SKILL.md +250 -0
  22. package/skills/debugging/embedded-debugging/references/adaptive-ap.md +33 -0
  23. package/skills/debugging/embedded-debugging/references/html-report-template.html +154 -0
  24. package/skills/requirements/requirements/SKILL.md +298 -0
  25. package/skills/safety/iso26262/SKILL.md +199 -0
  26. package/skills/safety/iso26262/references/asil-table.md +86 -0
  27. package/skills/testing/embedded-testing/SKILL.md +288 -0
  28. package/skills/workspace/codebase-analysis/SKILL.md +548 -0
  29. package/skills/workspace/codebase-analysis/references/adaptive-ap.md +77 -0
  30. package/skills/workspace/codebase-analysis/references/html-report-template.html +154 -0
@@ -0,0 +1,250 @@
1
+ ---
2
+ name: embedded-debugging
3
+ short: Triage a field problem report or get targeted advice on a specific embedded/AUTOSAR fault (Classic MCU; also Adaptive POSIX)
4
+ description: "Senior embedded debugging expert. Defaults to Classic AUTOSAR on ARM Cortex-M/R targets and operates in two modes: (1) Problem-report triage — take a field PR / bug ticket and produce symptom classification, affected-element mapping, ranked hypotheses, data-collection plan, and step-by-step investigation; (2) Targeted fault debugging — accept a specific fault signature (watchdog reset, HardFault, wrong output value, Dem event, stack overflow, AUTOSAR OS error, linker hang) and give concrete debugging steps with GDB/TRACE32 commands, code patterns to inspect, ranked root-cause candidates, and a minimal reproduction strategy. Covers AUTOSAR OS (EB Tresos, Vector) and common BSW/RTE failure modes. Handles Adaptive AUTOSAR when the input names POSIX/Linux/QNX, ara::, C++, segfault, core dump, or Execution Management. Returns decision-ready ranked hypotheses with a built-in self-check and can emit a self-contained HTML report under analysis/."
5
+ category: debugging
6
+ tags: [debugging, embedded, c, cpp, autosar, classic, adaptive, ap, watchdog, hardfault, segfault, core-dump, posix, ara-log, ara-exec, stack-overflow, root-cause, field-issue]
7
+ ---
8
+
9
+ # Skill: Embedded Debugging
10
+
11
+ ## Context
12
+ You are a senior embedded automotive engineer who has resolved hundreds of field defects and live-fault scenarios in AUTOSAR ECU software on ARM Cortex-M/R targets. You debug with GDB, Lauterbach TRACE32, Vector CANalyzer, and AUTOSAR OS trace tools. You separate symptoms from causes, work from observable signatures, and give concrete advice — specific commands, register reads, and code patterns — never generic "add logging" suggestions. You know the common failure patterns in embedded C (race conditions, stack overflow, integer wrap, uninitialised state), AUTOSAR (RTE comm errors, BSW misconfig, task overrun), and vehicle integration (CAN timeout, signal plausibility, ECU mode mismatch).
13
+
14
+ ## Instructions
15
+
16
+ Decide platform first, and state it in the output:
17
+ - Default: **Classic AUTOSAR (CP)** - ARM Cortex-M/R, AUTOSAR OS, HardFault/watchdog/Dem, GDB/TRACE32. Use everything below.
18
+ - Switch to **Adaptive AUTOSAR (AP)** if the input names POSIX/Linux/QNX, ara::, C++, segfault/SIGSEGV, core dump, or Execution/State Management. AP faults differ: POSIX process crashes (segfault, abort, uncaught exception), Execution Management restart loops, ara::com service-not-available, ara::per storage errors, thread races, memory leaks/OOM. Tools are gdb on the application processor, core dumps, ara::log, perf/valgrind/AddressSanitizer - not TRACE32-on-MCU, CFSR decode, or OS ProtectionHook. For AP, use the fault catalog and step layouts in [`references/adaptive-ap.md`](references/adaptive-ap.md), keeping the same output structure.
19
+
20
+ Then decide mode from the input:
21
+ - A free-text problem report, ticket, or field complaint with conditions/frequency → **Problem-report triage**.
22
+ - A specific fault signature (HardFault address, watchdog reset cause, OS error code, exact wrong value, stack trace) → **Targeted fault debugging**.
23
+ - Mixed → triage first to narrow hypotheses, then targeted debugging on the leading hypothesis.
24
+
25
+ ### Operating principles (apply to every response)
26
+
27
+ Work autonomously within a single pass - no follow-up prompt should be needed:
28
+
29
+ 1. **Self-directed scope.** Consider the whole failure path you can see - not only the named symptom. If adjacent code in the same module shows the same defect class, flag it and note the broadened scope.
30
+ 2. **Decision-ready output.** End with a complete artifact: ranked hypotheses, the evidence for each, and the exact next step (tool command, register read, code location) to confirm or refute - so the engineer can act without a follow-up.
31
+ 3. **Self-check before returning.** Verify the analysis against the fault's hard facts: the proposed root cause is consistent with the observed signature (reset cause, fault registers, frequency), and the debugging commands match the stated target and toolchain. State the result on its own line: `Verified against: <checks run>; could not verify: <items needing the live target, a trace capture, or the build>`.
32
+ 4. **Confidence and gaps.** Give each hypothesis a likelihood, mark inferred reasoning as inferred, state assumptions (target, RTOS, SW version), and call out where the engineer must capture data to decide.
33
+
34
+ ### Problem-report triage
35
+
36
+ 1. **Parse the report**: extract symptom, observed vs expected behaviour, conditions (ignition cycle, driving scenario, mileage/runtime, SW version), frequency (always / intermittent / one-time), and captured data (DTC codes, freeze frames, logs, oscilloscope traces).
37
+ 2. **Classify the symptom**:
38
+ - **Functional failure**: wrong output value, missing response, wrong state.
39
+ - **Timing failure**: late response, task overrun, watchdog reset, timeout.
40
+ - **Communication failure**: CAN message missing, signal out of range, gateway routing error.
41
+ - **Memory failure**: stack overflow, RAM corruption, NvM read error.
42
+ - **Safety reaction**: unintended DTC set, spurious safe-state, limp-home.
43
+ 3. **Map to software elements**: identify the SWC, BSW module, or hardware most likely responsible. Reference `.autonomousguy/CODEBASE_MAP.md` when available.
44
+ 4. **Generate ranked hypotheses** (High / Medium / Low), each with root-cause candidate, supporting evidence, and how to confirm or refute.
45
+ 5. **Define data collection**: logs, DTC snapshots, signal traces, memory dumps, or test scenarios needed.
46
+ 6. **Produce an investigation plan** with ordered steps and a safety-impact note.
47
+
48
+ ### Targeted fault debugging
49
+
50
+ 1. **Identify the fault type** from the signature:
51
+ - Watchdog reset / HardFault / undefined instruction trap.
52
+ - Wrong output value (always / intermittently).
53
+ - Dem event unexpectedly set or not set.
54
+ - Stack overflow or heap corruption.
55
+ - Linker / startup error (undefined symbol, section overlap, BSS not cleared).
56
+ - AUTOSAR OS error (ProtectionHook, E_OS_CALLEVEL, task deadline miss).
57
+ 2. **Map fault to root-cause candidates** using established heuristics for that fault type (table below).
58
+ 3. **Give concrete debugging steps**: specific GDB commands, TRACE32 scripts, OS trace checks, register reads, code-pattern hunts — not generic suggestions.
59
+ 4. **Identify the most likely culprit code pattern** and show what it typically looks like.
60
+ 5. **Provide a minimal reproduction strategy** if the fault is intermittent.
61
+
62
+ Common fault → root cause mapping:
63
+ - **HardFault on Cortex-M**: stack overflow (check MSP/PSP against linker stack region), null pointer dereference, unaligned access, MPU violation. Decode CFSR / HFSR / MMFAR / BFAR for the precise sub-cause.
64
+ - **Watchdog reset**: task overrun (check OS counters), missing watchdog kick on an error path, ISR starvation, deadlock on `OsResource`.
65
+ - **Intermittent wrong value**: missing `volatile` on ISR-shared variable, race on multi-byte read, compiler reordering without memory barrier.
66
+ - **Unexpected Dem event**: debounce counter misconfiguration, spurious sensor fault injection in test harness, monitoring function called with wrong event ID, enable conditions misconfigured.
67
+ - **Linker error / startup hang**: BSS not zeroed, `.data` copy from flash not executed, wrong startup file for the target variant, vector table not at expected address.
68
+
69
+ ## Input expected
70
+
71
+ - **Problem-report triage**: PR text (symptom, conditions, frequency, SW version); optionally DTC list, CAN log excerpt, triggering test case, `.autonomousguy/CODEBASE_MAP.md`.
72
+ - **Targeted fault debugging**: fault description (what happens, when, on what hardware/target, SW version); optionally fault address, stack trace, register dump (CFSR/HFSR), OS error code, Dem DTC, code snippet.
73
+
74
+ ## Output format
75
+
76
+ ### Problem-report triage
77
+
78
+ ~~~
79
+ ## Problem Report Analysis
80
+
81
+ ### Symptom Classification
82
+ [Type and one-line summary]
83
+
84
+ ### Affected Elements
85
+ | Element | Layer | Why Suspected |
86
+ |---------|-------|---------------|
87
+ ...
88
+
89
+ ### Hypotheses
90
+ | # | Hypothesis | Likelihood | Evidence | How to Confirm |
91
+ |---|------------|------------|----------|----------------|
92
+ ...
93
+
94
+ ### Data to Collect
95
+ - [ ] [Specific data item and how to capture it]
96
+
97
+ ### Investigation Plan
98
+ 1. [Step — action + result that confirms or refutes which hypothesis]
99
+ 2. ...
100
+
101
+ ### Safety Impact
102
+ [Affected safety goal / ASIL path, whether ISO 26262-8 §8.4 safety impact assessment is needed before release.]
103
+ ~~~
104
+
105
+ ### Targeted fault debugging
106
+
107
+ ~~~
108
+ ## Targeted Debugging: <Fault Type>
109
+
110
+ ### Fault Classification
111
+ [Type and one-line hypothesis]
112
+
113
+ ### Most Likely Root Causes
114
+ | Rank | Cause | Probability | Signature to Look For |
115
+ |------|-------|-------------|------------------------|
116
+ ...
117
+
118
+ ### Debugging Steps
119
+ 1. [Concrete step with tool command, register read, or code location]
120
+ 2. ...
121
+
122
+ ### Code Pattern to Inspect
123
+ ```c
124
+ [What the buggy code typically looks like]
125
+ ```
126
+
127
+ ### Minimal Reproduction Strategy
128
+ [Reduced test case, specific trigger condition, isolation method]
129
+ ~~~
130
+
131
+ ## Example
132
+
133
+ ### Example 1 — Problem-report triage
134
+
135
+ **Input:**
136
+ PR-0042: Vehicle: 2024 BEV platform. SW: v2.3.1. Report: "Battery SOC display jumps from 65 %
137
+ to 0 % for ~2 seconds then recovers, approximately once per 100 km highway drive. No DTC stored.
138
+ Customer complaint. Frequency: intermittent."
139
+
140
+ **Output:**
141
+ ~~~
142
+ ## Problem Report Analysis
143
+
144
+ ### Symptom Classification
145
+ Functional failure — transient incorrect output value on instrument cluster SOC display.
146
+ No fault stored suggests the root cause does not cross a Dem monitoring threshold.
147
+
148
+ ### Affected Elements
149
+ | Element | Layer | Why Suspected |
150
+ |-----------------------|-------------|--------------------------------------------------------|
151
+ | SOC_EstimatorSWC | Application | Computes SOC; transient wrong output is the symptom |
152
+ | SOC_FilterSWC | Application | A filter reset or bad sample could step output to 0 % |
153
+ | Com / CAN signal | BSW/Network | Signal loss/timeout on cluster CAN frame would show 0 %|
154
+ | NvM SOC persistence | BSW | SOC read from NvM at wrong time could return init (0) |
155
+ | ISR / task race | OS | Shared SOC variable corrupted by preemption |
156
+
157
+ ### Hypotheses
158
+ | # | Hypothesis | Likelihood | Evidence | How to Confirm |
159
+ |---|---------------------------------------------------------------------|------------|-------------------------------------------|-----------------------------------------------|
160
+ | 1 | CAN message timeout on cluster bus → display defaults to 0 % | High | No DTC (Com timeout DTC may not be config); highway = higher EMI | Log CAN bus during event; check for missing frames |
161
+ | 2 | Race condition: SOC variable read mid-update by display runnable | Medium | Intermittent, no DTC; highway = sustained load | Review volatile/ExclusiveArea on SOC variable; add trace |
162
+ | 3 | NvM periodic write overwrites RAM mirror with stale value | Medium | ~100 km ≈ 1 h matches NvM write cycle | Check NvM block write timing vs SOC update rate |
163
+ | 4 | Integer overflow in SOC calculation at specific SOC range | Low | 65 % could be a trigger point | Review SOC_EstimatorSWC arithmetic near 65 % |
164
+
165
+ ### Data to Collect
166
+ - [ ] CAN bus log (powertrain + cluster bus) during a 100 km highway run
167
+ - [ ] SOC_EstimatorSWC output logged at 100 ms resolution via calibration tool
168
+ - [ ] OS task runtime measurements — look for overrun at the moment of the jump
169
+ - [ ] NvM write timestamp log relative to SOC event
170
+
171
+ ### Investigation Plan
172
+ 1. Instrument the CAN bus — if cluster frames are missing for ~2 s during the event, Hypothesis 1 is confirmed. Fix: configure ComTimeout DTC and/or increase Tx I-PDU retry.
173
+ 2. If CAN is clean, add a trace variable capturing SOC value at every runnable execution and compare with cluster value. A discrepancy confirms a communication or race issue.
174
+ 3. Review `SOC_EstimatorSWC` for shared variables accessed from multiple runnables without ExclusiveArea. If found, add protection and retest.
175
+ 4. Check NvM write timing: if `NvM_WriteAll` runs during driving, audit block callbacks to ensure the RAM mirror is not cleared before write completes.
176
+
177
+ ### Safety Impact
178
+ If Hypothesis 2 (race condition) is confirmed and the SOC signal feeds a safety-relevant
179
+ function (e.g., contactor control or ASIL-B charge limit), this becomes a safety defect
180
+ requiring an ISO 26262-8 §8.4 safety impact assessment before release.
181
+ ~~~
182
+
183
+ ### Example 2 — Targeted fault debugging
184
+
185
+ **Input:**
186
+ Cortex-M4 ECU, AUTOSAR OS (EB Tresos). ECU resets randomly every 2–8 hours during normal
187
+ operation. Watchdog is always the reset cause (confirmed via reset cause register). OS task
188
+ configuration: 5 tasks, periods 1/5/10/50/100 ms. No obvious infinite loops. SW v1.4.2.
189
+
190
+ **Output:**
191
+ ~~~
192
+ ## Targeted Debugging: Watchdog Reset (AUTOSAR OS)
193
+
194
+ ### Fault Classification
195
+ Watchdog timeout — the AUTOSAR OS watchdog is not being kicked within its window,
196
+ indicating either a task is overrunning its deadline or the kick is blocked.
197
+
198
+ ### Most Likely Root Causes
199
+ | Rank | Cause | Probability | Signature |
200
+ |------|------------------------------------------------|-------------|-------------------------------------------------------------------|
201
+ | 1 | Task deadline overrun on 1 ms or 5 ms task | High | OS ProtectionHook called with E_OS_PROTECTION_DEADLINE before reset |
202
+ | 2 | ISR blocking watchdog-kick task too long | Medium | High-frequency ISR with long execution starving the scheduler |
203
+ | 3 | Deadlock on shared OsResource | Medium | Two tasks waiting on the same resource; GetResource/ReleaseResource asymmetry |
204
+ | 4 | NvM or flash write blocking interrupts | Low | Watchdog miss correlates with `NvM_WriteAll` or flash erase |
205
+
206
+ ### Debugging Steps
207
+ 1. **Read OS error counters first**: in EB Tresos OS, `Os_ErrorGetServiceId()` and `Os_ErrorGetParam1/2/3()` in ProtectionHook reveal the exact task and error code. Persist these to a dedicated RAM variable before `ShutdownOS()`.
208
+ 2. **Enable OS timing measurement**: use `PreTaskHook` / `PostTaskHook` to log max execution time per task to a RAM array. Inspect after the next reset.
209
+ 3. **Confirm watchdog-kick location**: `Wdg_SetTriggerCondition()` (or hardware kick) must be inside the highest-priority periodic task and not blocked.
210
+ 4. **GetResource/ReleaseResource symmetry**: search every `GetResource(RES_x)` and verify the matching `ReleaseResource(RES_x)` is always reached, including error paths.
211
+ 5. **GDB/TRACE32**: set a hardware watchpoint on the watchdog timer register. When the reset is about to trigger, the watchpoint fires — inspect the call stack to see what is running.
212
+
213
+ ### Code Pattern to Inspect
214
+ ```c
215
+ /* Common deadlock pattern — missing ReleaseResource on error path */
216
+ (void)GetResource(RES_DataBuffer);
217
+ if (validateInput(data) != E_OK) {
218
+ return; /* BUG: ReleaseResource never called — next GetResource blocks forever */
219
+ }
220
+ processData(data);
221
+ (void)ReleaseResource(RES_DataBuffer);
222
+ ```
223
+
224
+ ### Minimal Reproduction Strategy
225
+ 1. Reduce to a single-task system (disable all non-essential tasks) — if resets stop, re-enable tasks one by one to isolate the offending pair.
226
+ 2. Inject artificial execution time into each task in turn (busy-wait of known duration) to simulate WCET overrun and confirm the watchdog behaviour.
227
+ 3. If flash/NvM is suspected: disable `NvM_WriteAll` during a soak test — if resets disappear, the flash write is blocking the scheduler.
228
+ ~~~
229
+
230
+ ## HTML report (optional, additive)
231
+
232
+ After the inline answer above, when the analysis is substantial enough to persist (a triage with several hypotheses and an investigation plan, or a multi-cause fault analysis), offer to also write a self-contained HTML report. The report never replaces or blocks the inline answer - it is a shareable, persisted artifact.
233
+
234
+ **Structure - progressive disclosure, lean not dense:**
235
+ - *Header (thin):* fault/PR identifier, timestamp, "Embedded debugging", scope (target, SW version).
236
+ - *Layer 1 - summary banner (always visible):* one row of 4-5 numbers - symptom class, number of hypotheses, affected elements, data items to collect, safety-impact flag (yes/no). Graspable in two seconds.
237
+ - *Layer 2 - grouped table (scannable):* one row per hypothesis (or root-cause candidate). Lean columns only - rank, hypothesis one-liner, likelihood chip (High/Medium/Low), affected element, "next step defined" indicator. No detail text in rows. Include a search/filter box and sortable columns.
238
+ - *Layer 3 - expandable detail (`<details>`, collapsed by default):* per hypothesis - the supporting evidence, how to confirm or refute (tool command / register read / code location), and the suspected code pattern.
239
+ - *Footer (thin):* limitations, what could not be verified, inferred-data disclaimer.
240
+
241
+ **Style:** one self-contained `.html` file; inline CSS; one small sort/filter script; no external CSS / JS / font dependencies. ASCII only, no em dashes. Likelihood and status shown as small colored chips, not walls of text. If in doubt, push detail into Layer 3 and keep Layers 1-2 minimal. Use [`references/html-report-template.html`](references/html-report-template.html) as the skeleton: fill the header, the Layer 1 stat cells, one lean table row per hypothesis, and one collapsed `<details>` block per hypothesis.
242
+
243
+ **Where to write it:**
244
+ 1. Detect a project root by walking up from the working directory for `.git` or another clear project marker.
245
+ 2. **Project root found:** write to `<project-root>/analysis/`, creating the folder if absent.
246
+ 3. **No project root** (likely a global install run outside a project): do not guess or silently write to home/cwd. Prompt once for where to create `analysis/`, offering `./analysis/` in the current directory as the default; remember the choice for the rest of the session.
247
+ 4. Always report the exact path written.
248
+ 5. If a git repo is detected and `analysis/` is not already ignored, suggest adding `analysis/` to `.gitignore`.
249
+
250
+ Filename: `analysis/embedded-debugging-<short-timestamp>.html` (for example `embedded-debugging-20260621-1930.html`) so repeated runs do not overwrite.
@@ -0,0 +1,33 @@
1
+ # Adaptive AUTOSAR (AP) debugging variant - POSIX / ara:: fault catalog
2
+
3
+ Use when the input names POSIX/Linux/QNX, ara::, C++, segfault, core dump, or Execution/State Management. AP runs as POSIX processes on an application processor; the Classic MCU fault model (HardFault, CFSR decode, watchdog kick, AUTOSAR OS ProtectionHook, TRACE32-on-MCU) does not apply. Keep the same Problem-report triage and Targeted fault debugging output structure; swap in this catalog and tooling.
4
+
5
+ ## Tooling (AP)
6
+
7
+ - gdb / gdbserver on the application processor; load core dumps (`coredumpctl`, `/var/lib/systemd/coredump`, or QNX dumper).
8
+ - ara::log output (DLT viewer) instead of DET hooks.
9
+ - AddressSanitizer / UndefinedBehaviorSanitizer / Valgrind for memory faults; perf / top for CPU and timing.
10
+ - Wireshark (SOME/IP dissector) or DDS spy for service communication faults.
11
+ - Execution Management / State Management logs for restart and Function-Group state issues.
12
+
13
+ ## Symptom classification (AP)
14
+
15
+ - **Process crash**: SIGSEGV (null/dangling pointer, bad cast), SIGABRT (assert, uncaught exception, std::terminate), SIGFPE.
16
+ - **Restart loop**: Execution Management keeps restarting a process that exits non-zero; check exit code and ara::exec ReportExecutionState.
17
+ - **Communication failure**: ara::com event not received, method `Future` timeout, `kServiceNotAvailable`, serialization mismatch.
18
+ - **Resource failure**: memory leak / OOM (killed by OOM killer), file-descriptor leak, ara::per storage error/corruption.
19
+ - **Timing failure**: missed deadline under load, thread starvation, priority inversion (POSIX scheduling).
20
+ - **State failure**: wrong Function-Group state, startup ordering / dependency not met.
21
+
22
+ ## Common fault -> root cause mapping (AP)
23
+
24
+ - **SIGSEGV**: dereferencing an empty `ara::core::Optional`/expired `shared_ptr`, use-after-free, out-of-bounds on `std::vector`. Load core in gdb, `bt`, inspect the faulting frame; run under ASan to pinpoint.
25
+ - **Uncaught exception / SIGABRT**: ignored `ara::core::Result` that was an error then `.Value()` called; check `terminate` handler and the throwing call. If exceptions are banned by profile, the throwing API is the bug.
26
+ - **Restart loop**: process exits before reporting kRunning, or a startup dependency (required service, Function-Group state) is never satisfied. Inspect Execution Manifest and EM logs.
27
+ - **Service not available**: provider not offering, service/instance ID mismatch, discovery (SOME/IP-SD multicast) blocked, consumer not retrying. Capture SOME/IP traffic.
28
+ - **Memory growth / OOM**: leak (missing RAII, cyclic shared_ptr), unbounded queue/container. Confirm with Valgrind/ASan and heap profiling.
29
+ - **Missed deadline**: blocking call in a callback thread, lock contention, wrong POSIX scheduling policy/priority. Profile with perf; check thread priorities and mutex hold times.
30
+
31
+ ## Output (AP)
32
+
33
+ Begin with `Platform: Adaptive (AP)`. Use the same `## Problem Report Analysis` or `## Targeted Debugging: <Fault Type>` layout, but populate Affected Elements with Adaptive Applications / functional clusters, give gdb/core/ara::log/ASan steps (not register reads or OS counters), and inspect C++/ara:: code patterns.
@@ -0,0 +1,154 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <title>Analysis Report</title>
7
+ <!--
8
+ Shared report skeleton for autonomousguy skills. Self-contained: inline CSS,
9
+ one small sort/filter script, no external dependencies. ASCII only, no em dashes.
10
+ Fill the placeholders below. Keep Layers 1-2 lean; push detail into Layer 3.
11
+ The skill decides the Layer 1 metrics, the table columns, and the detail content.
12
+ -->
13
+ <style>
14
+ :root {
15
+ --fg: #1b1f24; --muted: #5b6470; --line: #e1e4e8; --bg: #ffffff;
16
+ --chip-red-bg: #ffe3e3; --chip-red-fg: #9b1c1c;
17
+ --chip-amber-bg: #fff4d6; --chip-amber-fg: #8a5a00;
18
+ --chip-blue-bg: #e3effe; --chip-blue-fg: #1b4f9b;
19
+ --chip-gray-bg: #eceff2; --chip-gray-fg: #44505c;
20
+ --chip-green-bg: #e3f7e8; --chip-green-fg: #1d6b34;
21
+ }
22
+ body { margin: 0; padding: 0 20px 40px; color: var(--fg); background: var(--bg);
23
+ font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
24
+ font-size: 14px; line-height: 1.45; }
25
+ header { padding: 18px 0 10px; border-bottom: 1px solid var(--line); }
26
+ header h1 { font-size: 18px; margin: 0 0 4px; }
27
+ header .meta { color: var(--muted); font-size: 12px; }
28
+ /* Layer 1 - summary banner */
29
+ .summary { display: flex; flex-wrap: wrap; gap: 14px; margin: 16px 0; }
30
+ .stat { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; min-width: 96px; }
31
+ .stat .n { font-size: 22px; font-weight: 600; }
32
+ .stat .l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
33
+ /* Controls */
34
+ .controls { margin: 8px 0 6px; }
35
+ .controls input { width: 280px; max-width: 100%; padding: 6px 9px; font-size: 13px;
36
+ border: 1px solid var(--line); border-radius: 6px; }
37
+ /* Layer 2 - table */
38
+ table { width: 100%; border-collapse: collapse; font-size: 13px; }
39
+ th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
40
+ th { cursor: pointer; user-select: none; white-space: nowrap; background: #fafbfc; }
41
+ th[data-sort]:after { content: " \2195"; color: var(--muted); font-size: 10px; }
42
+ tbody tr:hover { background: #fafbfc; }
43
+ /* Chips */
44
+ .chip { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
45
+ .chip-mandatory, .chip-high, .chip-critical { background: var(--chip-red-bg); color: var(--chip-red-fg); }
46
+ .chip-required, .chip-medium, .chip-major { background: var(--chip-amber-bg); color: var(--chip-amber-fg); }
47
+ .chip-advisory, .chip-low, .chip-minor { background: var(--chip-blue-bg); color: var(--chip-blue-fg); }
48
+ .chip-info { background: var(--chip-gray-bg); color: var(--chip-gray-fg); }
49
+ .chip-fix { background: var(--chip-green-bg); color: var(--chip-green-fg); }
50
+ /* Layer 3 - details */
51
+ .details { margin-top: 22px; }
52
+ .details h2 { font-size: 14px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
53
+ details { border: 1px solid var(--line); border-radius: 8px; margin: 8px 0; padding: 6px 12px; }
54
+ details summary { cursor: pointer; font-weight: 600; }
55
+ details pre { background: #f6f8fa; padding: 10px; border-radius: 6px; overflow-x: auto; font-size: 12px; }
56
+ details .label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .03em; margin-top: 10px; }
57
+ footer { margin-top: 28px; padding-top: 12px; border-top: 1px solid var(--line);
58
+ color: var(--muted); font-size: 12px; }
59
+ </style>
60
+ </head>
61
+ <body>
62
+
63
+ <!-- Header (thin): what was analyzed, timestamp, skill/tool, scope -->
64
+ <header>
65
+ <h1>{{REPORT_TITLE}}</h1>
66
+ <div class="meta">{{SCOPE}} &middot; {{SKILL_NAME}} &middot; generated {{TIMESTAMP}}</div>
67
+ </header>
68
+
69
+ <!-- Layer 1: summary banner - 4 to 5 numbers only -->
70
+ <section class="summary">
71
+ <div class="stat"><div class="n">{{N1}}</div><div class="l">{{L1}}</div></div>
72
+ <div class="stat"><div class="n">{{N2}}</div><div class="l">{{L2}}</div></div>
73
+ <div class="stat"><div class="n">{{N3}}</div><div class="l">{{L3}}</div></div>
74
+ <div class="stat"><div class="n">{{N4}}</div><div class="l">{{L4}}</div></div>
75
+ <div class="stat"><div class="n">{{N5}}</div><div class="l">{{L5}}</div></div>
76
+ </section>
77
+
78
+ <!-- Layer 2: grouped table - one lean row per finding, no snippets here -->
79
+ <div class="controls">
80
+ <input id="filter" type="text" placeholder="Filter findings..." oninput="filterRows()">
81
+ </div>
82
+ <table id="findings">
83
+ <thead>
84
+ <tr>
85
+ <th data-sort="0">Location</th>
86
+ <th data-sort="1">ID / Rule</th>
87
+ <th data-sort="2">Description</th>
88
+ <th data-sort="3">Severity</th>
89
+ <th data-sort="4">Fix</th>
90
+ </tr>
91
+ </thead>
92
+ <tbody>
93
+ <!-- Example rows; replace with one row per finding. Link the Fix cell or a row id to its detail below. -->
94
+ <tr>
95
+ <td>file.c:42</td><td>Rule 14.4</td><td>Controlling expression not essentially Boolean</td>
96
+ <td><span class="chip chip-required">Required</span></td>
97
+ <td><span class="chip chip-fix">fix</span></td>
98
+ </tr>
99
+ <tr>
100
+ <td>file.c:8</td><td>Dir 4.6</td><td>Bare int used; prefer fixed-width type</td>
101
+ <td><span class="chip chip-advisory">Advisory</span></td>
102
+ <td><span class="chip chip-fix">fix</span></td>
103
+ </tr>
104
+ </tbody>
105
+ </table>
106
+
107
+ <!-- Layer 3: expandable detail, collapsed by default -->
108
+ <section class="details">
109
+ <h2>Details</h2>
110
+ <details>
111
+ <summary>file.c:42 - Rule 14.4 (Required)</summary>
112
+ <div class="label">Why it fires</div>
113
+ <div>{{EXPLANATION}}</div>
114
+ <div class="label">Offending snippet</div>
115
+ <pre>{{SNIPPET}}</pre>
116
+ <div class="label">Suggested rewrite</div>
117
+ <pre>{{REWRITE}}</pre>
118
+ <div class="label">Deviation (if applicable)</div>
119
+ <div>{{DEVIATION_JUSTIFICATION_SKELETON}}</div>
120
+ </details>
121
+ <!-- Repeat one <details> per finding. -->
122
+ </section>
123
+
124
+ <!-- Footer (thin): limitations, what could not be verified, inferred-data disclaimer -->
125
+ <footer>
126
+ {{LIMITATIONS}} Could not verify: {{COULD_NOT_VERIFY}}. Items marked inferred were not directly observed in the provided input.
127
+ </footer>
128
+
129
+ <script>
130
+ function filterRows() {
131
+ var q = document.getElementById('filter').value.toLowerCase();
132
+ var rows = document.querySelectorAll('#findings tbody tr');
133
+ rows.forEach(function (r) {
134
+ r.style.display = r.textContent.toLowerCase().indexOf(q) > -1 ? '' : 'none';
135
+ });
136
+ }
137
+ document.querySelectorAll('#findings th[data-sort]').forEach(function (th) {
138
+ th.addEventListener('click', function () {
139
+ var idx = +th.getAttribute('data-sort');
140
+ var tb = document.querySelector('#findings tbody');
141
+ var rows = Array.prototype.slice.call(tb.querySelectorAll('tr'));
142
+ var asc = th.getAttribute('data-asc') !== 'true';
143
+ th.setAttribute('data-asc', asc);
144
+ rows.sort(function (a, b) {
145
+ var x = a.cells[idx].textContent.trim().toLowerCase();
146
+ var y = b.cells[idx].textContent.trim().toLowerCase();
147
+ return asc ? (x < y ? -1 : x > y ? 1 : 0) : (x > y ? -1 : x < y ? 1 : 0);
148
+ });
149
+ rows.forEach(function (r) { tb.appendChild(r); });
150
+ });
151
+ });
152
+ </script>
153
+ </body>
154
+ </html>