Codesys-MCP: Instructions file for Claude Code

CLAUDE.md

Codesys-MCP CLAUDE.md is an instructions file for Claude Code from luke-harriman/Codesys-MCP. It costs 5,180 tokens per session, scanned A, original, MIT.

Repository instructions for Codesys-MCP, a server that exposes the CODESYS V3.5 industrial-automation IDE's scripting functions as tools. They explain its Windows-only setup, architecture, delivery process, and known version limits.

In plain words
What is it for?
Use them when developing or debugging Codesys-MCP, its scripts, persistent mode, headless mode, or its integration with CODESYS V3.5.
Why use it?
They warn the coding agent about constraints that are easy to miss, including which CODESYS versions work with persistent mode. This helps avoid changes that conflict with the project's design or runtime.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: mentions CLAUDE.md.

This is luke-harriman/Codesys-MCP's own configuration. It tells Claude Code how to work on Codesys-MCP itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything Codesys-MCP configures →

Reuse

Borrowing it

Nothing to install: this file belongs to luke-harriman/Codesys-MCP. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/luke-harriman/Codesys-MCP/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/luke-harriman/Codesys-MCP

Made for: Claude Code.

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 Codesys-MCP CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/luke-harriman/codesys-mcp/claude-md/github.svg)](https://agentmods.dev/instructions/luke-harriman/codesys-mcp/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/luke-harriman/codesys-mcp/claude-md"><img src="https://agentmods.dev/badge/instructions/luke-harriman/codesys-mcp/claude-md/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 Codesys-MCP CLAUDE.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/luke-harriman/codesys-mcp/claude-md"><img src="https://agentmods.dev/badge/instructions/luke-harriman/codesys-mcp/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 5,180 This file is loaded in full into every session.
When invoked 5,180 The same file — it is already loaded in full.
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.05180 $0.05180
Opus 5 $0.02590 $0.02590
Sonnet 5 $0.01036 $0.01036
Haiku 4.5 $0.00518 $0.00518

Measured 9d ago against content hash d1dd456d39c5, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

Codesys-MCP CLAUDE.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 9d 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.

CLAUDE.md · 177 lines

How it starts

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

CLAUDE.md - codesys-mcp-persistent

Orientation for a future Claude / agent session working on this repo. Read first.

What this is

codesys-mcp-persistent is an MCP server that wraps the CODESYS V3.5 IDE scripting API (IronPython 2.7) as MCP tools. Owned/maintained by Luke Harriman (luke-harriman on GitHub). Drop-in superset of @codesys/mcp-toolkit.

  • Target runtime: Windows + CODESYS V3.5 SP19 / SP20 + Node 18+. Not portable.
  • SP21+ persistent mode is currently broken. The watcher's se.system.execute_on_primary_thread() call no longer exists in SP21 P5 / SP22 P1 (and possibly earlier patches — SP21 P3 release note CDS-94322 "Scripting: Context object for Python calls needed" is the closest paper trail but unconfirmed). Symptom: every persistent-mode tool call returns Marshal error: The functionality 'system.execute_on_primary_thread(...)' is no longer supported. Headless mode (--noUI per command) is unaffected. The fix is well-understood (single-thread watcher + se.system.delay() between polls — see phobicdotno/Codesys-MCP-SP21-plus v0.4.2 for the reference implementation) but not yet adopted here. See known pitfall #12 and the deferred-work entry.
  • Wire format: stdio JSON-RPC (MCP) on the outside; file-based IPC on the inside.
  • Two execution modes: persistent (CODESYS UI stays open, watcher.py running, commands marshalled onto its primary thread) and headless (--noUI spawn-per-command). Persistent is the point of the project; headless is the bootstrap + fallback (and the only SP21+-compatible mode until the watcher rewrite lands).

Read README.md for tool surface, ARCHITECTURE.md for IPC details, CHANGELOG.md for the per-version journey.

Hard architectural constraints (don't fight these)

  1. IronPython 2.7 inside CODESYS. Scripts run there, not in CPython. No f"" strings, no print() parens, no nonlocal, unicode is a separate type from str, ints can be long, range() returns a list. The default json.dumps(..., ensure_ascii=True) calls a defective decode path that crashes on cp1252 bytes - always use ensure_ascii=False and emit utf-8 via _text_utils.emit_result().
  2. ASCII-only Python source (no # -*- coding -*- header in current scripts). Em-dashes, smart quotes, § are forbidden in source. The static checker dev/check-scripts.ps1 enforces this; run it before every commit.
  3. CODESYS scripting API is single-threaded. Current watcher marshals from a .NET background thread onto the IDE's primary UI thread via se.system.execute_on_primary_thread() (src/scripts/watcher.py:230). A long-running script (regex DoS, big bulk read) freezes the IDE. This API was removed in SP21+ — see pitfall #12. The forward fix runs the watcher directly on the primary thread and yields via se.system.delay() between polls; the IDE stays interactive because system.delay() services the message loop. Until that rewrite ships, SP21+ users must run with --mode headless.
  4. scriptengine.online ops need an executor frame on real PLCs. create_online_application, oa.login, oa.start, oa.read_value, oa.set_prepared_value, etc. raise InvalidOperationException: Stack empty. from a pure IPC-driven script — the IDE-internal _executionStack is only populated by the script executor's Executing event, which the IPC bridge bypasses. Fixed in 0.6.3 by ensure_online_connection.py: reflects into scriptengine.online._executor and routes every online call through its public ExecuteSource(source) method (see with_executor). When writing a new online tool, wrap each online_app.X(...) call in with_executor(online_app.X, ...args) — without it the call hits Stack empty on real PLCs.
  5. set_pou_code auto-saves to disk. UI Ctrl+Z does NOT recover prior content. Read before overwriting; treat the project file as the source of truth, not the IDE buffer.

Read the full file on GitHub · 177 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. 9d ago First seen · 177 lines · 5,180 tokens per session scan A d1dd456d39c5

Subscribe to this mod's changes

Codesys-MCP CLAUDE.md is an instructions file published in the GitHub repository luke-harriman/Codesys-MCP (73 stars, last pushed 3mo ago), licensed MIT. It adds 5,180 tokens to every session, about $0.0259 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-30.

Related

Other instructions, from other repositories

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,296 tokens

codex AGENTS.md

AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.

openai/codex · 5,153 tokens

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 6,785 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).

microsoft/vscode · 5,001 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,469 tokens

deepseek-harness AGENTS.md

AGENTS.md instructions for deepseek-ai/deepseek-harness, covering agents.md, pre-stable apis and released session data, repository layout, commands and host sandbox failures.

deepseek-ai/deepseek-harness · 3,737 tokens