Shintoghi: catch structurally inconsistent AI code
Shintoghi is a local VS Code, CLI, and MCP guard for code that passes type checking but does not follow the structural pattern of neighboring screens, handlers, services, or tests.
Japanese README
Three-stage verification
- Existing VS Code diagnostics gate the file. If a language-server error exists, Shintoghi does not call the model or native analyzer.
- A pure-Rust core creates deterministic 256-dimensional BLAKE3 feature hashes, computes low-rank SVD residuals, applies leave-one-out conformal scoring, and returns the closest reference file.
- A Copilot language model is called only for confirmed outliers and only when
shintoghi.enableSubagentExplanation is enabled.
The native core runs entirely on the local machine. File contents are sent to a language model only for the optional third stage.
A Shintoghi warning means structural outlier, not proof of incorrect behavior. Review the suggested reference and the requirements before changing code.
VS Code usage
- Saved files are checked automatically.
- Outliers appear in the Problems panel with a reference-file link.
- The status bar shows the current residual and cumulative detected/corrected counts.
- Repeated inspection of identical content is suppressed by a BLAKE3 loop guard.
- The workspace command audits a bounded number of files.
- A normal result after an outlier shows the residual reduction.
| Command |
Details |
Shintoghi: Scan Current File |
Analyze the active configured source file |
Shintoghi: Scan Workspace |
Analyze a bounded number of configured files |
Shintoghi: Copy Last Verdict JSON |
Copy the latest verdict for hooks or reports |
Shintoghi: Toggle Automatic Scanning |
Enable or disable save-time scanning |
CLI and MCP
The VSIX includes native binaries for Windows x64, macOS x64/arm64, and Linux x64/arm64.
shintoghi check-file path/to/update.ts
shintoghi verify path/to/update.ts
shintoghi scan path/to/folder
shintoghi mcp
check-file exits with code 2 for the first detected outlier and returns code 0 when the same unchanged content is inspected again. It always emits fixed JSON.
The MCP server exposes:
verify_file: analyze one file and return the structural verdict and action
verify_and_rank_candidates: rank candidate implementations by SVD residual reward and UCB1 strategy history
Verdict JSON
{
"verdict": "outlier",
"action": "READ_REFERENCE_AND_ALIGN",
"file": "src/screens/update.ts",
"reference": "src/screens/create.ts",
"reference_count": 3,
"residual": 0.18,
"threshold": 0.08,
"p_value": 0.2,
"alpha": 0.05,
"content_hash": "...",
"loop_guard": "blocked-once"
}
Settings
| Setting |
Default |
Description |
shintoghi.enabled |
true |
Enable save-time scanning |
shintoghi.targetExtensions |
ts, tsx, cs, rs, py, go |
Extensions compared with sibling files |
shintoghi.minReferenceFiles |
3 |
Minimum sibling count before a verdict |
shintoghi.alpha |
0.05 |
Conformal significance level |
shintoghi.rankK |
3 |
Rank of the SVD reference subspace |
shintoghi.enableSubagentExplanation |
false |
Explain confirmed outliers with Copilot only |
shintoghi.maxReferenceFiles |
40 |
Sibling-file cap for one scan |
shintoghi.maxFileBytes |
200000 |
Maximum bytes read for one sibling file |
shintoghi.maxFolderScanFiles |
200 |
Maximum files checked by a workspace scan |
When too few peers are available, Shintoghi abstains. The conformal p-value depends on the number and representativeness of calibration peers; it is not the probability that the code is correct.
Source and bug reports: GitHub. License: MIT.