ต้นแบบ · รุ่นทดลอง: มีทุก server ในทะเบียนทางการ อัปเดตทุก 30 นาที เข้าสู่ระบบด้วย Google เพื่อเขียนรีวิวได้แล้ว
PopNx MCPที่รวม MCP สำหรับคนใช้ AI · วิธีติดตั้งภาษาไทยทุกตัว

Deadlatch

โดย Diabloluoรุ่น 0.1.2i★ 0iรันบนเครื่อง
ชื่อใน registryio.github.Diabloluo/deadlatch

วิธีติดตั้ง

ใช้ทำอะไรได้

ยังไม่มีคำอธิบายภาษาไทย ดูข้อเท็จจริงด้านล่าง หรือเปิดคำอธิบายต้นฉบับจากผู้ทำ

  • ต่อแบบ ติดตั้งในเครื่อง
  • บัญชีหรือคีย์ ไม่ต้องใส่คีย์
  • หมวด ร้านค้าออนไลน์และรับเงิน
คำอธิบายต้นฉบับจากผู้ทำ (อังกฤษ)
Local advisory pre-trade risk gate for agents. Never places orders.

ติดตั้ง

เลือกโปรแกรม AI ที่คุณใช้ แล้วคัดลอกค่าตั้งไปวาง

ผลตรวจผ่าน 3/3 · ทำงานบนเครื่องคุณ

ขั้นแรก: คุณใช้ AI ตัวไหน

เลือกแอปที่คุณใช้ ขั้นตอนจะขึ้นด้านล่าง

ต่อกับ Claude ได้ แต่ต้องเตรียมก่อน

ต้องลง Python (uv) ในเครื่องก่อน (ทำครั้งเดียว) · ใช้ได้เฉพาะแอป Claude บนคอม (Windows หรือ Mac) ไม่ใช่บนเว็บหรือมือถือ

  1. ลง Python (uv) ในเครื่อง

    ทำครั้งเดียว ใช้ได้กับทุกตัวที่ต้องใช้ Python (uv)

    เปิดหน้าดาวน์โหลด Python (uv) ↗

  2. เปิดไฟล์ตั้งค่าของแอป Claude บนคอม

    SettingsDeveloperEdit Config

  3. วางค่าตั้งนี้แล้วบันทึกไฟล์

    {
      "mcpServers": {
        "deadlatch": {
          "command": "uvx",
          "args": [
            "deadlatch",
            "--policy",
            "ใส่ค่าของคุณ",
            "--portfolio",
            "ใส่ค่าของคุณ"
          ]
        }
      }
    }
  4. ปิดแอป Claude แล้วเปิดใหม่

  5. ลองเลย

    ใช้ Deadlatch บอกหน่อยว่าทำอะไรให้ฉันได้บ้าง แล้วลองทำให้ดูหนึ่งอย่าง

    ✓ ถ้า Claude บอกว่ากำลังใช้ Deadlatch หรือมีชื่อเครื่องมือของ Deadlatch ขึ้นในคำตอบ แปลว่าต่อสำเร็จ

ชื่อเมนูตรวจกับหน้าช่วยเหลือของ Anthropic เมื่อ 11 พ.ย. 2569 · หน้าจอของคุณอาจต่างเล็กน้อยตามรุ่นของแอป

ChatGPT ยังต่อ Deadlatch ไม่ได้

Deadlatch ต้องติดตั้งในเครื่องคุณ แต่ ChatGPT ต่อได้เฉพาะตัวที่ทำงานบนเว็บ

คุณทำแบบนี้แทนได้

ก · ใช้แอปที่ต่อ Deadlatch ได้

  • ต้องลง Python (uv) ในเครื่องก่อน (ทำครั้งเดียว) · ใช้ได้เฉพาะแอป Claude บนคอม (Windows หรือ Mac) ไม่ใช่บนเว็บหรือมือถือ
  • ต้องลง Python (uv) ในเครื่องก่อน (ทำครั้งเดียว)
  • ต้องลง Python (uv) ในเครื่องก่อน (ทำครั้งเดียว) · ไม่มีปุ่มกดทีเดียว ต้องวางค่าตั้งและกรอกค่าเอง
  • ต้องลง Python (uv) ในเครื่องก่อน (ทำครั้งเดียว) · ไม่มีปุ่มกดทีเดียว ต้องวางค่าตั้งและกรอกค่าเอง

