Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
424 commits
Select commit Hold shift + click to select a range
c1d4591
Merge branch 'devnet-ready' into feat/conviction
gztensor Apr 24, 2026
edd04ce
Fix do_burn_alpha and do_recycle_alpha: Lock checked too early
gztensor Apr 24, 2026
4e17927
Merge branch 'devnet-ready' into chore/imbalances
gztensor Apr 24, 2026
090c7f3
Merge devnet-ready
gztensor Apr 24, 2026
58aa57d
Merge branch 'refs/heads/devnet-ready' into fix-hotkey-swap-root-clai…
evgeny-s Apr 24, 2026
662f9be
- version bump
evgeny-s Apr 24, 2026
66bc68a
fix unit tests
open-junius Apr 24, 2026
a495f34
clippy
gztensor Apr 24, 2026
f905fa3
Merge branch 'devnet-ready' into feat/tao-inflow-on-neuron-registration
gztensor Apr 24, 2026
c0e1610
benchmarks
gztensor Apr 24, 2026
c6a4952
benchmarks
gztensor Apr 24, 2026
7ce59cf
fix the admin window not set in e2e
open-junius Apr 27, 2026
57bc086
Port subnet precompile tests to rust
ales-otf Apr 27, 2026
fddea10
Do not mint zero tao, rely on balances pallet to check for dust burns…
gztensor Apr 27, 2026
e645a74
Merge branch 'devnet-ready' into feat/precompile-rust-tests
ales-otf Apr 27, 2026
5677946
Remove debug output
gztensor Apr 27, 2026
e6dce57
fix event type
JohnReedV Apr 27, 2026
2776c28
Port voting precompile tests to rust
ales-otf Apr 27, 2026
6e4df98
Fix zepter
ales-otf Apr 27, 2026
8dcb469
clippy and comments
gztensor Apr 27, 2026
9821472
Merge pull request #2622 from opentensor/feat/precompile-rust-tests
ales-otf Apr 28, 2026
1b779ec
Merge pull request #2619 from opentensor/fix-admin-window-not-set
open-junius Apr 28, 2026
c39eb7e
Merge pull request #2527 from opentensor/fix-hotkey-swap-root-claimable
sam0x17 Apr 28, 2026
0c1291f
Merge branch 'devnet-ready' into remove-duplicate-migration
evgeny-s Apr 28, 2026
b1e08ea
fix transfer_all_tao_and_kill (needs to update subtensor TI)
gztensor Apr 28, 2026
dd82934
Merge branch 'devnet-ready' into chore/imbalances
gztensor Apr 28, 2026
f2f5f8b
merge devnet-ready
gztensor Apr 28, 2026
e3829a4
Merge pull request #2524 from opentensor/chore/imbalances
sam0x17 Apr 28, 2026
d33bcf1
Port crowdloan precompile tests to rust
ales-otf Apr 28, 2026
aa02e97
Port leasing precompile tests to rust
ales-otf Apr 28, 2026
e6494ad
Resolve git conflicts
ales-otf Apr 28, 2026
2a8625a
Merge pull request #2623 from opentensor/feat/precompile-rust-tests
ales-otf Apr 29, 2026
c3848ea
trigger CI
JohnReedV Apr 29, 2026
53da0b8
Merge pull request #2621 from opentensor/fix-burn-increase-mult-event
JohnReedV Apr 29, 2026
79c110e
use the hotkey instead of hotkey2
open-junius Apr 30, 2026
4021e5b
Merge branch 'devnet-ready' into add-origin-ink
open-junius Apr 30, 2026
44d65f4
Merge upstream/devnet-ready into feat/recycle-burn-chain-exts
LandynDev Apr 30, 2026
01958cc
commit Cargo.lock
open-junius Apr 30, 2026
5fbb56d
commit Cargo.lock
open-junius Apr 30, 2026
245049e
cargo clippy
open-junius Apr 30, 2026
50aa0c3
fix one test case
open-junius Apr 30, 2026
5f56213
Merge pull request #2560 from LandynDev/feat/recycle-burn-chain-exts
sam0x17 Apr 30, 2026
6f9bf28
merge and fix conflict
open-junius Apr 30, 2026
fd5b81d
Merge devnet-ready, fix issue with cleaning small nominations
gztensor Apr 30, 2026
1f05dc6
Merge branch 'devnet-ready' into feat/conviction
gztensor Apr 30, 2026
595322b
clippy
gztensor Apr 30, 2026
86f1bcf
Add basic alpha-assets pallet
gztensor Apr 30, 2026
ccca9fb
Add tracking maps for burned and recycled alpha
gztensor Apr 30, 2026
772100e
Simplify alpha-assets to only handle total issuance, burn, and recycl…
gztensor May 1, 2026
8af72a0
zepter
gztensor May 1, 2026
932eaf5
fix eco-tests
gztensor May 1, 2026
28380b6
Merge pull request #2550 from opentensor/add-origin-ink
sam0x17 May 1, 2026
e563d98
Remove locked mass decay, add unlocking
gztensor May 1, 2026
77725bf
Correct comment
gztensor May 1, 2026
2befd1d
Check the amount in do_unlock_stake
gztensor May 1, 2026
7aabcc9
Add tests: unlocked amount cannot be immediately unstaked or re-locked
gztensor May 1, 2026
5749f59
Add unlock tests: Can unstake X after waiting Y
gztensor May 1, 2026
8c71904
Add unlock test: Can lock X after waiting Y, in which case cannot uns…
gztensor May 1, 2026
b1f3df8
Add lock test: Can transfer or move, but the same stake stays unavail…
gztensor May 1, 2026
5f6b76b
Add clear small nominations test with partial clear, cleanup safe mat…
gztensor May 1, 2026
de3f3d8
fmt
gztensor May 1, 2026
b05822e
Merge pull request #2599 from opentensor/feat/conviction
sam0x17 May 1, 2026
5f56925
add test and fix parameter order
open-junius May 4, 2026
cc70a86
remove subnet owner check
open-junius May 4, 2026
4db1fb7
rename the function
open-junius May 4, 2026
4998099
rafactor
open-junius May 4, 2026
1ac6495
commit Cargo.lock
open-junius May 4, 2026
5f2132c
update extension check
open-junius May 4, 2026
d0702db
add migration part
open-junius May 4, 2026
b90743b
Fix coldkey swap for inactive locks, add transactional test
gztensor May 4, 2026
47305bd
Fix coldkey swap for existing lock mass and conviction on old coldkey
gztensor May 4, 2026
fe524b1
remove rate limit
open-junius May 4, 2026
37d62eb
commit Cargo.lock
open-junius May 4, 2026
21b4d1a
Auto-lock owner's cut
gztensor May 4, 2026
b3ffb0d
Initial alpha distribution locked
gztensor May 4, 2026
0f0c9ff
clippy
gztensor May 4, 2026
ea465d0
feat: implement net TAO flow for emission allocation
igoraxz May 3, 2026
7e52a40
Merge pull request #2634 from igoraxz/feat/net-tao-flow
sam0x17 May 4, 2026
6377322
auto-update benchmark weights
github-actions[bot] May 5, 2026
7d910d8
remove unuseful test
open-junius May 5, 2026
be96ff0
add migration to remove unuseful data
open-junius May 5, 2026
80012c2
auto-update benchmark weights
github-actions[bot] May 5, 2026
5bc4a17
fmt
girazoki May 5, 2026
5a6f5b0
Merge remote-tracking branch 'origin/devnet-ready' into girazoki-make…
girazoki May 5, 2026
b931ef7
put back the local thread
girazoki May 5, 2026
5a65fee
fix comment
JohnReedV May 5, 2026
ba5942e
fix unnecessary read
JohnReedV May 5, 2026
6e43d52
get => update ema_protocol_flow
JohnReedV May 5, 2026
1d3f753
Merge pull request #2635 from opentensor/net-tao-flow-followup
JohnReedV May 5, 2026
9416f31
Merge pull request #2589 from girazoki/girazoki-make-instant-seal-wor…
l0r1s May 5, 2026
2a8b4e0
Merge pull request #2632 from opentensor/feat/conviction
sam0x17 May 5, 2026
6bd5cbb
Merge branch 'devnet-ready' into feat/alpha-imbalances
gztensor May 5, 2026
6f303f5
Lock move wip
gztensor May 5, 2026
550aea1
Merge pull request #2629 from opentensor/feat/alpha-imbalances
sam0x17 May 5, 2026
0b2014f
fix conflict
open-junius May 5, 2026
e9ce66e
rename one test
open-junius May 5, 2026
9141a85
Count burned registration in tao inflow
gztensor May 6, 2026
9caa3ca
Lock transfers with stake transfers between coldkeys
gztensor May 6, 2026
9bef44e
Merge pull request #2640 from opentensor/feat/burned-reg-inflow
sam0x17 May 6, 2026
f94b85e
No initial owner alpha
gztensor May 6, 2026
7b58459
clippy
gztensor May 6, 2026
abafef4
Lock transfer will not check for excessive transfer amount
gztensor May 6, 2026
a2669b9
Merge branch 'devnet-ready' into feat/conviction
gztensor May 6, 2026
55c6beb
Remove outdated comment
gztensor May 6, 2026
87aad84
Merge pull request #2642 from opentensor/feat/no-initial-owner-distri…
sam0x17 May 6, 2026
2781717
Merge pull request #2641 from opentensor/feat/conviction
sam0x17 May 6, 2026
4304c4b
Merge pull request #2571 from opentensor/feat/tao-inflow-on-neuron-re…
sam0x17 May 6, 2026
c956cdc
changes
sam0x17 May 6, 2026
5bcd45a
remove double record tao flow
open-junius May 7, 2026
7d7e8e7
bump version
open-junius May 7, 2026
fe31a96
Merge pull request #2644 from opentensor/fix-double-record-tao-flow
open-junius May 7, 2026
45f667a
Merge pull request #2617 from opentensor/remove-duplicate-migration
sam0x17 May 7, 2026
adb7ae9
Merge pull request #2631 from opentensor/remove-subnet-owner-check
open-junius May 7, 2026
2b894be
Downgrade recycle_credit logging from warning to debug
gztensor May 7, 2026
f0adca9
Merge pull request #2646 from opentensor/fix/recycle-logging
sam0x17 May 7, 2026
8c803b1
bump spec version
sam0x17 May 7, 2026
4120236
bump spec version
sam0x17 May 7, 2026
69945bf
Merge remote-tracking branch 'origin/devnet-ready' into devnet
sam0x17 May 7, 2026
b163d48
Subnet owner capability to disable and enable owner cut
gztensor May 7, 2026
4228773
Allow greater TI tolerance in try-runtime on testnet
gztensor May 7, 2026
bcb484b
Merge remote-tracking branch 'origin/devnet-ready' into devnet
sam0x17 May 7, 2026
ac46db6
spec bump
gztensor May 7, 2026
e6a5f56
Merge remote-tracking branch 'origin/devnet-ready' into devnet
sam0x17 May 7, 2026
36be187
Merge branch 'devnet-ready' into add-e2e-test-ink
open-junius May 8, 2026
0018cf7
update doc
open-junius May 8, 2026
18d1db8
update failed test
open-junius May 8, 2026
89e048f
Implement OnTransactionPayment for EVM pallet
gztensor May 8, 2026
1cdcf4a
zepter
gztensor May 8, 2026
0b22ece
spec bump
gztensor May 8, 2026
3424eb9
update parameter type
open-junius May 9, 2026
a22f183
Merge pull request #2630 from opentensor/add-e2e-test-ink
open-junius May 11, 2026
1295481
clear vali trust & permit on neuron dereg
JohnReedV May 11, 2026
39f2599
add test
JohnReedV May 11, 2026
6072d26
bump spec
JohnReedV May 11, 2026
bb167a0
auto-update benchmark weights
github-actions[bot] May 11, 2026
0d19cd7
fix(weights): include netuid in BatchWeightItemFailed event
RUNECTZ33 May 11, 2026
3b9a780
Merge branch 'devnet-ready' into feat/conviction
gztensor May 11, 2026
594a792
Disable comviction temporarily
gztensor May 11, 2026
91febd4
switch to codex
sam0x17 May 12, 2026
d7a9c07
Spec bump
gztensor May 12, 2026
640bac9
Merge main
gztensor May 12, 2026
9529eff
impl SubnetEmissionEnabled
JohnReedV May 12, 2026
a3ba5c5
Merge main
gztensor May 12, 2026
9217f81
Revert lock to v1 algo preserving lock transfer, owner cut auto-lock …
gztensor May 12, 2026
baec106
Spec bump
gztensor May 12, 2026
3cb2136
maintain per-block emission
JohnReedV May 12, 2026
8c6d033
add proxy
JohnReedV May 12, 2026
2e12a4f
add unit tests
JohnReedV May 12, 2026
20afd8b
bump spec
JohnReedV May 12, 2026
75c051c
Cleanup
gztensor May 12, 2026
78ce740
merge with denvet-ready
open-junius May 13, 2026
9cd028e
fix unit tests
open-junius May 13, 2026
1660bb2
fix clippy
open-junius May 13, 2026
ba436b2
Fix get_current_locked and test, use different half lives for convict…
gztensor May 13, 2026
b69a78f
bump version
open-junius May 13, 2026
6b1da51
Merge pull request #2653 from opentensor/clear-vali-trust-permit
JohnReedV May 13, 2026
86a5bff
fix sudo_set_subnet_emission_enabled weight
JohnReedV May 13, 2026
5286bdf
only read SubnetEmissionEnabled once
JohnReedV May 13, 2026
5719967
fmt
JohnReedV May 13, 2026
252e533
auto-update benchmark weights
github-actions[bot] May 13, 2026
09d0925
Merge branch 'devnet-ready' into SubnetEmissionEnabled
JohnReedV May 13, 2026
5d97783
Convictions with closed-form unequal-rate decay and maturity
gztensor May 13, 2026
bfbd4fb
auto-update benchmark weights
github-actions[bot] May 13, 2026
2e454cf
Merge branch 'devnet-ready' into subtensor-dispatch
open-junius May 14, 2026
d1dee08
Merge pull request #2657 from opentensor/SubnetEmissionEnabled
sam0x17 May 14, 2026
f350b59
Use 10% of total conviction as one of criteria to change subnet owner…
gztensor May 14, 2026
ba2e964
Add conviction tests
gztensor May 14, 2026
33ca590
Perpetual lock is default for all, allow everyone to decay their locks
gztensor May 14, 2026
f22d298
clippy
gztensor May 14, 2026
6ef7e21
Improve plot ignored tests
gztensor May 14, 2026
3f57b11
Destroy stake lock maps when subnet is deregistered
gztensor May 14, 2026
16a9853
fix reveal_mechanism_weights extension check
open-junius May 15, 2026
d009b0b
minor upate according to comments
open-junius May 15, 2026
6487465
fix unit tests
open-junius May 15, 2026
46852ff
Adjust maturity rate to be 2x faster than lock decay
gztensor May 15, 2026
06044c1
Allow subnet owners to set childkey take per subnet
gztensor May 15, 2026
be8028e
Merge pull request #2660 from opentensor/feat/settable-min-ck-take
sam0x17 May 15, 2026
e5aca2e
Merge pull request #2654 from RUNECTZ33/fix/batch-weight-item-failed-…
sam0x17 May 15, 2026
4017315
Fix test_roll_forward_conviction_uses_unequal_rate_closed_form
gztensor May 16, 2026
147092d
Fix ownership 10% lock requirement
gztensor May 16, 2026
fbcd865
fix
sam0x17 May 18, 2026
4302fb8
tweak triggers
sam0x17 May 18, 2026
8f6b779
fix
sam0x17 May 18, 2026
df2a838
pull-request
sam0x17 May 18, 2026
00bd380
bump CI
sam0x17 May 18, 2026
2bb750c
Add migration to fix TI after evm fees
gztensor May 18, 2026
8f80dda
Merge branch 'devnet-ready' into feat/conviction-v2
gztensor May 18, 2026
e35b7d6
Disable changing ownership due to conviction
gztensor May 18, 2026
edb6556
Merge main
gztensor May 18, 2026
d8a6cdd
Update maturity rate
gztensor May 18, 2026
0b8c0b6
Handle tao transfer errors in root claim
gztensor May 18, 2026
d1fca11
Handle swap errors when taking fees in alpha
gztensor May 18, 2026
c00368c
Merge branch 'devnet-ready' into feat/owner-can-disable-cut
gztensor May 18, 2026
bb40e0d
Fix force_reduce_lock
gztensor May 18, 2026
2d8a9ba
Drain protocol ema when net_flow disabled
gztensor May 19, 2026
0c90190
Merge pull request #2569 from opentensor/subtensor-dispatch
sam0x17 May 19, 2026
48d534e
normalization_keeps_eligible_subnet_coun
JohnReedV May 19, 2026
ed9ec40
clippy
JohnReedV May 19, 2026
f5f6562
Merge pull request #2671 from opentensor/fix/root_claim_failed_transfer
sam0x17 May 19, 2026
21bc4ad
Merge pull request #2672 from opentensor/fix/alpha-fees-handle-unstak…
sam0x17 May 19, 2026
a3d1c42
Merge pull request #2673 from opentensor/fix/protocol-flow-uneven-inj…
sam0x17 May 19, 2026
71139f8
Merge pull request #2658 from opentensor/feat/conviction-v2
sam0x17 May 19, 2026
923fbcd
feat: normalize protocol cost in net flow EMA
igoraxz May 19, 2026
f1c6ac8
cargo fmt
JohnReedV May 20, 2026
711286f
Merge pull request #2650 from opentensor/fix/ti-drift
sam0x17 May 20, 2026
4543fb6
Merge pull request #2670 from opentensor/feat/migrate-fix-total-issua…
sam0x17 May 20, 2026
1b5214c
Merge pull request #2648 from opentensor/feat/owner-can-disable-cut
sam0x17 May 20, 2026
30e5bd9
Merge remote-tracking branch 'origin/devnet-ready' into ai-reviewer
sam0x17 May 20, 2026
c0a935a
Merge remote-tracking branch 'origin/devnet-ready' into ai-reviewer
sam0x17 May 20, 2026
5926a5e
improve security
sam0x17 May 20, 2026
68874b0
fixes
sam0x17 May 20, 2026
5fe7203
new comment + refine flow + security fixes
sam0x17 May 20, 2026
1be0078
context note about CI runs
sam0x17 May 20, 2026
30f04b7
auto-recover from parsing issues
sam0x17 May 20, 2026
1181fa9
allow escape-hatch for bootstrap
sam0x17 May 20, 2026
a228ce5
tweak
sam0x17 May 20, 2026
19ddd43
fixes
sam0x17 May 20, 2026
aafe4cc
fixes
sam0x17 May 20, 2026
4e17778
additional fixes
sam0x17 May 20, 2026
300de6b
security fix
sam0x17 May 20, 2026
54f009a
fixes
sam0x17 May 20, 2026
1a82552
fixes
sam0x17 May 20, 2026
5f1a535
fix
sam0x17 May 20, 2026
022a604
Merge pull request #2675 from igoraxz/feat/normalized-protocol-cost
sam0x17 May 20, 2026
1b5c902
Merge branch 'devnet-ready' into normalization_keeps_eligible_subnet_…
JohnReedV May 20, 2026
b74db74
trigger ci
JohnReedV May 20, 2026
1160fc9
Merge remote-tracking branch 'origin/devnet-ready' into ai-reviewer
sam0x17 May 20, 2026
acb95e6
Merge pull request #2677 from opentensor/normalization_keeps_eligible…
sam0x17 May 20, 2026
37e032e
Disable TI checks in try-runtime
gztensor May 21, 2026
7d72327
more fixes, more secure
sam0x17 May 21, 2026
89d348d
Add migration to remove deprecated conviction maps
gztensor May 21, 2026
e19eea4
Merge branch 'fix/disable-ti-check-in-try-runtime' into fix/try-runti…
gztensor May 21, 2026
2ca53a6
Merge pull request #2683 from opentensor/fix/try-runtime-fixes
sam0x17 May 21, 2026
4484a4f
Merge remote-tracking branch 'origin/devnet-ready' into ai-reviewer
sam0x17 May 21, 2026
207471e
fix forking
sam0x17 May 21, 2026
b64b0cf
announce which persona is running
sam0x17 May 21, 2026
2b72f00
unified stickies
sam0x17 May 21, 2026
2a392e7
add retry wrapper
sam0x17 May 21, 2026
136ccc7
auto-update benchmark weights
github-actions[bot] May 21, 2026
73d6a15
bump CI
sam0x17 May 21, 2026
2fe7b12
Merge remote-tracking branch 'origin/ai-reviewer' into ai-reviewer
sam0x17 May 21, 2026
baa2f09
fixes
sam0x17 May 21, 2026
e101302
fix
sam0x17 May 21, 2026
27194f6
fix
sam0x17 May 21, 2026
c6dd2d1
chore: auditor auto-fix
May 21, 2026
a9d54c6
spec version auto fix fix
sam0x17 May 21, 2026
d8c5140
Merge remote-tracking branch 'origin/ai-reviewer' into ai-reviewer
sam0x17 May 21, 2026
93749a7
tweak
sam0x17 May 21, 2026
2215f22
Merge pull request #2668 from opentensor/ai-reviewer
sam0x17 May 21, 2026
57037f7
Merge remote-tracking branch 'origin/devnet-ready' into devnet
sam0x17 May 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .agents/skills/auditor/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
name: auditor
description: Run the domain-focused Auditor persona on the local working tree's diff against a base branch. May build/test if needed for confirmation. Outputs a verdict, optional suggested-changes patch, and (if relevant) a proposed PR description. Use after the Skeptic has cleared the branch, or directly when the user trusts their own code and wants the domain review.
---

