How joyce0101/safe_cell works
Safe Cell is an AI-assisted factory-cell control project with MDP as the safety boundary between AI requests and press/conveyor hardware. The main workflow is a user request reaching an AI backend, which uses a restricted MCP interface to inspect or simulate station actions; MDP enforces safety before hardware actuation. Rulebook authoring/submission and audit utilities are supporting workflows. Firmware and some safety details are represented from README/tree evidence; their internal wiring is not shown in the excerpts.
Main entry points: server.py Safe MCP tools · service.py Chat API · gen_rulebook.py Rulebook generator · rulebook_tools.py Rulebook drafts
Components 17
AI interfaces
- Chat API
software/backend/service.py - Qwen backend
software/backend/service.py - Claude backend
software/backend/service_claude.py - AI service
ai_backend/service.py
MDP access
- Safe MCP tools
software/mcp_server/server.py - MDP client
software/mdp_client/client.py - Safety engine
ai_backend/safety_engine.py
Safety contracts
- Device contracts
contracts - Rulebook generator
hardware/tools/gen_rulebook.py - Rulebook drafts
software/backend/rulebook_tools.py
Cell hardware
- Press firmware
hardware/firmware/cell_uno - Conveyor firmware
hardware/firmware/cell_ble - Wi-Fi firmware
hardware/firmware/cell_wifi
Operations
- Rule manager
ai_backend/rule_manager.py - Audit manager
ai_backend/audit_manager.py
Other components
- Operator
- MDP station
Connections 16
- Operator → Chat API: sends request
software/backend/service.py - Chat API → Qwen backend: handles chat
software/backend/service.py - Chat API → Safe MCP tools: calls tools
software/backend/service.py - Claude backend → Safe MCP tools: calls tools
software/backend/service_claude.py - Safe MCP tools → MDP client: uses client
software/mcp_server/server.py - MDP client → MDP station: sends MCP requests
- MDP station → Safety engine: checks policy
- MDP station → Press firmware: dispatches actions
- MDP station → Conveyor firmware: dispatches actions
- MDP station → Wi-Fi firmware: dispatches actions
- Rulebook generator → Device contracts: generates rulebooks
hardware/tools/gen_rulebook.py - Safe MCP tools → Rulebook generator: generates rulebooks
software/mcp_server/server.py - Rulebook drafts → Rulebook generator: references generator
software/backend/rulebook_tools.py - Rulebook drafts → MDP station: submits drafts
software/backend/rulebook_tools.py - Rule manager → AI service: imports service
ai_backend/rule_manager.py - Audit manager → AI service: uses service
ai_backend/audit_manager.py