ข · ตัวอื่นในหมวด ร้านค้าออนไลน์และรับเงิน ที่ต่อกับ ChatGPT ได้

เลือกจากตัวที่ใช้มากในหมวดเดียวกัน เฉพาะตัวที่ต่อด้วยที่อยู่ได้โดยไม่ต้องใส่คีย์

ต่อกับ Claude Code ได้ แต่ต้องเตรียมก่อน

ต้องลง Python (uv) ในเครื่องก่อน (ทำครั้งเดียว)

  1. ลง Python (uv) ในเครื่อง

    ทำครั้งเดียว ใช้ได้กับทุกตัวที่ต้องใช้ Python (uv)

    เปิดหน้าดาวน์โหลด Python (uv) ↗

  2. เปิด Terminal

    Mac: กด Command+Space พิมพ์ Terminal · Windows: เปิด PowerShell

  3. วางคำสั่งนี้แล้วกด Enter

    claude mcp add --scope user deadlatch -- uvx deadlatch --policy 'ใส่ค่าของคุณ' --portfolio 'ใส่ค่าของคุณ'
  4. พิมพ์ /mcp ใน Claude Code

    ต้องเห็น Deadlatch ในรายการและขึ้นว่าเชื่อมต่อแล้ว

  5. ลองเลย

    ใช้ Deadlatch บอกหน่อยว่าทำอะไรให้ฉันได้บ้าง แล้วลองทำให้ดูหนึ่งอย่าง

    ✓ ถ้า Claude Code บอกว่ากำลังใช้ Deadlatch หรือมีชื่อเครื่องมือของ Deadlatch ขึ้นในคำตอบ แปลว่าต่อสำเร็จ

ชื่อเมนูตรวจกับหน้าช่วยเหลือของ Anthropic เมื่อ 11 พ.ย. 2569 · หน้าจอของคุณอาจต่างเล็กน้อยตามรุ่นของแอป

ต่อกับ Cursor ได้ แต่ต้องเตรียมก่อน

ต้องลง Python (uv) ในเครื่องก่อน (ทำครั้งเดียว) · ไม่มีปุ่มกดทีเดียว ต้องวางค่าตั้งและกรอกค่าเอง

  1. ลง Python (uv) ในเครื่อง

    ทำครั้งเดียว ใช้ได้กับทุกตัวที่ต้องใช้ Python (uv)

    เปิดหน้าดาวน์โหลด Python (uv) ↗

  2. เปิดไฟล์ตั้งค่า MCP ของ Cursor

    ~/.cursor/mcp.json

    วางค่าตั้งนี้ กรอกค่าที่ว่างไว้ แล้วบันทึกไฟล์

    {
      "mcpServers": {
        "deadlatch": {
          "command": "uvx",
          "args": [
            "deadlatch",
            "--policy",
            "ใส่ค่าของคุณ",
            "--portfolio",
            "ใส่ค่าของคุณ"
          ]
        }
      }
    }
  3. เปิดแชตของ AI ใน Cursor โหมด Agent

  4. ลองเลย

    ใช้ Deadlatch บอกหน่อยว่าทำอะไรให้ฉันได้บ้าง แล้วลองทำให้ดูหนึ่งอย่าง

    ✓ ถ้า Cursor บอกว่ากำลังใช้ Deadlatch หรือมีชื่อเครื่องมือของ Deadlatch ขึ้นในคำตอบ แปลว่าต่อสำเร็จ

ชื่อเมนูตรวจกับหน้าช่วยเหลือของ Cursor เมื่อ 11 พ.ย. 2569 · หน้าจอของคุณอาจต่างเล็กน้อยตามรุ่นของแอป

ต่อกับ VS Code ได้ แต่ต้องเตรียมก่อน