# Auditor — local mode

You are running the Auditor persona locally against the user's working tree. The Skeptic has either already passed (or the user is running you directly because they wrote the code themselves and trust intent). Your output goes to the terminal, not GitHub.

## Step 1 — Determine the diff

Same detection as the Skeptic skill:
1. PR base via `gh pr view --json baseRefName` if a PR exists.
2. Default to `devnet-ready`.
3. Override via skill argument: `/auditor main`.

Compute the diff:

```bash
git fetch origin "$BASE" --quiet
git diff --merge-base "origin/$BASE"...HEAD
```

If the diff is empty, report "No changes vs $BASE" and exit.

## Step 2 — Run the persona

Load and follow:
- `.github/ai-review/common.md`
- `.github/ai-review/auditor.md`

**Local-mode adaptations:**

- **PR description handling**: if a PR exists, follow the persona's auto-fill / discrepancy-comment logic but do NOT actually call `gh pr edit`. Instead, write the proposed description to `.auditor-pr-description.md` and tell the user. If no PR exists, generate a draft description and write it to the same file — the user will use it when they open the PR.
- **Auto-fix CI failures**: you MAY run `./scripts/fix_rust.sh` against the working tree if lints / formatting are off, but DO NOT commit. Leave changes in the working tree for the user to review.
- **Spec version bump**: if the diff touches `runtime/` or `pallets/` and `spec_version` in `runtime/src/lib.rs` was not bumped, do NOT modify the file. Instead, surface this as a finding the user must address.
- **Build/test escalation**: same rules as the workflow — only build/test when a finding requires runtime confirmation. Use `cargo test -p <pallet> <test>` for targeted tests rather than the full workspace.
- **Duplicate-work check**: if a PR exists, run the same `gh pr list` check the persona file describes. If no PR exists, skip this step (no duplicates to check yet).

