π This post is now archived. For the latest updates on SENTINEL, see the new consolidated article:
SENTINEL Platform β Complete AI Security Toolkit (2026 Update Log)
From 600 lines to 18,599: I went all-in on Pure C for AI security.
Here's exactly what I built in 4 days β every file, every line.
Four days ago, I published a post about replacing my Go gateway with 600 lines of C. The response blew my mind β our dev.to following grew 10x in under a week.
Today, I'm sharing exactly what I built since then. Every file. Every line. Every late-night decision.
TL;DR: The Numbers
| Metric | Before (Jan 1) | After (Jan 5) | Delta |
|---|---|---|---|
| Files changed | β | 112 | +112 |
| Lines added | β | 18,599 | +18,599 |
| Lines deleted | β | 2,119 | -2,119 |
| CLI Commands | 194 | ~199 | +5 |
| LOC total | 23K | 28K+ | +5K |
| Academy Modules | 16 | 22 | +6 |
Let me break down what actually happened.
Day 1-2: Phase 4 Core Modules
ThreatHunter β Proactive Threat Hunting
Not just waiting for attacks. Actively hunting them.
// src/core/threat_hunter.c
typedef struct threat_hunter_config {
bool hunt_ioc; // Indicators of Compromise
bool hunt_behavioral; // Behavioral analysis
bool hunt_anomaly; // Anomaly detection
float sensitivity; // 0.0 - 1.0
} threat_hunter_config_t;
shield_err_t threat_hunter_start_hunt(threat_hunter_t *th);
Why? Most security tools are reactive. ThreatHunter runs continuous sweeps looking for patterns that might become attacks.
Honest status: Architecture done, ML integration pending.
Watchdog β System Health Monitor
// src/core/watchdog.c
typedef struct watchdog_state {
module_state_t state;
bool auto_recovery;
uint32_t check_interval_ms;
float system_health; // 0.0 - 1.0
uint64_t recoveries_attempted;
} watchdog_state_t;
Monitors all Shield subsystems. If something dies, it brings it back.
Real CLI output:
Shield# watchdog enable
Shield# watchdog auto-recovery enable
Watchdog: monitoring 6 components
PQC β Post-Quantum Cryptography
// src/core/pqc.c
typedef struct pqc_state {
module_state_t state;
bool kyber_available; // Key encapsulation
bool dilithium_available; // Digital signatures
} pqc_state_t;
NIST Level 5 stubs. When quantum computers break RSA, we're ready.
Honest status: Stubs only. Real Kyber/Dilithium integration requires linking liboqs.
Cognitive Signatures β Pattern Recognition
7 signature types for detecting attack patterns:
- Syntactic β Keyword matching
- Semantic β Meaning analysis
- Temporal β Time-based patterns
- Entropy β Randomness detection
- Behavioral β Action sequences
- Contextual β Environment awareness
- Adaptive β Learning patterns
typedef enum cognitive_sig_type {
COG_SIG_SYNTACTIC,
COG_SIG_SEMANTIC,
COG_SIG_TEMPORAL,
COG_SIG_ENTROPY,
COG_SIG_BEHAVIORAL,
COG_SIG_CONTEXTUAL,
COG_SIG_ADAPTIVE
} cognitive_sig_type_t;
Day 2-3: Shield State Persistence
The biggest user-facing improvement: your configuration survives restarts.
Before
Shield# guard enable all
Shield# threat-hunter sensitivity 0.8
# ... restart ...
# Everything gone. Start over.
After
Shield# guard enable all
Shield# threat-hunter sensitivity 0.8
Shield# write memory
Building configuration...
[OK] Configuration saved to startup-config.conf
# ... restart ...
Shield# show running-config
! Configuration restored
threat-hunter enable
threat-hunter sensitivity 0.8
guard enable all
The Implementation
// include/shield_state.h
typedef struct shield_state {
threat_hunter_state_t threat_hunter;
watchdog_state_t watchdog;
cognitive_state_t cognitive;
pqc_state_t pqc;
guards_state_t guards;
system_config_t config;
bool config_modified; // Dirty flag
} shield_state_t;
// Singleton access
shield_state_t *shield_state_get(void);
shield_err_t shield_state_save(const char *path);
shield_err_t shield_state_load(const char *path);
INI-style config files. Human-readable. Git-friendly.
Day 3: CLI Expansion β From 194 to ~199 Commands
New Command Files
-
cmd_system.cβwrite memory,copy running-config,reload -
cmd_security.cβ Canaries, blocklists, rate limiting -
cmd_network.cβ Interface management
New Phase 4 Commands
threat-hunter enable
threat-hunter sensitivity <0.0-1.0>
threat-hunter mode <ioc|behavioral|anomaly>
no threat-hunter enable
watchdog enable
watchdog auto-recovery enable
watchdog interval <ms>
show watchdog status
cognitive enable
pqc enable
write memory
copy running-config startup-config
Every command is Cisco-style. Tab completion. Context help with ?.
Day 3-4: SENTINEL Academy β Full Localization
22 modules. English AND Russian. Because security knowledge shouldn't have language barriers.
New Modules (17-22)
| Module | EN | RU | Topic |
|---|---|---|---|
| 17 | β | β | ThreatHunter deep-dive |
| 18 | β | β | Watchdog configuration |
| 19 | β | β | Cognitive Signatures |
| 20 | β | β | Post-Quantum Cryptography |
| 21 | β | β | Shield State management |
| 22 | β | β | Advanced CLI techniques |
Exam Bank & Labs
- +25 new exam questions covering Phase 4
-
+6 new hands-on labs
- Lab 17: ThreatHunter sweep
- Lab 18: Watchdog recovery scenario
- Lab 19: Cognitive signature creation
- Lab 20: PQC key generation
- Lab 21: State persistence testing
- Lab 22: CLI scripting
Day 4: E2E Test Harness
48+ tests. Every CLI command category covered.
// tests/test_cli.c
static void test_guard_enable_llm(void) {
TEST_START("guard enable llm");
cli_set_mode(g_ctx, CLI_MODE_CONFIG);
shield_err_t err = exec_cmd("guard enable llm");
ASSERT_EQ(err, SHIELD_OK, "guard enable llm failed");
shield_state_t *state = shield_state_get();
ASSERT_EQ(state->guards.llm.state, MODULE_ENABLED,
"llm guard not enabled");
TEST_PASS();
}
Test Categories:
- Show commands (15 tests)
- Guard commands (8 tests)
- Phase 4 modules (7 tests)
- State persistence (3 tests)
- Debug commands (2 tests)
- Mode transitions (2 tests)
Run with:
make test_cli
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Total Tests: 48
Passed: 48
Failed: 0
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
ALL CLI E2E TESTS PASSED
Complete File Manifest
New Source Files (35 files)
Core modules:
src/core/threat_hunter.csrc/core/watchdog.csrc/core/cognitive_sig.csrc/core/pqc.csrc/core/shield_state.csrc/core/http_client.csrc/core/secure_comm.csrc/core/stubs.c
CLI commands:
src/cli/cmd_system.csrc/cli/cmd_security.csrc/cli/cmd_network.c
Headers:
include/shield_state.hinclude/shield_policy.hinclude/shield_protocol.h
Academy (12 modules):
-
docs/academy/en/MODULE_17_THREAT_HUNTER.mdthroughMODULE_22_CLI_ADVANCED.md -
docs/academy/ru/MODULE_17_THREAT_HUNTER.mdthroughMODULE_22_CLI_ADVANCED.md
Tests:
-
tests/test_cli.cβ E2E test harness -
tests/test_sllm.cβ SLLM protocol tests
Modified Files (77 files)
All 6 guards updated, 14 protocols updated, 10 headers updated, 13 CLI files updated.
What's Still Missing (Honesty Section)
I believe in transparency. Here's what Shield is NOT yet:
| Component | Status | What's needed |
|---|---|---|
| REST API Server | β | Full HTTP endpoint handling |
| mTLS | β | OpenSSL/mbedTLS integration |
| Real ML in Guards | β | Brain FFI integration |
| Fuzzing | β | AFL/libFuzzer campaign |
| Memory Sanitizers | β | ASan/MSan/UBSan passes |
| Production Docker | β | Hardened container |
Shield is a production-grade ARCHITECTURE, not yet a production-ready PRODUCT.
The foundation is solid. The protocols work. The CLI is complete. But ML integration and HTTP serving are still in development.
What's Next?
- Brain FFI β Connect Python ML engines to C guards
- REST API β Full HTTP server with OpenAPI spec
- CI/CD β GitHub Actions with test matrix
- Fuzzing β AFL++ campaign for security validation
Try It Yourself
git clone https://github.com/DmitrL-dev/AISecurity.git
cd AISecurity/sentinel-community/shield
make
./build/shield
Shield# show version
SENTINEL Shield v4.1 "Dragon"
112 files | 28K LOC | 20 protocols | ~199 commands
Shield# configure terminal
Shield(config)# guard enable all
Shield(config)# threat-hunter enable
Shield(config)# write memory
The Real Lesson
Transparency builds trust faster than perfection.
I could've waited until everything was "done." Instead, I'm sharing the messy middle. The stubs. The honest status. The late-night typing.
Our audience grew 10x not because the code is perfect β but because it's real.
Star β the repo: github.com/DmitrL-dev/AISecurity
Questions? Drop a comment or DM @DmLabincev
Tags: #c #security #ai #opensource
Top comments (0)