ต้องลง Python (uv) ในเครื่องก่อน (ทำครั้งเดียว) · ไม่มีปุ่มกดทีเดียว ต้องวางค่าตั้งและกรอกค่าเอง

  1. ลง Python (uv) ในเครื่อง

    ทำครั้งเดียว ใช้ได้กับทุกตัวที่ต้องใช้ Python (uv)

    เปิดหน้าดาวน์โหลด Python (uv) ↗

  2. เปิดไฟล์ตั้งค่า MCP ของ VS Code

    MCP: Open User Configuration

    วางค่าตั้งนี้ กรอกค่าที่ว่างไว้ แล้วบันทึกไฟล์

    {
      "servers": {
        "deadlatch": {
          "type": "stdio",
          "command": "uvx",
          "args": [
            "deadlatch",
            "--policy",
            "ใส่ค่าของคุณ",
            "--portfolio",
            "ใส่ค่าของคุณ"
          ]
        }
      }
    }
  3. เปิดแชตของ AI ใน VS Code โหมด Agent

  4. ลองเลย

    ใช้ Deadlatch บอกหน่อยว่าทำอะไรให้ฉันได้บ้าง แล้วลองทำให้ดูหนึ่งอย่าง

    ✓ ถ้า VS Code บอกว่ากำลังใช้ Deadlatch หรือมีชื่อเครื่องมือของ Deadlatch ขึ้นในคำตอบ แปลว่าต่อสำเร็จ

ชื่อเมนูตรวจกับหน้าช่วยเหลือของ VS Code เมื่อ 11 พ.ย. 2569 · หน้าจอของคุณอาจต่างเล็กน้อยตามรุ่นของแอป

โปรแกรมอื่นที่ใช้ MCP ได้ เช่น Windsurf, Zed หรือ Gemini CLI มีวิธีเพิ่มต่างกัน ดูวิธีของแต่ละตัวในหน้ารวมโปรแกรม

ดูโปรแกรมที่ใช้ MCP ทั้งหมด →

ค่าตั้งแบบไฟล์ JSON อยู่ในหัวข้อ “สำหรับคนเขียนโค้ด” ด้านล่าง

ติดตรงไหน? ถามคนที่ใช้ Deadlatch อยู่💬 พูดคุย →
สำหรับคนเขียนโค้ด: คำสั่ง Terminal และค่าตั้ง JSON

ติดตั้งในเครื่อง

Claude Code

claude mcp add --scope user deadlatch -- uvx deadlatch --policy 'ใส่ค่าของคุณ' --portfolio 'ใส่ค่าของคุณ'

Claude Desktop (claude_desktop_config.json)

{
  "mcpServers": {
    "deadlatch": {
      "command": "uvx",
      "args": [
        "deadlatch",
        "--policy",
        "ใส่ค่าของคุณ",
        "--portfolio",
        "ใส่ค่าของคุณ"
      ]
    }
  }
}

Cursor (~/.cursor/mcp.json)

{
  "mcpServers": {
    "deadlatch": {
      "command": "uvx",
      "args": [
        "deadlatch",
        "--policy",
        "ใส่ค่าของคุณ",
        "--portfolio",
        "ใส่ค่าของคุณ"
      ]
    }
  }
}

VS Code (mcp.json)

{
  "servers": {
    "deadlatch": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "deadlatch",
        "--policy",
        "ใส่ค่าของคุณ",
        "--portfolio",
        "ใส่ค่าของคุณ"
      ]
    }
  }
}

ค่าตั้งนี้สร้างจากข้อมูลใน registry ของผู้ทำ ถ้าไม่ตรงกับ README ให้เชื่อ README

สรุป

ดาวน์โหลดต่อสัปดาห์i
31/สัปดาห์
การเชื่อมต่อ
รันบนเครื่อง
รุ่นล่าสุดi
0.1.2
ส่งเข้า registryi
22 ก.ย. 2569
แก้โค้ดล่าสุดi
16 ต.ค. 2569
ผู้ทำ
Diabloluo
แพ็กเกจ
pypi: deadlatch
เว็บผู้ทำ
github.com
สถานะใน registry
ใช้งานอยู่

ใช้กับโปรแกรมไหนได้

ดูจากแบบการต่อของ server ตัวนี้ และเอกสารของผู้ทำโปรแกรมแต่ละตัว ตรวจเมื่อ 10 พ.ย. 2569

