justify-unsafe
Introduce or audit an `unsafe` region in Tyrne — writing the `SAFETY:` comment, adding the audit-log entry, and queuing security review.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Introduce or audit an `unsafe` region in Tyrne — writing the `SAFETY:` comment, adding the audit-log entry, and queuing security review.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Add a new Board Support Package (BSP) crate to the Tyrne workspace — from crate skeleton through boot checklist to first QEMU or hardware boot.
Propose and draft a new Architecture Decision Record (ADR) in MADR format for Tyrne.
Run an independent verification pass over artefacts in `Proposed` / `In Review` waiting-for-promotion states. Distinct from code-review (style + correctness on a diff) and security-review (adversarial axis pass) — this skill verifies that the artefacts' claims about their own state match reality and produces a Done-promotion verdict.
Produce a review artifact in `docs/analysis/reviews/<type>-reviews/`, following that type's master plan. Works for business / code / security / performance-optimization reviews.
Change an existing Tyrne standard correctly — write or update the motivating ADR first, then update the standard file.
Add a new Rust crate to the Tyrne workspace following the dependency policy in `infrastructure.md`.
| name | justify-unsafe |
| description | Introduce or audit an `unsafe` region in Tyrne — writing the `SAFETY:` comment, adding the audit-log entry, and queuing security review. |
| when-to-use | Whenever a change introduces, modifies, or broadens an `unsafe` block, `unsafe fn`, `unsafe impl`, or `unsafe trait`. |
unsafeunsafe use (file and line range, or a description of the change).unsafe is needed — the operation being performed that Rust's type system cannot otherwise express.Confirm unsafe is actually necessary. Re-read unsafe-policy.md — Rules §5 and §6. Is the reason in the "permitted" list (MMIO, hardware-defined structures, context switching, FFI, intrinsics/asm)? Is it not in the "not permitted" list (ergonomic shortcut, unmeasured optimization, skipping bounds checks)? If unclear, prefer the safer alternative.
Write the SAFETY: comment directly adjacent to the unsafe region. Three elements are required:
UNSAFE-YYYY-NNNN.Example shape:
// SAFETY: <invariants>. <why safer alternative was rejected>.
// Audit: UNSAFE-YYYY-NNNN.
unsafe {
// the operation
}
For unsafe fn, add a # Safety section to the function's doc-comment that lists the invariants callers must uphold before calling. This is distinct from the SAFETY: comment on internal unsafe blocks — the doc # Safety is the caller-facing contract.
Assign the next audit tag.
docs/audits/unsafe-log.md (create it if this is the first unsafe in the project — see Audit log format below).UNSAFE-YYYY-NNNN for the current year.UNSAFE-YYYY-0001.Append the audit-log entry. Use this format:
### UNSAFE-YYYY-NNNN — one-line description
- **Introduced:** YYYY-MM-DD in commit `<sha-short>` (may be filled in post-commit).
- **Location:** `path/to/file.rs:function_name` (line range optional).
- **Operation:** one-sentence description of what the `unsafe` does.
- **Invariants relied on:** the bullet list matching the `SAFETY:` comment.
- **Rejected alternatives:** one or two sentences.
- **Reviewed by:** @<reviewer>, plus @<security-reviewer> if security-sensitive.
- **Status:** Active. (`Removed YYYY-MM-DD in <sha>` when the block is deleted.)
Request security review. Per security-review.md, any change that introduces, modifies, or broadens unsafe triggers the security-review pass. In solo phase, this is a separate self-review pass by the maintainer using perform-security-review. In multi-contributor phase, a second reviewer is required.
Commit with per commit-style.md:
unsafe, the invariants, the alternatives considered.Audit: UNSAFE-YYYY-NNNN and Security-Review: @<reviewer> once the review is complete.If this is the first unsafe audit entry in the project, create docs/audits/unsafe-log.md with this header:
# `unsafe` audit log
This log tracks every `unsafe` block, `unsafe fn`, `unsafe impl`, and `unsafe trait` introduced into Tyrne. See [unsafe-policy.md](../standards/unsafe-policy.md) for the policy this log implements.
Entries are append-only. When an `unsafe` region is removed, its entry gains a `Removed` status with date and commit; the entry is not deleted.
## Entries
<entries go below, newest at the bottom>
SAFETY: comment present directly adjacent to every new or modified unsafe region.unsafe fn has a # Safety section in its doc-comment.UNSAFE-YYYY-NNNN tag.Audit: UNSAFE-YYYY-NNNN present.unsafe { /* no comment */ } — unreviewable.// SAFETY: trust me. — unreviewable.// SAFETY: this is faster. — performance alone is not justification.unsafe when only a few lines need it.foo" — needs the actual invariants.unsafe "looks small".