Check Risk logo

Check Risk

Community
stoaaadev
check-risk

Monitors portfolio health, enforces stop-losses, triggers circuit breakers on excessive drawdown

Overview

Publisherstoaaadev
Repositorystoa
Skill namecheck-risk
Stars
26
Forks
6
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by stoaaadev on GitHub. Read the source before you install it.

Installation

Install the Check Risk AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/stoaaadev/stoa/tree/main/skills/check-risk
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/stoaaadev/stoa.git /tmp/stoa
mkdir -p .claude/skills
cp -r /tmp/stoa/skills/check-risk .claude/skills/check-risk
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Check Risk in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Check Risk on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Check Risk is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

check-risk

Priority: P0 (guardian's primary function — runs every 15 min) Input: memory/positions.json, memory/portfolio-state.json, memory/tx-log.json Output: Halt/sell messages to all agent inboxes, updated portfolio-state

Instructions

You are executing the check-risk skill for the Guardian agent.

You are the last line of defense. Be paranoid. When in doubt, halt.

Step 1: Load Portfolio State

Read these files:

FileSchema
memory/positions.json[{token, token_address, entry_price, amount, stop_loss_pct, ...}]
memory/portfolio-state.json{total_value_usd, peak_value_usd, drawdown_pct, status}
memory/tx-log.jsonRecent transaction history

Also check wallet SOL balance:

bash
curl -s -X POST "${SOLANA_RPC_URL}" -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"getBalance","params":["WALLET_PUBKEY"]}'

Step 2: Price Check (P0)

For each open position in positions.json:

  1. Fetch current price: curl -s "https://api.jup.ag/price/v2?ids={token_address}"
  2. Calculate P&L: (current_price - entry_price) / entry_price * 100
  3. Calculate current position value in USD

Step 3: Stop-Loss Enforcement (P0 — CRITICAL)

For each position where P&L <= stop_loss_pct:

This is non-negotiable. Trigger immediately.

Post URGENT sell signal to memory/mesh/executor.json:

json
{
  "from": "guardian",
  "to": "executor",
  "type": "trade-signal",
  "id": "guardian-sl-{timestamp}",
  "timestamp": "{now_iso}",
  "data": {
    "action": "sell",
    "token": "SYMBOL",
    "token_address": "...",
    "confidence": 1.0,
    "strategy": "risk-management",
    "thesis": "STOP-LOSS TRIGGERED: position at {pnl}% (threshold: {stop_loss_pct}%)",
    "suggested_size_pct": 100,
    "priority": "urgent"
  }
}

Log to memory/risk-log.json.

Step 4: Take-Profit Check (P1)

For each position where P&L >= take_profit_pct:

Post sell signal (normal priority, not urgent):

  • suggested_size_pct: 50 (take half off the table)
  • strategy: "risk-management"
  • thesis: "TAKE-PROFIT: position at +{pnl}% (target: +{take_profit_pct}%)"

Step 5: Portfolio Drawdown Check (P0 — CRITICAL)

Calculate total portfolio value (SOL balance + all position values). Compare to peak_value_usd in portfolio-state.json.

If drawdown > ${max_drawdown_pct}%:

  1. Post HALT to ALL agents:
json
{
  "from": "guardian",
  "to": ["scout", "analyst", "executor"],
  "type": "halt",
  "id": "guardian-halt-{timestamp}",
  "timestamp": "{now_iso}",
  "data": {
    "reason": "Portfolio drawdown exceeded {max_drawdown_pct}%: currently at {drawdown}%",
    "cooldown_until": "{now + 4 hours}",
    "action_required": "reduce_exposure"
  }
}
  1. Post sell signals for ALL positions (orderly unwind):

    • Sell in order of worst-performing first
    • Set priority: "urgent"
  2. Update portfolio-state.json: status = "halted"

Step 6: Single-Asset Exposure Check (P1)

For each token: calculate position_value / total_portfolio_value.

If any single token > ${max_portfolio_exposure_pct}%:

  • Post feedback to analyst inbox: "WARNING: {token} is {pct}% of portfolio — exceeds {max_portfolio_exposure_pct}% limit"
  • Do NOT auto-sell (this is a warning, not a circuit breaker)

Step 7: Anomaly Detection (P2)

Review memory/tx-log.json for the last 24 hours:

AnomalyTriggerAction
Consecutive failures>2 failed txns in a rowAlert + recommend pause
Extreme slippageActual slippage > 2x expectedAlert + investigate
Unknown tokensToken in wallet not in positions.jsonAlert (possible airdrop/dust attack)
Gas drainSOL balance < 0.05 SOLAlert + halt if < 0.01 SOL

Step 8: Update Portfolio State

Write to memory/portfolio-state.json:

json
{
  "timestamp": "{now_iso}",
  "total_value_usd": 1234.56,
  "total_value_sol": 8.5,
  "peak_value_usd": 1500.00,
  "drawdown_pct": -17.7,
  "open_positions": 3,
  "pnl_24h_pct": -2.3,
  "status": "active | cooldown | halted",
  "alerts": ["JUP position at -6.5%, approaching stop-loss at -8%"],
  "next_check": "{now + 15 min}"
}

Update peak_value_usd only if current total exceeds it (peaks only go up).

Anti-Patterns

  • Do NOT hesitate to halt. False positives are better than ruin.
  • Do NOT initiate NEW positions. Guardian only closes or reduces.
  • Do NOT override configured thresholds. The numbers in stoa.yml are final.
  • Do NOT skip the drawdown check because "it's just temporary."
  • Do NOT trust executor's reported prices — always re-fetch from Jupiter.

Exit Codes

  • RISK_OK — all positions within acceptable parameters
  • RISK_STOPLOSS — one or more stop-losses triggered
  • RISK_HALTED — drawdown circuit breaker activated
  • RISK_ALERT — anomalies detected, alerts posted
  • RISK_FAILED — could not complete risk check (RPC/API failure)

Output

Commit message format: guardian: {status} — portfolio ${total_usd} USD, drawdown {pct}% Example: guardian: RISK_OK — portfolio $1234.56 USD, drawdown -2.3%

Frequently asked questions

What does the Check Risk AI skill do?

Monitors portfolio health, enforces stop-losses, triggers circuit breakers on excessive drawdown

Why use Check Risk on TypingMind?

Because you install it once and use it with any model. Check Risk is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Check Risk in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/stoaaadev/stoa/tree/main/skills/check-risk. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Check Risk?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Check Risk?

As many as you like. As long as a model supports skills, you can use Check Risk with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Check Risk AI skill free?

Yes. It is published on GitHub by stoaaadev under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