ติดตั้งบนเครื่องได้ใน

ClaudeGooseLM StudioMsty StudioCherry StudioCursorVS Code + GitHub CopilotVisual StudioWindsurf (Devin Desktop)ZedKiroClineContinueJetBrains AI AssistantClaude CodeCodex CLIGemini CLIOpenCodenodecodeWarpLibreChatRaycast

ดูโปรแกรมทั้งหมดพร้อมข้อดีข้อเสีย →

คู่มือที่เกี่ยวข้อง

ทำอะไรได้บ้าง

รันในเครื่องคุณ รายการเครื่องมือจะขึ้นในแอป AI หลังติดตั้ง

ผลตรวจเบื้องต้นi

เราตรวจจากข้อมูลที่ใครก็เปิดดูได้ ยังไม่ได้อ่านโค้ด ข้อที่ไม่เกี่ยวกับตัวนี้ไม่นับในตัวหาร · ตรวจเมื่อ 12 พ.ย. 2569

  • ✓ ผ่าน

    ตัวตนผู้ทำตรงกับ repo

    ชื่อใน registry ยืนยันด้วยบัญชี GitHub Diabloluo ซึ่งเป็นเจ้าของ repo

  • ✓ ผ่าน

    ยังมีคนดูแล

    มีการแก้โค้ดล่าสุด 27 วันที่ผ่านมา

  • ✓ ผ่าน

    มีสัญญาอนุญาต (license)

    ใช้ MIT

  • – ไม่เกี่ยว

    endpoint ตอบ

    ตัวนี้รันบนเครื่องคุณ ไม่มี endpoint บนอินเทอร์เน็ต

  • – ไม่เกี่ยว

    ล็อกอินแบบ OAuth

    ตัวนี้รันบนเครื่อง ใช้ค่าที่ตั้งในเครื่องแทน

  • … ยังไม่ตรวจ

    คำอธิบายเครื่องมือไม่มีคำสั่งแอบแฝง

    รันในเครื่องคุณ เราอ่านรายการเครื่องมือได้เฉพาะตัวที่มี endpoint บนอินเทอร์เน็ต

พูดคุย

ถาม แชร์เคล็ดลับ หรือแจ้งว่าใช้ไม่ได้ เรียงตามที่คนกดว่ามีประโยชน์

ยังไม่มีใครโพสต์ ถามหรือแชร์เป็นคนแรกได้เลย

ข้อความในส่วนนี้เขียนโดยผู้ใช้ ไม่ใช่ทีม PopNx

เข้าสู่ระบบด้วย Google เพื่อโพสต์

รีวิวจากผู้ใช้

ยังไม่มีรีวิว

เข้าสู่ระบบด้วย Google เพื่อเขียนรีวิว

เทียบกับตัวอื่นในหมวด ร้านค้าออนไลน์และรับเงินi

  • ดาวมากกว่า 0% ของอีก 2734 ตัวในหมวดนี้
  • ส่งรุ่นใหม่เข้า registry ล่าสุดกว่า 35% ของอีก 2734 ตัวในหมวดนี้
  • ผลตรวจเบื้องต้นดีกว่าหรือเท่ากับ 100% ของอีก 2734 ตัวในหมวดนี้

เทียบกับทุก server ที่ยังใช้งานในหมวดนี้ทั้งทะเบียน ดาวนับเฉพาะเมื่อผู้ลงทะเบียนเป็นเจ้าของ repo

คำถามที่พบบ่อย

Deadlatch ปลอดภัยไหม?

จากการตรวจเบื้องต้นของเรา ผ่าน 3 จาก 3 ข้อที่ตรวจได้ เรายังไม่ได้อ่านโค้ด ก่อนใส่กุญแจหรือ token ให้ดูว่า server ขอสิทธิ์อะไร และเลือกกุญแจที่ทำได้เท่าที่จำเป็น

ต้องใช้กุญแจหรือรหัสอะไรบ้าง?

registry ไม่ได้ระบุว่าต้องใช้กุญแจ แต่บางตัวจะขอให้ล็อกอินตอนใช้ครั้งแรก