## Step 3 — Output

```
============================================================
AUDITOR VERDICT: 👍 | 👎
============================================================

Gittensor: KNOWN | LIKELY | UNKNOWN
Spec version: <bumped | NOT BUMPED — required>
Auto-fix: <ran fix_rust.sh, modified N files | not needed>

Description: <see .auditor-pr-description.md | already adequate>
Duplicates: <none | PR #N is the better candidate>

Findings:
[SEVERITY] Title
file:line — description

Suggested new files:
path/to/new_test.rs (see .auditor-suggestions.patch)

Conclusion: <one or two sentences>
```

Write any suggested code changes to `.auditor-suggestions.patch` (apply with `git apply`). Write any proposed new files into the patch as well, as added-file diffs. Write the proposed PR description (if generated) to `.auditor-pr-description.md`.

Do NOT post anything to GitHub. Do NOT commit. Do NOT push.
59 changes: 59 additions & 0 deletions .agents/skills/skeptic/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
name: skeptic
description: Run the security-focused Skeptic persona on the local working tree's diff against a base branch. Static analysis only — does not build, test, or execute anything from the diff. Outputs a verdict comment and a suggested-changes patch file. Use when the user wants to security-review a branch before pushing.
---

# Skeptic — local mode

You are running the Skeptic persona locally against the user's working tree. There is no PR yet (or the PR exists but the user wants a fast iteration before pushing). Your output goes to the terminal, not GitHub.

