linux

linux is a cursor rule for Cursor from AcKeskin/contexture. It costs 0 tokens per session (1,224 once invoked), scanned A, original, MIT.

A set of Linux rules for safely handling signals, which are notifications such as termination or interrupt requests sent to a process. It also covers signal delivery in multithreaded programs and event loops.

In plain words
What is it for?
It helps implement signal handlers, self-pipes, signalfd-based event loops, and controlled signal handling across threads.
Why use it?
It avoids deadlocks and unpredictable behavior caused by calling unsafe library functions inside signal handlers. It makes signal processing occur in normal application code instead.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc).

Good fit It helps implement signal handlers, self-pipes, signalfd-based event loops, and controlled signal handling across threads.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/ackeskin/contexture/linux
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.

Clone the repo
git clone --depth 1 https://github.com/AcKeskin/contexture

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for linux

README.md
[![agentmods](https://agentmods.dev/badge/rules/ackeskin/contexture/linux/github.svg)](https://agentmods.dev/rules/ackeskin/contexture/linux)
Your own site
<a href="https://agentmods.dev/rules/ackeskin/contexture/linux"><img src="https://agentmods.dev/badge/rules/ackeskin/contexture/linux/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for linux

Your own site · 80×15
<a href="https://agentmods.dev/rules/ackeskin/contexture/linux"><img src="https://agentmods.dev/badge/rules/ackeskin/contexture/linux.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 1,224 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00000 $0.01224
Opus 5.5 $0.00000 $0.00490
Sonnet 5.5 $0.00000 $0.00245
Haiku 4.5 $0.00000 $0.00122

Measured today against content hash eff8b6e0e522, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

linux 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 today.

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.

cursor/rules/linux.mdc · 52 lines

How it starts

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

Generated from architectural-rules/linux/ — do not hand-edit.

ipc-and-signals

In a signal handler, call ONLY functions listed in the async-signal-safe set (man 7 signal-safety); malloc, printf, and most libc functions are NOT safe — they may hold internal locks that the signal interrupted, causing deadlock. (man 7 signal-safety, POSIX.1-2017 §2.4.3)

Handle signals in the main event loop, not inside handlers: write a byte to a self-pipe in the handler and poll/epoll the read end, or block the signal set with pthread_sigmask(SIG_BLOCK, ...) and create a signalfd(2) over that same mask to receive signals as readable events (without the block, the default disposition still fires and the fd never sees them); this keeps all logic outside the async-signal-safe constraint. (man 2 signalfd, man 7 signal-safety)

In multithreaded programs, use pthread_sigmask to block signals in worker threads and deliver them to exactly one designated thread (or via signalfd); signal delivery to an arbitrary thread is uncontrollable and races with thread-local state. (man 3 pthread_sigmask, POSIX.1-2017 §2.4.1)

With epoll in edge-triggered mode (EPOLLET), drain the fd completely (read/recv until EAGAIN/EWOULDBLOCK) on each event; a single partial read leaves data in the buffer and suppresses future notifications, causing silent stall. (man 7 epoll — "Edge-triggered and level-triggered")

Never busy-wait on a fd or condition; use epoll/poll/select or a condition variable; busy-waiting starves other threads, pins a CPU core, and masks the actual blocking event. (POSIX.1-2017 §2.8.5, man 7 epoll)

Prefer signalfd over sigaction in event-loop programs; signalfd integrates into a unified epoll watch set, removing the need for careful async-signal-safe bookkeeping entirely. (man 2 signalfd)

Why: Signal handlers execute in an interrupted execution context where most libc internals are unsafe to call. The self-pipe trick is the portable pattern; signalfd(2) is the Linux-specific equivalent for bridging asynchronous signal delivery into synchronous event-loop code. Multithreaded signal delivery has undefined target-thread semantics unless masked and routed explicitly. Source: Linux man-pages / POSIX.

Read the full file on GitHub · 52 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. today First seen · 52 lines · 1,224 tokens per session scan A eff8b6e0e522

Subscribe to this mod's changes

linux is a cursor rule published in the GitHub repository AcKeskin/contexture (2 stars, last pushed yesterday), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,224 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-10-27.