ตัวนี้รันบนเครื่องหรือบนคลาวด์?

รันบนเครื่องของคุณ โปรแกรม AI จะเปิด server ขึ้นมาเองเมื่อใช้ ข้อมูลไม่ต้องผ่านเซิร์ฟเวอร์ของผู้ทำ (ยกเว้นตัวที่ไปเรียกบริการออนไลน์ต่อ)

ยังมีคนดูแลอยู่ไหม?

repo บน GitHub มีการแก้โค้ดล่าสุด 27 วันที่ผ่านมา และส่งรุ่นล่าสุด (0.1.2) เข้า registry 2 เดือนที่ผ่านมา

ใช้กับโปรแกรมไหนได้บ้าง?

โปรแกรมที่รองรับ MCP เช่น Claude Desktop, Claude Code, Cursor และ VS Code ตัวนี้ต้องมี Python (uv) ในเครื่องด้วย

มีตัวไหนใช้แทนได้บ้าง?

ในหมวดเดียวกันมี Spree Commerce developer docs for AI agents, Stripe MCP, Sessy — Amazon SES observability

ตัวอื่นในหมวดเดียวกัน

server หมวดเดียวกันจากผู้ทำคนอื่น เรียงตามดาว

อ่านการ์ด:↓ ดาวน์โหลดต่อสัปดาห์i★ ดาว GitHubiสามเสา: รีวิว · ผลตรวจ · การใช้งานiอัปเดต = วันที่ส่งรุ่นล่าสุดเข้า registryi

Spree Commerce developer docs for AI agents

Spree Commerce docs for AI coding agents: build headless B2B and marketplace ecommerce on its APIs.

โดย spreeใช้กันมาก★ 15.8K ดาวรวมทั้งรีโปอัปเดต 13 วันที่ผ่านมา

รันบนคลาวด์

Stripe MCP

server ทางการของ Stripe ให้ AI ดูและจัดการลูกค้า สินค้า การชำระเงิน และใบแจ้งหนี้ ต่อผ่านคลาวด์ของ Stripe และล็อกอินแบบ OAuth

โดย stripeใช้กันมาก★ 2.1Kอัปเดต 13 เดือนที่ผ่านมา

รันบนคลาวด์✓ เจ้าของบริการ · stripe.com

Sessy — Amazon SES observability

Read-only Amazon SES observability: search events, inspect bounces, pull delivery stats.

โดย marckohlbruggeกำลังโต★ 945อัปเดต 3 เดือนที่ผ่านมา

รันบนคลาวด์

README จากผู้ทำ

เปิดอ่าน README

ส่วนนี้คัดจาก repo ของผู้ทำตามต้นฉบับ PopNx MCP ไม่ได้ตรวจหรือรับรองเนื้อหา ตัด HTML รูปภาพ และสคริปต์ออกแล้ว ลิงก์จะพาออกนอกเว็บ

Deadlatch

The pre-trade latch for your trading agent. Advisory-only.

Three things you need to know before anything else:

  1. You need an independent, cross-broker gate that you control. If an agent can place orders on your account, the last check between the agent and the broker should not be the agent itself — and it should not be locked to one broker's UI or rules.
  2. Deadlatch does not predict, does not recommend, and does not place orders. It answers one question only: *is this order allowed right now?* It is not a signal generator and it is not a broker.
  3. Every answer comes with reasons, evidence, and a local audit record on Linux/macOS. PASS / WARN / BLOCK is never a bare verdict — you can see which rule hit, why, and what was evaluated. Durable audit writes (init / append / repair / prune / shadow report) are supported on Linux and macOS only. On Windows the package still imports, and the rule engine / Guard / CLI / MCP still compute decisions; those write paths fail closed with audit_platform_unsupported. Offline verify / read of a stopped snapshot remain available. Windows MCP is a limited integration path, not a full trusted audit chain.

Honest boundary (please read): Deadlatch is advisory. It cannot force an agent that never calls it to call it, and it cannot stop an agent that ignores a BLOCK from submitting the order somewhere else. Whether the agent calls the guard and honors the result is the integrator's decision. Do not rely on this tool as a guarantee against loss — it is a gate, not an insurance policy.

Start here