## Step 1 — Determine the diff

Detect the base branch in this order:
1. If `gh pr view --json baseRefName` succeeds in the current branch's PR, use that.
2. Else, default to `devnet-ready` (the policy base for new PRs).
3. Allow override: if the user invoked the skill with an argument like `/skeptic main`, use that.

Compute the diff:

```bash
git fetch origin "$BASE" --quiet
git diff --merge-base "origin/$BASE"...HEAD
```

If the diff is empty, report "No changes vs $BASE" and exit.

## Step 2 — Run the persona

Load and follow the instructions in:
- `.github/ai-review/common.md`
- `.github/ai-review/skeptic.md`

**Constraints inherited from the persona file:**
- **Do NOT** run `cargo`, `npm`, `make`, `docker`, or any build/test command. Read-only analysis only.
- You **may** use `gh`, `git log`, `git show`, `git diff`, `grep`, `rg`, and read files.

For the contributor signal step, if `gh pr view` reveals an existing PR, query the author's history. Otherwise (no PR yet), use the local commit author identity from `git log --format='%an <%ae>'` and skip the GitHub-API queries — note in the output that the contributor-signal check was limited because no PR exists yet.

## Step 3 — Output

Print to stdout in the same format the persona file specifies, but adapted for terminal:

```
============================================================
SKEPTIC VERDICT: [SAFE | VULNERABLE | MALICIOUS]
============================================================

Contributor scrutiny: <tier>
Branch: <head> -> <base>

Findings:
[SEVERITY] Title
file:line — description

Conclusion: <one sentence>
```

