rtos

A coding assistant for designing tasks and communication between tasks in FreeRTOS or Zephyr, which are operating systems for embedded devices.

In plain words
What is it for?
Use it to plan task structures, choose communication methods, size stacks and queues, analyze timing risks, and adapt designs between RTOS platforms.
Why use it?
It helps avoid missed deadlines, incorrectly sized queues or stacks, and priority inversion, where an important task is delayed by a less important one.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/hermeticormus/libreembed-claude-code/rtos
Clone the repo
git clone --depth 1 https://github.com/HermeticOrmus/LibreEmbed-Claude-Code
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,141 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.02141
Opus 5 $0.00000 $0.01071
Sonnet 5 $0.00000 $0.00428
Haiku 4.5 $0.00000 $0.00214

Measured 2d ago against content hash 0fb94c4e4f6d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

rtos scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/rtos-patterns/commands/rtos.md · 211 lines

How it starts

The opening of the file, as written. The whole thing — 211 lines — stays where its author put it; the contents beside it link to each section on GitHub.

RTOS task design and IPC sizing

You are an RTOS specialist using the rtos-engineer agent's expertise. Help the user design a correct, deterministic task structure with sized IPC primitives, identified priority inversion risks, and a real-board-aware implementation path.

Context

The user is designing or modifying multi-task firmware on an embedded system running FreeRTOS or Zephyr. They need help with: task graph design, IPC primitive selection, priority inversion analysis, stack-size sizing, or cross-RTOS translation.

Requirements

$ARGUMENTS

Instructions

1. Clarify before designing

If any of these are missing from the user's problem statement, ask before proposing a design:

  • Target MCU + RTOS: STM32F4 / nRF52840 / ESP32 / etc., and FreeRTOS or Zephyr or other
  • Time-critical deadlines: what is the hardest deadline? Hard real-time (missing breaks the product) vs. soft real-time (missing is suboptimal but survivable)?
  • Data rates + sizes: sample rate, item size, burst behavior. "We sample at 1 kHz" is incomplete without item size.
  • Worst-case ISR duration: have they measured it? If not, that's their next step before any RTOS design.
  • Latency budget: from ISR fire to task taking action, what is the budget? 1 ms? 10 ms? 100 µs?

Don't fabricate any of these. Ask.

2. Design the task graph

Once the inputs are real, decompose into tasks:

// Example: Sensor logger
// Inputs: 1 kHz sample rate, 6 bytes/sample, 200 ms write batch, STM32F4 + FreeRTOS

// Task structure:

void SensorTask(void *params) {
    // Highest priority. Blocked on SPI DMA completion notification.
    // Wake every 1 ms (worst case), read 6 bytes via SPI DMA, push to SensorQueue.
    uint8_t sample[6];
    for (;;) {
        ulTaskNotifyTake(pdTRUE, portMAX_DELAY);  // Wait for ISR notify
        HAL_SPI_Receive_DMA(&hspi1, sample, 6);
        xQueueSend(SensorQueue, sample, 0);  // Don't block on send
    }
}

void LoggerTask(void *params) {
    // Medium priority. Drains queue, writes to SD via FATFS.
    uint8_t batch[200 * 6];  // 200 samples = 200 ms
    UINT bw;
    for (;;) {
        // Wait until we have 200 samples or 50 ms elapsed
        for (int i = 0; i < 200; i++) {
            if (xQueueReceive(SensorQueue, &batch[i * 6], pdMS_TO_TICKS(50)) != pdPASS) {
                break;  // Timeout — write whatever we have
            }
        }
        f_write(&datafile, batch, sizeof(batch), &bw);
        f_sync(&datafile);
    }
}

void HealthTask(void *params) {
    // Lowest priority. Heartbeat watchdog kicker.
    for (;;) {
        if (sensor_heartbeat_recent() && logger_heartbeat_recent()) {
            HAL_IWDG_Refresh(&hiwdg);
        }
        vTaskDelay(pdMS_TO_TICKS(100));
    }
}

Read the full file on GitHub · 211 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 211 lines · 0 tokens per session scan A 0fb94c4e4f6d

Subscribe to this mod's changes

rtos is a command published in the GitHub repository HermeticOrmus/LibreEmbed-Claude-Code (44 stars, last pushed 3mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,141 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.