The current install path is the verified PyPI deadlatch==0.1.2, published on 2026-09-22. The stable GitHub v0.1.2 Release targets b072e8a4d4b053e1d5a428dbb9c47e06652fbf4c; its wheel/sdist assets match the PyPI originals.

pip install deadlatch==0.1.2

The published MCP Registry name is io.github.Diabloluo/deadlatch at version 0.1.2, verified active/latest on 2026-09-22. The local server.json matches that published version. The command below starts the verified PyPI package directly.

MCP-first start:

uvx --from deadlatch==0.1.2 deadlatch-mcp --policy policy.yaml --portfolio portfolio.json

--policy and --portfolio are required local files. --audit-path and --kill-switch-path are optional. Use fictional or your own simulated inputs only. Deadlatch is advisory-only: it never places orders and cannot stop an agent that never calls it. Option orders must use the broker's unique full contract code as symbol. A historical GitHub pre-release remains at v0.1.0.dev1; it is not the current install path.

Then:

  1. Run a fictional-data Quick Start below (Python, CLI, or MCP) on Linux or macOS. Confirm PASS → BLOCK → local audit. Windows can import the package and run rule computation; it is not the audit-write Quick Start.
  2. Request a 20-minute integration assessment only if you already have an order-intent or simulated execution path: open the assessment form.

That GitHub issue is public. Do not paste accounts, positions, orders, API keys, tokens, customer names, or private paths. Security defects must go through GitHub Security Advisories, not a public issue.


Quick Start (60 seconds each)

All three quick starts use fictional data and a temporary audit path. They are executed from the same source scripts by the test suite, so they cannot drift from the documentation. Full audit-write / MCP Quick Start requires Linux or macOS. Windows may import the library and evaluate rules; it will not initialize or append a durable audit collection.

1. Python API
pip install dist/deadlatch-*.whl        # or: pip install -e .

python docs/quickstart/python.py

Shows Guard.from_policy(...) → Order / Portfolio → guard.check(...): a valid order returns PASS / 0; an oversized order returns BLOCK / 3 with the hit rules; on BLOCK the example caller stops — no broker call is ever made.

2. CLI
bash docs/quickstart/cli.sh                  # requires `deadlatch` on PATH

Creates fresh inputs in a temp directory (dynamic timestamps — never goes stale), then runs deadlatch check for PASS (exit 0), BLOCK (exit 3), an input error (exit 4), and a --json check, plus shadow report --json over the audit.

3. MCP (stdio)
python docs/quickstart/mcp_client.py         # requires `deadlatch` installed

Starts deadlatch-mcp as a real subprocess over stdio, lists the five tools, and calls check_order once for PASS and once for BLOCK. policy / portfolio / audit paths are server startup configuration — an agent cannot swap them as tool arguments. BLOCK is a constraint the caller must honor; technically the guard cannot force a fully bypassing agent to call it.


What it is / is not

Deadlatch isDeadlatch is not
A local, deterministic risk gate evaluated before you submitA signal generator, recommender, or portfolio optimizer
A library, a CLI, and a stdio MCP server — no broker connectivity, no policy mutationA broker adapter, an execution engine, or a market feed
An auditable check: every evaluation is written to a local JSONL logA cloud service, a database, or a telemetry sink
USD-only, single-leg orders, one snapshot per check (v0.1)Multi-leg, multi-currency, Greeks/IV-aware (see limitations)

Who should use it

  • Teams that already have an order-intent or simulated execution path and want an independent, deterministic pre-trade gate with a local audit trail.
  • Developers who want a small, dependency-light, fail-closed building block they can integrate into their own execution pipeline.
  • Anyone who wants to evaluate orders against a *policy they control*, expressed as plain YAML.

Who should not use it: anyone expecting a profit guarantee, a backtest engine, a portfolio manager, or a tool that enforces itself. If the agent never calls the guard, or ignores a BLOCK, nothing in this repository can stop it.