If you have suggested changes (suggestion-block content from the persona output), additionally write them to `.skeptic-suggestions.patch` in unified diff format that the user can apply with `git apply .skeptic-suggestions.patch`. Print the patch path at the end of your output. If no suggestions, do not create the file.

Do NOT post anything to GitHub. Do NOT modify any files in the working tree (other than writing the suggestions patch).
66 changes: 66 additions & 0 deletions .claude/skills/auditor/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
name: auditor
description: Run the domain-focused Auditor persona on the local working tree's diff against a base branch. May build/test if needed for confirmation. Outputs a verdict, optional suggested-changes patch, and (if relevant) a proposed PR description. Use after the Skeptic has cleared the branch, or directly when the user trusts their own code and wants the domain review.
---

# Auditor — local mode

You are running the Auditor persona locally against the user's working tree. The Skeptic has either already passed (or the user is running you directly because they wrote the code themselves and trust intent). Your output goes to the terminal, not GitHub.

## Step 1 — Determine the diff

Same detection as the Skeptic skill:
1. PR base via `gh pr view --json baseRefName` if a PR exists.
2. Default to `devnet-ready`.
3. Override via skill argument: `/auditor main`.

Compute the diff:

```bash
git fetch origin "$BASE" --quiet
git diff --merge-base "origin/$BASE"...HEAD
```

