sensAI
AI-assisted code review for ARM and Andes AndeStar V5 firmware in VS Code.
繁體中文 · Install guide · Rule authoring · Privacy · Contributing
English
sensAI reviews firmware C and assembly files when you save them, provided the
file has actual changes relative to git HEAD. It combines
the file, relevant project headers, and rules written by your team, then shows
grounded findings in the sensAI side panel. It is designed to catch
project-specific issues that generic AI tools do not know about: DMA cache
maintenance, write-one-to-clear registers, ISR safety, ABI requirements, and
similar hardware conventions.
Highlights
- Reviews
.c, .h, .s, and .S files on save or on demand.
- Skips a save with no changes; an on-demand review always runs.
- Waits for a quiet period before sending, and coalesces saves that arrive
mid-review into one re-run on the latest content.
- Resolves project-local includes and injects ABI facts for assembly reviews.
- Uses natural-language rules maintained in version control.
- Requires source-grounded evidence and drops fabricated references.
- Keeps suggestions in a dedicated panel rather than asserting that AI output
is a compiler error.
- Manual mode: turn off review-on-save, then review a whole change set —
several functions across several files — in one request when you are done.
- Pin findings you want to keep. Pinned findings stay in a fixed section at the
top of the panel across reviews and restarts, each with a note box for your
own comments.
Quick start
Install sensAI from the VS Code Marketplace.
Start a Claude Code Router-compatible endpoint and configure it in your VS
Code user settings:
{
"sensai.endpoint": "http://127.0.0.1:3456",
"sensai.model": "claude-opus-5"
}
Open your firmware repository and run sensAI: Initialize Project from
the Command Palette. Commit .sensai/rules.yaml and .sensai/config.yaml
with the project, then replace the example rules with your team's rules.
Use sensAI: Review Current File for an on-demand review. Findings appear
in the sensAI side panel; status and diagnostics are available in the
sensAI Output channel.
Rules and privacy
Rules are deliberately not shipped with the extension. Keep them in
.sensai/rules.yaml for each project, or set sensai.rulesPath to a shared
private rules repository. The project-level .sensai/config.yaml keeps each
project's privacy policy separate from the shared rules.
Privacy notice: sensAI sends the reviewed source file and resolved
project headers to the endpoint you configure. Use privacy.never_send to
exclude confidential paths. If the source file or any included header
matches, the entire review is skipped.
Without applicable rules, sensAI limits its request to syntax and type errors.
See Rule authoring and Privacy before
enabling reviews on confidential firmware repositories.
Settings
| Setting |
Default |
Purpose |
sensai.enabled |
true |
Master switch. Off means nothing is sent at all: pending and in-flight reviews are cancelled, and Review Current File is refused too. The panel and pinned findings stay viewable. |
sensai.mode |
auto |
When to review while enabled. auto reviews on save. manual never reviews on save: when a change is done, press ▶ Review Changes (sensAI panel title bar or status bar) to send every C/assembly file changed relative to git HEAD in one request, so cross-file inconsistencies are visible. Switch between auto, manual and off from the mode button in the panel's title bar or status bar, or sensAI: Switch Mode. |
sensai.debounceMs |
1000 |
Quiet period after a save before the review is sent; 0 sends immediately. |
sensai.endpoint |
http://127.0.0.1:3456 |
Router endpoint. |
sensai.model |
claude-opus-5 |
Router model key. |
sensai.apiKey |
empty |
API key sent to the endpoint. Recent Claude Code Router builds require it. Store it in User Settings, not the project's .vscode/settings.json, so it is not committed or synced. Empty falls back to the ANTHROPIC_API_KEY environment variable. |
sensai.rulesPath |
empty |
A rules file; relative paths use the workspace root. |
sensai.includeDepth |
2 |
Recursive project-header depth. |
sensai.contextBudgetBytes |
120000 |
Header-context byte limit. |
sensai.requestTimeoutMs |
120000 |
Per-review timeout in milliseconds. |
sensai.maxFindings |
8 |
Finding cap; lower severities collapse first, error never collapses. |
sensai.reviewWholeFile |
false |
By default the review covers the changed lines plus the function they sit in. Enable to also review the whole file (catches issues outside the changed function, at the cost of a larger request). |
繁體中文
sensAI 是給 ARM 與 Andes AndeStar V5 韌體團隊使用的 VS Code AI code review
擴充。存檔且檔案相對 git HEAD 有改動時,它會帶入目前檔案、專案內引用的 header
與團隊規則,將有依據的意見顯示在 sensAI 側欄。它特別適合檢查通用工具不知道的專案知識,例如 DMA cache、
W1C 暫存器、ISR 安全性與組語 ABI。
快速開始
- 從 VS Code Marketplace 安裝 sensAI。
- 啟動相容的 Claude Code Router,並在 VS Code 使用者設定填入自己的
sensai.endpoint 與 sensai.model。
- 開啟韌體專案後,從 Command Palette 執行 sensAI: Initialize Project。
把
.sensai/rules.yaml 與 .sensai/config.yaml 提交到專案版本控制,再將範例
規則換成團隊真正的規則。
可用 sensAI: Review Current File 手動審查。結果顯示在 sensAI 側欄;狀態、
被濾除的意見與錯誤訊息位於 Output → sensAI。
規則與隱私
規則不會隨 extension 散布。每個專案可將規則放在 .sensai/rules.yaml,或以
sensai.rulesPath 指向部門共用的私有 rules repository;.sensai/config.yaml
則留在專案中,管理該專案的隱私政策。
隱私提醒: sensAI 會將受審檔案與解析到的專案 header 傳往你設定的 endpoint。
請用 privacy.never_send 排除機密路徑;受審檔案或任何附帶 header 命中時,整次
審查都會跳過。
沒有適用規則時,sensAI 只檢查語法與型別錯誤。啟用機密韌體專案前,請先閱讀
規則撰寫指南 與 隱私設定。
常用指令
| 指令 |
用途 |
sensAI: Review Current File |
手動觸發審查。 |
sensAI: Initialize Project |
建立 .sensai/ 專案設定骨架。 |
sensAI: Reload Rules |
重新載入規則。 |
sensAI: Export False Positive Report |
匯出本機誤報記錄。 |
sensAI: Clear Local Mutes |
清除本機靜音。 |
sensAI: Switch Mode |
切換自動/手動/關閉三種模式,也可點 sensAI 側欄標題列或狀態列右下的模式按鈕。 |
sensAI: Review Changes |
手動模式專用:把相對 HEAD 改過的檔案整組送審,同側欄標題列與狀態列的 ▶ 按鈕。 |
sensAI: Toggle On/Off |
暫時關閉/重新開啟 sensAI,重新開啟時回到原本的模式。關閉後不會送出任何審查,手動審查也一樣。 |
觸發時機
存檔會觸發審查的條件是存檔且該檔案相對 git HEAD 有改動。沒有改動的存檔
(改完又改回來、格式化沒動到東西、慣性按 Ctrl+S)不會送出任何內容,側欄維持
原狀,Output 會留一行記錄。
未追蹤的檔案或不在 git repo 裡的檔案無法判定改動範圍,這種情況照樣審整份
檔案 —— 「無法判定」不等於「沒有改動」。
sensAI: Review Current File 不受此限制,一律照審。
三種模式
| 模式 |
存檔時 |
▶ 審查改動 |
Review Current File |
| 自動(預設) |
審查 |
不顯示 |
可用 |
| 手動 |
不審查 |
整組送審 |
可用 |
| 關閉 |
不審查 |
不顯示 |
擋下 |
切換模式:點 sensAI 側欄標題列或狀態列右下的模式按鈕,或執行 sensAI: Switch Mode。
設定存在 sensai.enabled(總開關)與 sensai.mode(auto/manual)。
手動模式:審查一整組改動
存檔就審查時,一個改動如果要跨好幾個函式、好幾個檔案,存檔當下其他相關的地方
常常還沒改,審出來的是做到一半的狀態。手動模式下存檔不會審查;改完一組後按
▶ 審查改動:
- 有還沒存檔的 C/組語檔案時,先問要不要全部存檔。審查的是存檔後的內容。
- 列出工作區裡相對 git HEAD 改過的
.c、.h、.s、.S(含未追蹤的新檔案),
每個檔案附上增刪行數與審查範圍,全部預設勾選。可以取消勾選不相關的檔案。
- 命中
privacy.never_send 的檔案(本身命中,或它 include 的 header 命中)列在
清單下方標 🔒,不會送出,其他檔案照送。
- 改動超過 10 個檔案或約 300 KB 時,清單上會警告,但不會擋。
- 按 Enter 後,所選的檔案放在同一個請求送審,範圍是改動的行加上所在的函式,
模型看得到跨檔案的不一致,例如 header 改了簽名但呼叫端沒跟上。
- 結果依檔案分組顯示在側欄。跳行、釘選、標成誤報都會作用在意見所屬的檔案;
標成誤報只會把那則意見從畫面拿掉,不會重送整組。
自動模式的規則(去抖動、合併、連續存檔時降級)完全不變。
釘選意見
每則意見旁有一個「釘選」勾選框。釘住的意見會集中到側欄頂部的固定區,不會被
後續審查蓋掉,跨檔案顯示,也會跨 VS Code 重啟保留。每則釘選的意見都附一個文字
框,可以填自己的筆記/備註。釘選與筆記存在 workspace state,不進版控。
頻繁存檔
三層機制避免重複的請求一直被送出:
- 去抖動:存檔後等
sensai.debounceMs(預設 1000ms)沒有新的存檔才真的送出。
持續打字期間幾乎不會送出任何請求 —— 只審已經穩定下來的內容。設 0 可關閉。
- 合併:同一個檔案同時只跑一輪。這輪還在跑時進來的存檔併成一次補跑(不是
丟掉,也不是各跑一輪),用當下最新的內容。最後一次存檔的內容保證會被審到。
- 連續觸發時降級:補跑那幾輪只做階段一(只看改動的行)。兩階段送的是同一份
完整檔案,省掉階段二等於省一半請求。
第 3 點是延後、不是放棄。階段一會濾掉改動範圍外的意見,而 DMA cache、W1C、ISR、
ABI 這類問題常常不在改動的那幾行上。所以連續觸發一停止,sensAI 會自動補做完整審查
(單一請求,不重跑階段一)。側欄在降級期間會標示「連續存檔中,等停下來再做完整審查」。
sensAI: Review Current File 不受這三層影響,一律立即執行完整流程,並取消該檔案還在
等待的去抖動。
審查期間檔案又被改過時,結果仍然會顯示,但側欄會標明行號是對著送出當下那一版算的、
跳行可能會偏。
限制
- 多根工作區目前只讀取第一個工作區資料夾。
.S 的巨集不會展開;上下文不足時模型應保守不報。
- sensAI 提供 review 意見,不會產生或套用修補程式。
More documentation