') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); GitHub - YYHDBL/MyCodeAgent: Claude Code like agent for study. · GitHub
Skip to content

Repository files navigation

MyCodeAgent

MyCodeAgent is a local-first, single-agent Python coding harness. It supplies the reliable machinery around an OpenAI-compatible model: one controlled loop, project-confined tools, permission decisions, bounded context, append-only transcripts, and JSONL traces. It is meant to be installed once and run inside an unrelated repository.

Install

Python 3.10+ and uv are supported.

uv sync --locked --extra dev
uv run mycodeagent --help

For a regular editable install, use python -m pip install -e ".[dev]". pyproject.toml is the dependency authority; the requirements files are generated compatibility exports.

Configure an OpenAI-compatible provider in .env or pass CLI overrides:

LLM_PROVIDER=openaiLLM_MODEL_ID=your-modelLLM_API_KEY=your-key

Use

Start an interactive session in the repository you want to work on:

cd /path/to/project
mycodeagent

The invocation directory is the default project root. Use --cwd when the target is elsewhere:

mycodeagent --cwd /path/to/project -p "inspect the test failure"
mycodeagent --cwd /path/to/project -p "summarize the repository" --json

-p runs one turn and exits. --json writes one machine-readable outcome to standard output. Interactive sessions provide /sessions, /resume [id], and /status; transcripts under the selected project are the resume source. Use Ctrl-C to cancel an active turn safely, then resume it if needed.

Permissions and boundaries

The default schema contains seven tools: Bash, Edit, Glob, Grep, Read, Task, and TodoWrite. Edit is the only file-mutation tool. File paths are confined to the selected project; writes use read snapshots and atomic replacement. Permission policy controls tool requests, but it is not an operating-system sandbox—run the harness only where its process account is appropriate.

The runner is RuntimeRunner. It records lifecycle facts once through the event boundary; the transcript is recovery truth, and the model receives a bounded derived view rather than a second persistent session snapshot.

Optional extensions and lean startup

The normal startup path creates no MCP child process and no verification subagent. It uses lightweight JSONL tracing: each trace ends with a session_summary row containing steps, tools_used, and accumulated token totals. It does not produce HTML reports or expose a generic trace-evaluation API. Local Skills are loaded only when the selected project actually contains skills/**/SKILL.md.

MCP is intentionally absent from the core installation. Install and enable it only when required:

uv sync --locked --extra dev --extra mcp
mycodeagent --enable-mcp

The equivalent compatibility commands are:

uv sync --extra dev --extra mcp
python -m pip install -e ".[dev,mcp]"

The standalone extra is mycodeagent[mcp].

--enable-verification-agent is also an explicit opt-in; when enabled, it constructs the completion verifier without changing default startup. Removed research systems and optional project-memory experiments are not product features; their historical implementations remain discoverable through the research archive.

Verify

uv run ruff check .
uv run ruff check . --select E722,F401,F541,F821,F841
uv run ruff check app core runtime tools extensions prompts utils --select E402
uv run pytest -q
uv run pytest -q tests/extensions/test_mcp_extension.py tests/test_core_without_mcp.py tests/test_mcp_protocol.py
uv run python scripts/check_release_metrics.py

The metrics command remains enforcing with a ≤15,000 stable-source cap and returns nonzero when exceeded. The current 14,094-line release tree passes this policy with bounded headroom; the seven-tool and dependency caps are unchanged. See closeout C-008.

Credentialed provider probes are deliberately excluded from the deterministic suite. Run them only with explicit credentials and RUN_CREDENTIALLED_EVALS=1 uv run pytest -q -m credentialed.

For the current execution flow and invariants, read docs/HARNESS.md. Dated plans, previous design notes, and demo snapshots are in the historical archive.

Non-goals

MyCodeAgent is not an enterprise platform, multi-agent team framework, self-modifying skill laboratory, IDE, web dashboard, remote-worker system, or OS-grade sandbox.

About

Claude Code like agent for study.

Resources

Stars

244 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages