contexture linux.instructions.md

Project rules for Linux programming, covering signals, inter-process communication, file descriptors, system calls, and error handling.

In plain words
What is it for?
Use them when editing Linux code that handles signals, event loops, threads, file descriptors, or low-level system calls.
Why use it?
They help avoid unsafe signal-handler code, uncontrolled signal delivery, resource mistakes, and incorrect handling of operating-system errors.

Instructions file for GitHub Copilot

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 instructions/ackeskin/contexture/linux
Clone the repo
git clone --depth 1 https://github.com/AcKeskin/contexture

Made for: GitHub Copilot.

Per session 1,227 This file is loaded in full into every session.
When invoked 1,227 The same file — it is already loaded in full.
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.01227 $0.01227
Opus 5 $0.00613 $0.00613
Sonnet 5 $0.00245 $0.00245
Haiku 4.5 $0.00123 $0.00123

Measured yesterday against content hash a6326c65c029, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

contexture linux.instructions.md 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 yesterday.

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.

.github/instructions/linux.instructions.md · 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.

linux rules

Auto-loaded by Copilot when editing files matching **. 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. yesterday First seen · 52 lines · 1,227 tokens per session scan A a6326c65c029

Subscribe to this mod's changes

contexture linux.instructions.md is an instructions file published in the GitHub repository AcKeskin/contexture (2 stars, last pushed 1mo ago), licensed MIT. It adds 1,227 tokens to every session, about $0.0061 per session on Opus 5. 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-31.