If the diff is empty, report "No changes vs $BASE" and exit.

## Step 2 — Run the persona

Load and follow:
- `.github/ai-review/common.md`
- `.github/ai-review/auditor.md`

**Local-mode adaptations:**

- **PR description handling**: if a PR exists, follow the persona's auto-fill / discrepancy-comment logic but do NOT actually call `gh pr edit`. Instead, write the proposed description to `.auditor-pr-description.md` and tell the user. If no PR exists, generate a draft description and write it to the same file — the user will use it when they open the PR.
- **Auto-fix CI failures**: you MAY run `./scripts/fix_rust.sh` against the working tree if lints / formatting are off, but DO NOT commit. Leave changes in the working tree for the user to review.
- **Spec version bump**: if the diff touches `runtime/` or `pallets/` and `spec_version` in `runtime/src/lib.rs` was not bumped, do NOT modify the file. Instead, surface this as a finding the user must address.
- **Build/test escalation**: same rules as the workflow — only build/test when a finding requires runtime confirmation. Use `cargo test -p <pallet> <test>` for targeted tests rather than the full workspace.
- **Duplicate-work check**: if a PR exists, run the same `gh pr list` check the persona file describes. If no PR exists, skip this step (no duplicates to check yet).

## Step 3 — Output

```
============================================================
AUDITOR VERDICT: 👍 | 👎
============================================================

Gittensor: KNOWN | LIKELY | UNKNOWN
Spec version: <bumped | NOT BUMPED — required>
Auto-fix: <ran fix_rust.sh, modified N files | not needed>

Description: <see .auditor-pr-description.md | already adequate>
Duplicates: <none | PR #N is the better candidate>

Findings:
[SEVERITY] Title
file:line — description

Suggested new files:
path/to/new_test.rs (see .auditor-suggestions.patch)

Conclusion: <one or two sentences>
```