Core security boundary

  • Local: everything runs on your machine; no account credentials are ever stored, read, or transmitted.
  • No network core path: the library, CLI, and MCP server never open a socket, never register an HTTP/SSE route, and never call out for quotes or anything else (the MCP SDK's HTTP stack is a transitive dependency that business code never imports).
  • Never places orders: the core package (library, CLI, MCP server) has no broker connectivity and never submits orders. Experimental read-only mapping examples exist only in the development workspace; they are not included in the public candidate or the wheel, and they are not live-verified integrations.
  • Fail-closed: missing or malformed data → BLOCK (exit 3); input/config errors → exit 4; internal errors → exit 5. An uncertain state is never reported as PASS.
  • Direction is snapshot-derived: order-side text is never accepted as proof of a close. Stock and option closing intent is recognized only when a fresh portfolio snapshot contains a matching, opposite-side position with sufficient quantity. For options, symbol must be the broker's unique full contract code; never reuse an underlying ticker across different expiries, strikes, or rights.
  • USD-only (v0.1): any currency mismatch (order, portfolio, positions) is an input error (exit 4); the MCP account-status tool fail-closes on mismatch.

Write surface: the tool never modifies policy, portfolio, or kill-switch state, never connects to a broker, and never places an order. Two kinds of intentional local file writes exist:

  1. Audit subsystem: Guard.check() / check_order append one sanitized v2 record to a UTC day shard next to the logical audit path (30-day retention). Append is a bounded tail write under a shared lock; it does not rewrite history. A new collection needs one explicit deadlatch audit init (or initialize_audit_state) before append; Guard/MCP never auto-migrate. deadlatch shadow report and deadlatch audit prune delete whole shard files that fall outside the 30-calendar-day window. deadlatch audit repair --quarantine still uses lock/tmp files and os.replace when it isolates a truncated tail. Ordinary append is not crash-atomic across files. POSIX locks are cross-process. v0.1.2 durable audit writes are Linux/macOS only; Windows writers receive audit_platform_unsupported and do not skip directory fsync to report success.
  2. Explicit migration output: deadlatch migrate --output writes the migrated document only when you explicitly pass --output.

The public contract for these rules, Decimal thresholds, exit codes, and option-symbol requirements is docs/rules-spec.md.

The 12 rules (v0.1)

#RuleWhat it guards
R1kill_switchGlobal switch: off / full (block everything) / reduce_only (allow only inferred closing orders)
R2input_validityOrder passes schema, version gate, currency consistency, finite amounts (violations → exit 4)
R3max_order_quantitySingle-order quantity limit
R4max_order_valueSingle-order notional limit (options: price × multiplier × quantity)
R5max_symbol_exposureExposure per underlying (options by strike × multiplier × quantity)
R6max_total_exposurePortfolio gross exposure ratio
R7cash_margin_checkPost-trade cash floor and short-option margin
R8max_daily_lossDaily loss ratio (PnL / day-start equity)
R9max_drawdownDrawdown ratio from peak
R10order_time_validityOrder age / future timestamps (unparseable → fail-closed BLOCK)
R11data_freshnessPortfolio snapshot freshness (future snapshot → fail-closed)
R12missing_data_fail_closedMissing/null/ill-formed portfolio data → exit 3 (data unusable = risk)

Optional rules (R3–R7) are toggled by their config keys in policy.yaml; a missing optional key must be declared in acknowledged_disabled or the policy is rejected (exit 4). Mandatory rules (R1, R2, R8–R12) can never be disabled.

Exit codes

CodeMeaning
0PASS — the order is allowed as given
2WARN — proceed only if your execution policy explicitly allows warnings
3BLOCK — the order must not be submitted (risk rule or fail-closed data)
4Input / configuration error — the caller misused the API, not a risk event
5Internal / rule exception — treated as BLOCK (fail-closed)

In shadow mode the internal verdict is recorded (shadow_verdict) while the external projection is PASS / 0; kill-switch hits and exit 4/5 are never projected away.

Data contracts & migration

Schemas are versioned JSON Schema 2020-12 files shipped inside the package: order, portfolio, policy, result, audit-record, shadow-report, audit-maintenance-result, audit-prune-result, audit-write-state, audit-state-result. Explicit offline migration is available for legacy documents:

deadlatch migrate --kind order    --input order_v1.json    [--out

ตัดมาแค่ช่วงต้น อ่านต่อใน repo