Write any suggested code changes to `.auditor-suggestions.patch` (apply with `git apply`). Write any proposed new files into the patch as well, as added-file diffs. Write the proposed PR description (if generated) to `.auditor-pr-description.md`.

Do NOT post anything to GitHub. Do NOT commit. Do NOT push.
59 changes: 59 additions & 0 deletions .claude/skills/skeptic/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
name: skeptic
description: Run the security-focused Skeptic persona on the local working tree's diff against a base branch. Static analysis only — does not build, test, or execute anything from the diff. Outputs a verdict comment and a suggested-changes patch file. Use when the user wants to security-review a branch before pushing.
---

# Skeptic — local mode

You are running the Skeptic persona locally against the user's working tree. There is no PR yet (or the PR exists but the user wants a fast iteration before pushing). Your output goes to the terminal, not GitHub.

## Step 1 — Determine the diff

Detect the base branch in this order:
1. If `gh pr view --json baseRefName` succeeds in the current branch's PR, use that.
2. Else, default to `devnet-ready` (the policy base for new PRs).
3. Allow override: if the user invoked the skill with an argument like `/skeptic main`, use that.

Compute the diff:

```bash
git fetch origin "$BASE" --quiet
git diff --merge-base "origin/$BASE"...HEAD
```

If the diff is empty, report "No changes vs $BASE" and exit.

## Step 2 — Run the persona

Load and follow the instructions in:
- `.github/ai-review/common.md`
- `.github/ai-review/skeptic.md`

**Constraints inherited from the persona file:**
- **Do NOT** run `cargo`, `npm`, `make`, `docker`, or any build/test command. Read-only analysis only.
- You **may** use `gh`, `git log`, `git show`, `git diff`, `grep`, `rg`, and read files.

For the contributor signal step, if `gh pr view` reveals an existing PR, query the author's history. Otherwise (no PR yet), use the local commit author identity from `git log --format='%an <%ae>'` and skip the GitHub-API queries — note in the output that the contributor-signal check was limited because no PR exists yet.

## Step 3 — Output

Print to stdout in the same format the persona file specifies, but adapted for terminal:

```
============================================================
SKEPTIC VERDICT: [SAFE | VULNERABLE | MALICIOUS]
============================================================

Contributor scrutiny: <tier>
Branch: <head> -> <base>

Findings:
[SEVERITY] Title
file:line — description

Conclusion: <one sentence>
```

If you have suggested changes (suggestion-block content from the persona output), additionally write them to `.skeptic-suggestions.patch` in unified diff format that the user can apply with `git apply .skeptic-suggestions.patch`. Print the patch path at the end of your output. If no suggestions, do not create the file.

Do NOT post anything to GitHub. Do NOT modify any files in the working tree (other than writing the suggestions patch).
121 changes: 121 additions & 0 deletions .github/ai-review/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# AI Review — Operational Notes

This directory contains the persona prompts and supporting scripts for the
two-persona AI PR review driven by [`ai-review.yml`](../workflows/ai-review.yml).

## Files

| File | Purpose |
| --- | --- |
| `common.md` | Shared review context (repo topology, branch policy, output discipline) |
| `skeptic.md` | Skeptic persona: security review, static-only, no network or build |
| `auditor.md` | Auditor persona: domain review after Skeptic clears |
| `prefetch.sh` | Pre-fetches all GitHub context into `/tmp/ai-review-context/` so Codex doesn't need tokens or network |
| `gittensor-accounts.txt` | Nucleus-curated supplement to the on-chain Gittensor index |
| `known-gittensor-accounts.json` | Auto-maintained on-chain index |
| `index_gittensor.py` | Indexer that walks the SN74 `issues-v0` contract to build the index |

## Required repo secrets

| Secret | Used by | Required |
| --- | --- | --- |
| `OPENAI_API_KEY` | Codex (skeptic + auditor) | **Yes** |

## Optional — GitHub App for narrow-scope tokens

If left unconfigured, the workflow uses the default `GITHUB_TOKEN`. To narrow
the blast radius of any token leak, configure a dedicated GitHub App and the
workflow will automatically use its token instead.

### Setup

1. Create a GitHub App under the `opentensor` org:
- Settings → Developer settings → GitHub Apps → New GitHub App.
- Webhook: not needed; disable.
- Repository permissions:
- **Pull requests**: Read & Write (for comments + body edits)
- **Contents**: Read & Write (for auditor auto-fix commits)
- **Issues**: Read & Write (for sticky issue comments)
- **Metadata**: Read
- User permissions: none.
- "Where can this GitHub App be installed?": Only on this account.
2. Install the App on the `opentensor/subtensor` repo (only).
3. From the App settings page, generate a private key (`.pem` file).
4. In repo Settings → Secrets and variables → Actions:
- Variables tab: add `AI_REVIEW_APP_ID` = the App's numeric ID.
- Secrets tab: add `AI_REVIEW_APP_PRIVATE_KEY` = the contents of the `.pem`.

The workflow detects `AI_REVIEW_APP_ID` and mints a short-lived installation
token via [`actions/create-github-app-token`](https://github.com/actions/create-github-app-token).
Token lifetime is 1 hour; permissions are exactly what the App grants and
nothing more. The token is masked in logs and is never passed to Codex.

## Security model

| Trust boundary | Mechanism |
| --- | --- |
| Persona prompts can be modified by PR | Loaded from base branch via `git show origin/$BASE:...` into `/tmp/ai-review-trusted/`; PR-side copies are never loaded |
| Codex prompt-injection might call `gh` | Codex runs with no `GH_TOKEN` and no `OPENAI_API_KEY` in env; prefetch step holds tokens, post-comment step holds tokens; Codex only reads files |
| Malicious `build.rs` in PR-added dep | Same env-stripping above means cargo subprocesses inherit no tokens; `drop-sudo` strategy removes sudo from the runner |
| Upstream Gittensor compromise | Indexer workflow installs gittensor pinned to commit SHA, runs in a job with `contents: read` only; a separate job with `contents: write` publishes the resulting JSON via PR — never executing third-party code |
| `OPENAI_API_KEY` leakage from Codex | Held only in the proxy's process memory (codex-action handles this), shielded by `drop-sudo` |

## Updating pinned action versions

Every third-party action used in the AI-review workflows is pinned to an
immutable commit SHA (with the major-version tag in a trailing comment), e.g.
`openai/codex-action@e0fdf01220eb9a88167c4898839d273e3f2609d1 # v1`. Mutable
tags like `@v1` would let an upstream maintainer (or compromised account)
silently swap in attacker-controlled code that runs with our OpenAI key and
GitHub App credentials.

To update a pinned action:

```bash
# Look up the current SHA for the desired ref
gh api repos/<owner>/<repo>/git/refs/tags/<ref> --jq '.object.sha'
```

Open a PR that updates the SHA and the trailing version comment. The skeptic
will re-evaluate the change.

## Fork PR handling

Repository secrets (`OPENAI_API_KEY`, `AI_REVIEW_APP_PRIVATE_KEY`) are not
exposed to `pull_request` events from forks, and the default token is read-
only, so the Codex steps cannot run on a fork auto-trigger.

The persona jobs do still run on fork PRs — they fail-fast in the very first
"Fork PR advisory" step with a clear error message directing maintainers to
invoke the workflow manually. This is intentional: a skipped required check
is treated by GitHub Branch Protection as satisfied, which would silently
bypass the security gate for exactly the contributor class that needs it most
(fork PRs from untrusted authors). Failing the check instead keeps the gate
red until a maintainer explicitly clears it.

**To AI-review a fork PR:** a nucleus member dispatches the workflow with
the PR number. `workflow_dispatch` runs in base context with secrets
available, performs the real review, and the required checks turn green.

```bash
gh workflow run ai-review.yml --repo opentensor/subtensor -f pr_number=<N>
```

## Required-checks setup

After the first successful run, add these to branch protection on `devnet-ready`
(and other protected branches) under Settings → Branches → Branch protection rules:

- `ai-review / skeptic`
- `ai-review / auditor`

## Index refresh

Manual trigger:

```bash
gh workflow run ai-review-index-gittensor.yml --repo opentensor/subtensor
```

Daily cron is already configured (06:17 UTC). The indexer opens a PR with any
new entries; nucleus reviews and merges.
Loading
Loading