aai-coding 0.1.1__tar.gz → 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {aai_coding-0.1.1 → aai_coding-0.1.2}/PKG-INFO +10 -18
- {aai_coding-0.1.1 → aai_coding-0.1.2}/README.md +7 -12
- aai_coding-0.1.2/aai_coding/__init__.py +2 -0
- {aai_coding-0.1.1 → aai_coding-0.1.2}/aai_coding/claudesub.py +2 -0
- {aai_coding-0.1.1 → aai_coding-0.1.2}/aai_coding/harness.py +258 -43
- {aai_coding-0.1.1 → aai_coding-0.1.2}/aai_coding.egg-info/PKG-INFO +10 -18
- {aai_coding-0.1.1 → aai_coding-0.1.2}/aai_coding.egg-info/SOURCES.txt +1 -12
- aai_coding-0.1.2/aai_coding.egg-info/entry_points.txt +6 -0
- aai_coding-0.1.2/aai_coding.egg-info/requires.txt +5 -0
- {aai_coding-0.1.1 → aai_coding-0.1.2}/pyproject.toml +2 -15
- aai_coding-0.1.1/aai_coding/__init__.py +0 -2
- aai_coding-0.1.1/aai_coding/_writing.py +0 -44
- aai_coding-0.1.1/aai_coding/coding_patterns.py +0 -89
- aai_coding-0.1.1/aai_coding/llms.py +0 -40
- aai_coding-0.1.1/aai_coding/nbreview.py +0 -88
- aai_coding-0.1.1/aai_coding/understand.py +0 -50
- aai_coding-0.1.1/aai_coding/vision.py +0 -146
- aai_coding-0.1.1/aai_coding/write_docs.py +0 -93
- aai_coding-0.1.1/aai_coding/write_llms.py +0 -90
- aai_coding-0.1.1/aai_coding/write_prose.py +0 -74
- aai_coding-0.1.1/aai_coding/write_summary.py +0 -50
- aai_coding-0.1.1/aai_coding.egg-info/entry_points.txt +0 -14
- aai_coding-0.1.1/aai_coding.egg-info/requires.txt +0 -9
- aai_coding-0.1.1/tests/test_vision.py +0 -42
- {aai_coding-0.1.1 → aai_coding-0.1.2}/LICENSE +0 -0
- {aai_coding-0.1.1 → aai_coding-0.1.2}/aai_coding/harness_docs.py +0 -0
- {aai_coding-0.1.1 → aai_coding-0.1.2}/aai_coding.egg-info/dependency_links.txt +0 -0
- {aai_coding-0.1.1 → aai_coding-0.1.2}/aai_coding.egg-info/top_level.txt +0 -0
- {aai_coding-0.1.1 → aai_coding-0.1.2}/setup.cfg +0 -0
- {aai_coding-0.1.1 → aai_coding-0.1.2}/tests/test_startup.py +0 -0
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: aai-coding
|
|
3
|
-
Version: 0.1.
|
|
4
|
-
Summary:
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: Shared configuration, hooks, prompts, and skills for Answer.AI coding sessions
|
|
5
5
|
Author: aai-coding contributors
|
|
6
6
|
License-Expression: Apache-2.0
|
|
7
7
|
Project-URL: Homepage, https://github.com/AnswerDotAI/aai-coding
|
|
8
|
+
Project-URL: Documentation, https://AnswerDotAI.github.io/aai-coding/
|
|
8
9
|
Classifier: Programming Language :: Python :: 3
|
|
9
10
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
10
11
|
Requires-Python: >=3.11
|
|
11
12
|
Description-Content-Type: text/markdown
|
|
12
13
|
License-File: LICENSE
|
|
13
|
-
Requires-Dist: pypdfium2>=5
|
|
14
|
-
Requires-Dist: pyvips[binary]>=3
|
|
15
|
-
Requires-Dist: python-fastllm>=0.0.75
|
|
16
|
-
Requires-Dist: pyskills>=0.0.35
|
|
17
14
|
Provides-Extra: dev
|
|
18
15
|
Requires-Dist: fastship; extra == "dev"
|
|
19
16
|
Requires-Dist: build; extra == "dev"
|
|
@@ -52,7 +49,7 @@ Claude Code, Codex, and Antigravity use persistent kernels for Python, file insp
|
|
|
52
49
|
|
|
53
50
|
Run ordinary Claude Code, Codex, or Antigravity with `clikernel-mcp` registered as an MCP server. Each agent has its own kernel and Python state. Claude Code and Antigravity use `clikernel-hook` to isolate callers on a shared MCP connection (subagents in Claude Code; all conversations and subagents in Antigravity). Codex isolates its MCP sessions without that hook.
|
|
54
51
|
|
|
55
|
-
Claude Code uses the `persistent-python` and `pyskills` host skills. Codex and Antigravity use `kernel-notebook-editing` from `skills/clikernel`,
|
|
52
|
+
Claude Code uses the `persistent-python` and `pyskills` host skills. Codex and Antigravity use `kernel-notebook-editing` from `skills/clikernel`, `cli-notebook-editing` only when the user explicitly requests working without a kernel, and `better_swarm` for Antigravity swarm orchestration. Antigravity packages its MCP server, hooks, skills, and `core.md` as one global plugin at `~/.gemini/config/plugins/aai-coding/`. The setup steps link the existing skills without changing them.
|
|
56
53
|
|
|
57
54
|
Task guidance is in pyskills. A pyskill is a Python module docstring, listed by `list_pyskills()` and read with `doc()`. Pyskills are versioned, released, and installed with their Python packages.
|
|
58
55
|
|
|
@@ -60,7 +57,7 @@ Task guidance is in pyskills. A pyskill is a Python module docstring, listed by
|
|
|
60
57
|
|
|
61
58
|
The repository contains:
|
|
62
59
|
|
|
63
|
-
- `aai_coding/`: Python
|
|
60
|
+
- `aai_coding/`: harness-specific Python modules (`harness_docs`, `aai-hook`, and `claudesub`), listed below.
|
|
64
61
|
- `skills/`: host-level `SKILL.md` sources linked into each harness's skills directory. [SETUP.md](SETUP.md#5-skills-safecmd-and-prompts) lists the links.
|
|
65
62
|
- `plugins/safecmd/`: a Claude Code plugin that auto-approves allowlisted Bash commands using the `safecmd` package.
|
|
66
63
|
- `prompts/`: shared behavioural rules and a replacement Claude Code system prompt, described below.
|
|
@@ -68,20 +65,15 @@ The repository contains:
|
|
|
68
65
|
|
|
69
66
|
### Python modules
|
|
70
67
|
|
|
71
|
-
- `coding_patterns` covers coding style, testing judgment, and team policy. Kernel startup imports it and tells the agent to read it with `doc(acp)`.
|
|
72
|
-
- `nbreview` guides notebook style reviews, including chkstyle findings, method extraction, lessons, and testing judgment. It builds on `nbdev.skill` and `coding_patterns`.
|
|
73
|
-
- `write_prose` covers anti-slop rules for narrative prose.
|
|
74
|
-
- `write_docs` covers plain reference prose for docstrings, READMEs, and PRs.
|
|
75
|
-
- `write_summary` covers summaries that a reader can use without the source.
|
|
76
|
-
- `write_llms` covers files that an LLM reads: `llms.txt` files, pyskill docstrings, setup runbooks, and prompts.
|
|
77
68
|
- `harness_docs` explains how to find official harness documentation through `llms.txt`.
|
|
78
|
-
- `vision` describes and transcribes images and PDFs through fastllm, without tools. `look` answers questions; `transcribe` saves Markdown and returns usage, timing and cost.
|
|
79
|
-
- `understand` covers building and holding a Theory (Naur, Socrates, Knoblich et al., Lakatos) before proposing, changing, or reviewing code or designs.
|
|
80
69
|
- `harness` implements hooks for Claude Code, Codex, and Antigravity through the `aai-hook` CLI. It is not a pyskill.
|
|
70
|
+
- `claudesub` launches headless Claude child sessions from a compacted parent transcript.
|
|
71
|
+
|
|
72
|
+
Reusable coding, writing, understanding, and vision pyskills (`coding_patterns`, `nbreview`, `write_prose`, `write_docs`, `write_summary`, `write_llms`, `understand`, `vision`) live in [aai-pyskills](https://github.com/AnswerDotAI/aai-pyskills).
|
|
81
73
|
|
|
82
74
|
### Prompts
|
|
83
75
|
|
|
84
|
-
`prompts/core.md` contains harness-neutral behavioural rules. Codex reads shared and personal rules from `~/.codex/AGENTS.md`, symlinked to `core.md` or merged into an existing personal file. Claude Code appends `core.md` to its system prompt. Antigravity loads `core.md` from `rules/AGENTS.md` and `prompts/agy-kernel.md` (its always-on kernel-first and
|
|
76
|
+
`prompts/core.md` contains harness-neutral behavioural rules. Codex reads shared and personal rules from `~/.codex/AGENTS.md`, symlinked to `core.md` or merged into an existing personal file. Claude Code appends `core.md` to its system prompt. Antigravity loads `core.md` from `rules/AGENTS.md` and `prompts/agy-kernel.md` (its always-on kernel-first rule and `better_swarm` trigger) from `rules/GEMINI.md` inside its global plugin, and has no flag to replace its built-in system prompt.
|
|
85
77
|
|
|
86
78
|
`prompts/sysp.md` replaces Claude Code's default system prompt. It aims to reduce the default prompt's tendency to give consultant-style advice and act without sufficient justification. Launch with:
|
|
87
79
|
|
|
@@ -107,4 +99,4 @@ You do not need to start the harness manually each day. Sessions use the skills
|
|
|
107
99
|
|
|
108
100
|
To change a skill, edit its source in this checkout. Others receive the changes by pulling. Release with the standard fastship command, `ship-release`. Bump the version in `aai_coding/__init__.py` after each release.
|
|
109
101
|
|
|
110
|
-
Tests cover substantive logic where hidden errors are realistic: event ordering, accumulated state, duplicate suppression
|
|
102
|
+
Tests cover substantive logic where hidden errors are realistic: event ordering, accumulated state, and duplicate suppression. Do not add tests for prompt wording, straightforward dispatch, or trivial configuration branches. Run the tests with `pytest`.
|
|
@@ -30,7 +30,7 @@ Claude Code, Codex, and Antigravity use persistent kernels for Python, file insp
|
|
|
30
30
|
|
|
31
31
|
Run ordinary Claude Code, Codex, or Antigravity with `clikernel-mcp` registered as an MCP server. Each agent has its own kernel and Python state. Claude Code and Antigravity use `clikernel-hook` to isolate callers on a shared MCP connection (subagents in Claude Code; all conversations and subagents in Antigravity). Codex isolates its MCP sessions without that hook.
|
|
32
32
|
|
|
33
|
-
Claude Code uses the `persistent-python` and `pyskills` host skills. Codex and Antigravity use `kernel-notebook-editing` from `skills/clikernel`,
|
|
33
|
+
Claude Code uses the `persistent-python` and `pyskills` host skills. Codex and Antigravity use `kernel-notebook-editing` from `skills/clikernel`, `cli-notebook-editing` only when the user explicitly requests working without a kernel, and `better_swarm` for Antigravity swarm orchestration. Antigravity packages its MCP server, hooks, skills, and `core.md` as one global plugin at `~/.gemini/config/plugins/aai-coding/`. The setup steps link the existing skills without changing them.
|
|
34
34
|
|
|
35
35
|
Task guidance is in pyskills. A pyskill is a Python module docstring, listed by `list_pyskills()` and read with `doc()`. Pyskills are versioned, released, and installed with their Python packages.
|
|
36
36
|
|
|
@@ -38,7 +38,7 @@ Task guidance is in pyskills. A pyskill is a Python module docstring, listed by
|
|
|
38
38
|
|
|
39
39
|
The repository contains:
|
|
40
40
|
|
|
41
|
-
- `aai_coding/`: Python
|
|
41
|
+
- `aai_coding/`: harness-specific Python modules (`harness_docs`, `aai-hook`, and `claudesub`), listed below.
|
|
42
42
|
- `skills/`: host-level `SKILL.md` sources linked into each harness's skills directory. [SETUP.md](SETUP.md#5-skills-safecmd-and-prompts) lists the links.
|
|
43
43
|
- `plugins/safecmd/`: a Claude Code plugin that auto-approves allowlisted Bash commands using the `safecmd` package.
|
|
44
44
|
- `prompts/`: shared behavioural rules and a replacement Claude Code system prompt, described below.
|
|
@@ -46,20 +46,15 @@ The repository contains:
|
|
|
46
46
|
|
|
47
47
|
### Python modules
|
|
48
48
|
|
|
49
|
-
- `coding_patterns` covers coding style, testing judgment, and team policy. Kernel startup imports it and tells the agent to read it with `doc(acp)`.
|
|
50
|
-
- `nbreview` guides notebook style reviews, including chkstyle findings, method extraction, lessons, and testing judgment. It builds on `nbdev.skill` and `coding_patterns`.
|
|
51
|
-
- `write_prose` covers anti-slop rules for narrative prose.
|
|
52
|
-
- `write_docs` covers plain reference prose for docstrings, READMEs, and PRs.
|
|
53
|
-
- `write_summary` covers summaries that a reader can use without the source.
|
|
54
|
-
- `write_llms` covers files that an LLM reads: `llms.txt` files, pyskill docstrings, setup runbooks, and prompts.
|
|
55
49
|
- `harness_docs` explains how to find official harness documentation through `llms.txt`.
|
|
56
|
-
- `vision` describes and transcribes images and PDFs through fastllm, without tools. `look` answers questions; `transcribe` saves Markdown and returns usage, timing and cost.
|
|
57
|
-
- `understand` covers building and holding a Theory (Naur, Socrates, Knoblich et al., Lakatos) before proposing, changing, or reviewing code or designs.
|
|
58
50
|
- `harness` implements hooks for Claude Code, Codex, and Antigravity through the `aai-hook` CLI. It is not a pyskill.
|
|
51
|
+
- `claudesub` launches headless Claude child sessions from a compacted parent transcript.
|
|
52
|
+
|
|
53
|
+
Reusable coding, writing, understanding, and vision pyskills (`coding_patterns`, `nbreview`, `write_prose`, `write_docs`, `write_summary`, `write_llms`, `understand`, `vision`) live in [aai-pyskills](https://github.com/AnswerDotAI/aai-pyskills).
|
|
59
54
|
|
|
60
55
|
### Prompts
|
|
61
56
|
|
|
62
|
-
`prompts/core.md` contains harness-neutral behavioural rules. Codex reads shared and personal rules from `~/.codex/AGENTS.md`, symlinked to `core.md` or merged into an existing personal file. Claude Code appends `core.md` to its system prompt. Antigravity loads `core.md` from `rules/AGENTS.md` and `prompts/agy-kernel.md` (its always-on kernel-first and
|
|
57
|
+
`prompts/core.md` contains harness-neutral behavioural rules. Codex reads shared and personal rules from `~/.codex/AGENTS.md`, symlinked to `core.md` or merged into an existing personal file. Claude Code appends `core.md` to its system prompt. Antigravity loads `core.md` from `rules/AGENTS.md` and `prompts/agy-kernel.md` (its always-on kernel-first rule and `better_swarm` trigger) from `rules/GEMINI.md` inside its global plugin, and has no flag to replace its built-in system prompt.
|
|
63
58
|
|
|
64
59
|
`prompts/sysp.md` replaces Claude Code's default system prompt. It aims to reduce the default prompt's tendency to give consultant-style advice and act without sufficient justification. Launch with:
|
|
65
60
|
|
|
@@ -85,4 +80,4 @@ You do not need to start the harness manually each day. Sessions use the skills
|
|
|
85
80
|
|
|
86
81
|
To change a skill, edit its source in this checkout. Others receive the changes by pulling. Release with the standard fastship command, `ship-release`. Bump the version in `aai_coding/__init__.py` after each release.
|
|
87
82
|
|
|
88
|
-
Tests cover substantive logic where hidden errors are realistic: event ordering, accumulated state, duplicate suppression
|
|
83
|
+
Tests cover substantive logic where hidden errors are realistic: event ordering, accumulated state, and duplicate suppression. Do not add tests for prompt wording, straightforward dispatch, or trivial configuration branches. Run the tests with `pytest`.
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
"The `claudesub` command: run a headless Claude child from the current session's compacted history, in its own kernel. It needs llmsurgery and fastclaude, which aai-coding doesn't install."
|
|
2
|
+
# - title: Claude subagent CLI (claudesub)
|
|
3
|
+
|
|
2
4
|
from fastcore.script import call_parse
|
|
3
5
|
|
|
4
6
|
PROTOCOL = """You are a subagent spawned by another Claude Code session with `claudesub`. The history above is that session's compacted transcript: you hold its decisions and evidence, but none of its kernel state. Your clikernel kernel is your own; no other session shares it. No person is watching, so never wait for an answer or ask a question mid-task: if you are blocked, stop and report exactly what you need, and the parent can resume you with `claudesub -r <your session id> '<answer>'`, which restarts your kernel, so finish whatever does not depend on the answer before you stop. Do the directive, and end with a report the parent can act on without reading your transcript: what you did, what you found, and anything left undone."""
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"Hook implementations for the team harness, installed as the `aai-hook` CLI. Each subcommand is registered in a harness's hook config (Claude Code settings.json, codex hooks.json, or Antigravity hooks.json) and reads the hook event's JSON payload from stdin. See SETUP.md for the wiring."
|
|
2
|
-
|
|
2
|
+
# - title: Harness hooks CLI (aai-hook)
|
|
3
|
+
|
|
4
|
+
import ast, io, json, os, re, sys, tokenize
|
|
3
5
|
from datetime import datetime
|
|
4
6
|
from pathlib import Path
|
|
7
|
+
from aai_coding import BOOT_CALLS
|
|
5
8
|
|
|
6
9
|
__all__ = ['main']
|
|
7
10
|
|
|
@@ -17,9 +20,165 @@ def bash_guard_msg(cmd):
|
|
|
17
20
|
return NO_TRUNCATE if _TRUNC.search(cmd) else None
|
|
18
21
|
|
|
19
22
|
|
|
23
|
+
_KWALK = re.compile(r'(?:\.(?:iterdir|glob|rglob)|\bos\.(?:listdir|walk))\s*\(')
|
|
24
|
+
_KREAD = re.compile(r'\.read_text\s*\(')
|
|
25
|
+
_KSKIP_MAGICS = ('%%exhash', '%%add_msg', '%%writefile', '%%bash')
|
|
26
|
+
_KIGNORED_TOKS = {tokenize.STRING, tokenize.COMMENT, getattr(tokenize, 'FSTRING_MIDDLE', -1)}
|
|
27
|
+
KERNEL_WARN_CTA = 'You used a function that has better replacements in the provided tooling. Check that `list_pyskills()` has been called in this session and that you have read `doc()` on the relevant pyskills and functions, internalizing how they are more ergonomic, complete, and consistent than ad hoc hackery.'
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def _strip_code(code):
|
|
31
|
+
"Drop string literals and comments from `code` so edits, searches, and comments do not trigger warnings"
|
|
32
|
+
out, prev = [], False
|
|
33
|
+
try:
|
|
34
|
+
for tok in tokenize.generate_tokens(io.StringIO(code).readline):
|
|
35
|
+
if tok.type in _KIGNORED_TOKS: continue
|
|
36
|
+
w = tok.type in (tokenize.NAME, tokenize.NUMBER)
|
|
37
|
+
if w and prev: out.append(' ')
|
|
38
|
+
out.append(tok.string)
|
|
39
|
+
prev = w
|
|
40
|
+
except tokenize.TokenError: pass
|
|
41
|
+
return ''.join(out)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def kernel_warn_msg(code):
|
|
45
|
+
"Advisory warning when a clikernel `exec` cell uses ad hoc directory walks or text reads, else None"
|
|
46
|
+
lines = [l.strip() for l in code.splitlines() if l.strip()]
|
|
47
|
+
if not lines or lines[0].startswith(_KSKIP_MAGICS): return None
|
|
48
|
+
s = _strip_code(code)
|
|
49
|
+
hints = []
|
|
50
|
+
if m := _KWALK.search(s):
|
|
51
|
+
hit = re.sub(r'\s+', '', m.group(0)) + ')'
|
|
52
|
+
hints.append(f'Ad hoc directory walk (`{hit}`) in clikernel exec: use `ls()` or `fd()` from `rgapi` instead.')
|
|
53
|
+
if _KREAD.search(s):
|
|
54
|
+
hints.append('Ad hoc file read (`.read_text()`) in clikernel exec: use `open_doc()` (outline first, then `.view()`) or `lnhashview_file()` from `exhash` instead.')
|
|
55
|
+
return '\n'.join([*hints, KERNEL_WARN_CTA]) if hints else None
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
LARGE_WRITE_LINES = 60
|
|
59
|
+
_KWRITE = re.compile(r'(?:\b(?:create_file|create_dlg|add_msg|add_msgs|write_nb|file_replace_lines|msg_replace_lines|cell_replace_lines|file_str_replace|file_strs_replace|file_insert_line)|\.write_text)\s*\(')
|
|
60
|
+
_EXHASH_FNS = {'file_exhash', 'cell_exhash', 'msg_exhash'}
|
|
61
|
+
_EXHASH_ADDR = re.compile(r'^(?:(\$|%|\d+\|[A-Za-z0-9_-]{2}\|)|(\d+)(?:,|$))')
|
|
62
|
+
_KWRITE_MAGIC = ('%%exhash', '%%writefile', '%%add_msg')
|
|
63
|
+
_DOC_EXTS = {'.md', '.txt', '.json', '.toml', '.yaml', '.yml', '.csv', '.svg', '.lock'}
|
|
64
|
+
_WRITE_TARGET = re.compile(
|
|
65
|
+
r'''(?:^%%(?:exhash|writefile)\s+(?:-\w+\s+)*['"]?([^\s'"]+)|\b(?:create_file|create_dlg|file_replace_lines|cell_replace_lines|file_str_replace|file_strs_replace|file_insert_line)\s*\(\s*['"]([^'"]+)['"]|Path\s*\(\s*['"]([^'"]+)['"]\s*\)\s*\.write_text\s*\()''',
|
|
66
|
+
re.M)
|
|
67
|
+
LARGE_WRITE_WARN = 'Large code write ({n} non-blank lines) in clikernel exec. STOP and check before continuing: does this reproduce a dependency or sibling package, bridge a missing upstream API, or work around a missing install, tool, permission, or slice boundary? If so, stop and ask the user (or @coordinator) for the upstream fix or permission instead of shipping a workaround. Otherwise check for bloat and duplication (`code-review` skill).'
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def _is_print_cmd(n):
|
|
71
|
+
if not (isinstance(n, ast.Tuple) and len(n.elts) >= 2 and isinstance(n.elts[1], ast.Constant)): return False
|
|
72
|
+
op = n.elts[1].value
|
|
73
|
+
if op == 'p': return len(n.elts) == 2
|
|
74
|
+
return (op in ('g', 'g!', 'v') and len(n.elts) == 4 and isinstance(n.elts[3], ast.Tuple)
|
|
75
|
+
and len(n.elts[3].elts) == 1 and getattr(n.elts[3].elts[0], 'value', None) == 'p')
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def _exhash_edits(code):
|
|
79
|
+
try: tree = ast.parse(code)
|
|
80
|
+
except SyntaxError:
|
|
81
|
+
try: tree = ast.parse('\n'.join('' if l.lstrip().startswith(('%', '!')) else l for l in code.splitlines()))
|
|
82
|
+
except SyntaxError: return None
|
|
83
|
+
out = []
|
|
84
|
+
for n in ast.walk(tree):
|
|
85
|
+
if not (isinstance(n, ast.Call) and isinstance(n.func, ast.Name) and n.func.id in _EXHASH_FNS): continue
|
|
86
|
+
fn = n.func.id
|
|
87
|
+
skip = 2 if fn == 'cell_exhash' else (1 if fn == 'msg_exhash' else (0 if n.args and isinstance(n.args[0], ast.Tuple) else 1))
|
|
88
|
+
if cmds := [a for a in n.args[skip:] if not _is_print_cmd(a)]: out.append((n, fn, cmds))
|
|
89
|
+
return out
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def _addr_path(s):
|
|
93
|
+
if not isinstance(s, str) or _EXHASH_ADDR.match(s): return None
|
|
94
|
+
for i, c in enumerate(s):
|
|
95
|
+
if c == ':' and _EXHASH_ADDR.match(s[i+1:]): return s[:i].split('.ipynb:', 1)[0] + ('.ipynb' if '.ipynb:' in s[:i] else '')
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def _write_targets(code):
|
|
99
|
+
res = [next(g for g in m.groups() if g) for m in _WRITE_TARGET.finditer(code)]
|
|
100
|
+
for call, fn, cmds in _exhash_edits(code) or ():
|
|
101
|
+
if fn in ('file_exhash', 'cell_exhash') and call.args and isinstance(getattr(call.args[0], 'value', None), str):
|
|
102
|
+
res.append(call.args[0].value)
|
|
103
|
+
if fn == 'file_exhash':
|
|
104
|
+
for a in cmds:
|
|
105
|
+
if not (isinstance(a, ast.Tuple) and len(a.elts) >= 2): continue
|
|
106
|
+
idxs = (0, 2) if (getattr(a.elts[1], 'value', None) in ('m', 't') and len(a.elts) >= 3) else (0,)
|
|
107
|
+
res.extend(p for idx in idxs if (p := _addr_path(getattr(a.elts[idx], 'value', None))))
|
|
108
|
+
return res
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def _all_doc_targets(code):
|
|
112
|
+
targets = _write_targets(code)
|
|
113
|
+
return bool(targets) and all(Path(p).suffix.lower() in _DOC_EXTS for p in targets)
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def _is_write_cell(code):
|
|
117
|
+
first = next((l.lstrip() for l in code.splitlines() if l.strip()), '')
|
|
118
|
+
if not first: return False
|
|
119
|
+
return first.startswith(_KWRITE_MAGIC) or bool(_KWRITE.search(_strip_code(code))) or bool(_exhash_edits(code))
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def large_write_warn_msg(code, limit=None):
|
|
123
|
+
"Advisory tripwire when a clikernel `exec` cell writes a large block of code, else None"
|
|
124
|
+
lines = [l for l in code.splitlines() if l.strip()]
|
|
125
|
+
thresh = int(os.environ.get('AAI_LARGE_WRITE_LINES', LARGE_WRITE_LINES)) if limit is None else limit
|
|
126
|
+
if len(lines) < thresh: return None
|
|
127
|
+
if not _is_write_cell(code): return None
|
|
128
|
+
if _all_doc_targets(code): return None
|
|
129
|
+
return LARGE_WRITE_WARN.format(n=len(lines))
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
_LLM_DOC_NAMES = {'CLAUDE.md', 'GEMINI.md', 'AGENTS.md', 'SKILL.md', 'llms.txt', 'SETUP.md'}
|
|
133
|
+
_LLM_DOC_DIRS = {'prompts', 'rules'}
|
|
134
|
+
LLM_DOC_WARN = 'LLM-facing doc edit ({targets}): read `doc(aai_pyskills.write_llms)` if not in full in context. Second pass (unless done): write changed text + verbose neighbors to a temp file; next turn, re-read and re-draft against the full guide.'
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
_AAI_NON_SKILLS = {'__init__.py', '_writing.py', 'claudesub.py', 'harness.py', 'llms.py'}
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def _is_llm_doc(path):
|
|
141
|
+
p = Path(path)
|
|
142
|
+
if p.name in _LLM_DOC_NAMES or p.name.endswith('skill.py') or '_pyskills' in p.parts: return True
|
|
143
|
+
if p.parent.name in ('aai_coding', 'aai_pyskills') and p.suffix == '.py' and p.name not in _AAI_NON_SKILLS: return True
|
|
144
|
+
return p.suffix.lower() == '.md' and bool(_LLM_DOC_DIRS & set(p.parts))
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
def llm_doc_warn_msg(code):
|
|
148
|
+
"Advisory reminder when a clikernel `exec` cell writes to an LLM-facing doc, else None"
|
|
149
|
+
if not _is_write_cell(code): return None
|
|
150
|
+
targets = [t for t in _write_targets(code) if _is_llm_doc(t)]
|
|
151
|
+
if not targets: return None
|
|
152
|
+
seen = list(dict.fromkeys(targets))
|
|
153
|
+
return LLM_DOC_WARN.format(targets=', '.join(seen))
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
_TEST_NAME_RE = re.compile(r'(?:^test_|_test\.|\.(?:test|spec)\.)')
|
|
157
|
+
_MONKEYPATCH = re.compile(r'\bmonkeypatch\b')
|
|
158
|
+
TEST_EDIT_WARN = 'Test file edit ({targets}). If `testing` skill (`SKILL.md`) is not already in context, read it now (skip if already in view). Default to no new test; reject template/config/YAML output assertions, trivial guards, wiring/orchestration, or already-covered logic.'
|
|
159
|
+
MONKEYPATCH_WARN = '`monkeypatch` detected in test edit ({targets}): this is almost definitely not an acceptable test. Delete the test, or extract and test a small pure function instead of patching globals, env, attributes, or collaborators.'
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
def _is_test_file(path):
|
|
163
|
+
p = Path(path)
|
|
164
|
+
if p.suffix.lower() in _DOC_EXTS: return False
|
|
165
|
+
return 'tests' in p.parts or bool(_TEST_NAME_RE.search(p.name))
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def test_edit_warn_msg(code):
|
|
169
|
+
"Advisory reminder when a clikernel `exec` cell writes to a test file, escalating on `monkeypatch`, else None"
|
|
170
|
+
if not _is_write_cell(code): return None
|
|
171
|
+
targets = [t for t in _write_targets(code) if _is_test_file(t)]
|
|
172
|
+
if not targets: return None
|
|
173
|
+
ts = ', '.join(dict.fromkeys(targets))
|
|
174
|
+
parts = [MONKEYPATCH_WARN.format(targets=ts)] if _MONKEYPATCH.search(code) else []
|
|
175
|
+
parts.append(TEST_EDIT_WARN.format(targets=ts))
|
|
176
|
+
return '\n'.join(parts)
|
|
177
|
+
|
|
178
|
+
|
|
20
179
|
Q_NOTICE = 'This looks like a question. Claude Code bug: a tool call after answer text hides the answer. End the turn with the answer. Most questions need no tool call.'
|
|
21
180
|
READ_NOTICE = 'This prompt appears to contain a request to read something. If it could reasonably be interpreted that way, read the target in full NOW, before composing any response: a notebook via summary_dlg then view_dlg/find_msgs as needed; a .py or other text file in full. Never respond from assumed or remembered contents.'
|
|
22
|
-
APPROVAL_NOTICE = '
|
|
181
|
+
APPROVAL_NOTICE = 'Bare approval covers ALL items proposed in your immediately preceding message (not a subset) plus prior agreements — nothing else. Background mentions or earlier unapproved items stay pending; ask if unsure.'
|
|
23
182
|
|
|
24
183
|
|
|
25
184
|
Q_NOTICE_CODEX = 'This looks like a question. Answer it directly, before and instead of any further work. Most questions need no tool call. Investigate as needed to answer accurately, but only use tool calls if clearly needed to do so.'
|
|
@@ -155,8 +314,8 @@ def last_request(path):
|
|
|
155
314
|
return q
|
|
156
315
|
|
|
157
316
|
|
|
158
|
-
def
|
|
159
|
-
"Per-
|
|
317
|
+
def _state_dir(kind):
|
|
318
|
+
"Per-kind state directory under the shared state root, sweeping abandoned files"
|
|
160
319
|
d = Path(os.environ.get('LLMDOJO_STATE_DIR', Path.home()/'.local/state/llmdojo'))/kind
|
|
161
320
|
d.mkdir(parents=True, exist_ok=True)
|
|
162
321
|
import time
|
|
@@ -164,7 +323,12 @@ def _state_file(kind, sid):
|
|
|
164
323
|
try:
|
|
165
324
|
if g.stat().st_mtime < time.time() - 86400: g.unlink(missing_ok=True)
|
|
166
325
|
except FileNotFoundError: pass # a concurrent sweep got it first
|
|
167
|
-
return d
|
|
326
|
+
return d
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
def _state_file(kind, sid):
|
|
330
|
+
"Per-session state file of the given `kind` under the shared state root, sweeping abandoned siblings"
|
|
331
|
+
return _state_dir(kind)/f'{sid}.json'
|
|
168
332
|
|
|
169
333
|
|
|
170
334
|
def claude_air(o):
|
|
@@ -251,38 +415,35 @@ def claude_slop(o):
|
|
|
251
415
|
if notes: print(json.dumps(dict(hookSpecificOutput=dict(
|
|
252
416
|
hookEventName='UserPromptSubmit', additionalContext='\n'.join(notes)))))
|
|
253
417
|
except Exception as e: print(f'[slop] fail-open: {e!r}', file=sys.stderr)
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
_BOOT_STR = ', '.join(f'`{c}`' for c in BOOT_CALLS)
|
|
421
|
+
CODEX_COMPACT_MSG = f'Context was compacted (a summary does not count as in full). Before any local read, search, edit, notebook work, or Python execution, run any of {_BOOT_STR} not in full in context in one parallel batch of bare calls, follow their instructions, and read `doc()` for any matching task pyskill or `…`-truncated function before first use.'
|
|
422
|
+
|
|
423
|
+
|
|
254
424
|
def codex_orientation(o):
|
|
255
|
-
"codex
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
marker = markers/f"{o['session_id']}.json"
|
|
259
|
-
event = o['hook_event_name']
|
|
260
|
-
message = 'Context was compacted, so the clikernel documentation is no longer in context. Read the startup documentation in two separate calls: first `doc(clik,pysk,edsk)`, then `doc(dsk,exh,rgsk)`. Run `doc()` for anything else you need as you continue. After running the two `doc()` calls, retry your last tool call; it should now work. Then continue your existing task if it is not complete.'
|
|
261
|
-
if event == 'PostCompact':
|
|
262
|
-
markers.mkdir(parents=True, exist_ok=True)
|
|
263
|
-
marker.write_text(json.dumps(dict(turn_id=o.get('turn_id'))))
|
|
264
|
-
elif event == 'PreToolUse':
|
|
265
|
-
try: marker.unlink()
|
|
266
|
-
except FileNotFoundError: pass
|
|
267
|
-
else: print(json.dumps(dict(hookSpecificOutput=dict(hookEventName='PreToolUse', permissionDecision='deny', permissionDecisionReason=message))))
|
|
268
|
-
elif event == 'SessionStart':
|
|
269
|
-
try: marker.unlink()
|
|
270
|
-
except FileNotFoundError: pass
|
|
271
|
-
else: print(json.dumps(dict(hookSpecificOutput=dict(hookEventName='SessionStart', additionalContext=message))))
|
|
425
|
+
"codex SessionStart(compact): inject post-compaction kernel/pyskills bootstrap notice"
|
|
426
|
+
if o.get('source') == 'compact':
|
|
427
|
+
print(json.dumps(dict(hookSpecificOutput=dict(hookEventName='SessionStart', additionalContext=CODEX_COMPACT_MSG))))
|
|
272
428
|
|
|
273
429
|
|
|
274
430
|
def _agy_inject(*msgs): print(json.dumps(dict(injectSteps=[dict(systemMessage=dict(systemMessage=m)) for m in msgs]) if msgs else {}))
|
|
275
431
|
|
|
276
432
|
|
|
277
|
-
|
|
433
|
+
AGY_COMPACT_MSG = f'Post-compaction (a summary does not count as in full). Before replying, judging, or spawning any fork: read any active/required skills (`better_swarm`, user-required skills) and run any of {_BOOT_STR} not in full in context in one parallel clikernel batch (create `py` kernel first if none active).'
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
def _agy_last_steps(path):
|
|
278
437
|
p = Path(path)
|
|
279
|
-
if not p.is_file(): return None
|
|
280
|
-
|
|
438
|
+
if not p.is_file(): return None, None
|
|
439
|
+
user = cp = None
|
|
281
440
|
for line in p.open():
|
|
282
441
|
try: r = json.loads(line)
|
|
283
442
|
except json.JSONDecodeError: continue
|
|
284
|
-
|
|
285
|
-
|
|
443
|
+
t = r.get('type')
|
|
444
|
+
if t == 'USER_INPUT': user = r.get('step_index')
|
|
445
|
+
elif t == 'CHECKPOINT': cp = r.get('step_index')
|
|
446
|
+
return user, cp
|
|
286
447
|
|
|
287
448
|
|
|
288
449
|
def agy_session_start(o):
|
|
@@ -292,35 +453,89 @@ def agy_session_start(o):
|
|
|
292
453
|
|
|
293
454
|
|
|
294
455
|
def agy_prompt_submit(o):
|
|
295
|
-
"Antigravity PreInvocation: emit prompt notices once per user turn"
|
|
456
|
+
"Antigravity PreInvocation: emit prompt notices once per user turn and a reload notice after compaction"
|
|
296
457
|
prompt = o.get('lastUserInput') or ''
|
|
297
|
-
if not prompt.strip(): return _agy_inject()
|
|
298
458
|
cid = o.get('conversationId') or ''
|
|
299
|
-
step =
|
|
459
|
+
step, cp = _agy_last_steps(o.get('transcriptPath') or '')
|
|
300
460
|
key = step if step is not None else o.get('initialNumSteps')
|
|
461
|
+
st = {}
|
|
301
462
|
if cid:
|
|
302
463
|
f = _state_file('agy-prompt', cid)
|
|
303
|
-
try:
|
|
304
|
-
except (OSError, ValueError):
|
|
305
|
-
|
|
464
|
+
try: st = json.loads(f.read_text())
|
|
465
|
+
except (OSError, ValueError): st = {}
|
|
466
|
+
new_turn = bool(prompt.strip()) and (not cid or st.get('seen') != key)
|
|
467
|
+
compact = bool(cid) and cp is not None and st.get('cp') != cp
|
|
468
|
+
if not new_turn and not compact: return _agy_inject()
|
|
469
|
+
if cid:
|
|
306
470
|
tmp = f.with_suffix(f'.{os.getpid()}.tmp')
|
|
307
|
-
tmp.write_text(json.dumps(dict(seen=key)))
|
|
471
|
+
tmp.write_text(json.dumps(dict(seen=key if new_turn else st.get('seen'), cp=cp if compact else st.get('cp'))))
|
|
308
472
|
tmp.replace(f)
|
|
309
|
-
|
|
473
|
+
msgs = ([AGY_COMPACT_MSG] if compact else []) + (['\n'.join(ns)] if new_turn and (ns := prompt_notices(prompt, Q_NOTICE_CODEX)) else [])
|
|
474
|
+
_agy_inject(*msgs)
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
SWARM_FORK_MSG = 'Spawning an unforked swarm worker (no `fork` parameter): workers without `fork="coordinator"` start blank with no bootstrapped pyskills or conversation context. Pass `fork="coordinator"` unless a blank context is explicitly wanted.'
|
|
478
|
+
SWARM_BRIEF_MSG = "Forked workers get NO brief — pass only which part + report-to (<=1 line, <=100 chars). If a fork needs more detail, do NOT spawn — put it in main, ask 'OK?', and wait so forks inherit it."
|
|
479
|
+
_SWARM_LIST_RE = re.compile(r'(?m)^\s*(?:\d+[.)]|[-*•])\s+')
|
|
310
480
|
|
|
311
481
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
482
|
+
def _bad_fork_brief(s):
|
|
483
|
+
if not isinstance(s, str): return False
|
|
484
|
+
s = s.strip()
|
|
485
|
+
return len(s) > 100 or len(s.splitlines()) > 1 or bool(_SWARM_LIST_RE.search(s))
|
|
316
486
|
|
|
317
487
|
|
|
318
488
|
def agy_swarm_guard(o):
|
|
319
|
-
"Antigravity PreToolUse(swarm): require confirmation
|
|
489
|
+
"Antigravity PreToolUse(swarm): require confirmation for unforked workers and block overstuffed forked briefs"
|
|
320
490
|
args = (o.get('toolCall') or {}).get('args') or {}
|
|
321
|
-
if args.get('action') == 'add'
|
|
322
|
-
print(json.dumps(dict(decision='force_ask', reason=SWARM_FORK_MSG)))
|
|
323
|
-
|
|
491
|
+
if args.get('action') == 'add':
|
|
492
|
+
if not args.get('fork'): return print(json.dumps(dict(decision='force_ask', reason=SWARM_FORK_MSG)))
|
|
493
|
+
if any(_bad_fork_brief(s) for s in [args.get('brief'), *(args.get('tasks') or ())]):
|
|
494
|
+
return print(json.dumps(dict(decision='deny', reason=SWARM_BRIEF_MSG)))
|
|
495
|
+
print(json.dumps(dict(decision='allow')))
|
|
496
|
+
|
|
497
|
+
|
|
498
|
+
def agy_kernel_warn(o):
|
|
499
|
+
"Antigravity PostToolUse(call_mcp_tool)/PostInvocation: warn on ad hoc reads/walks, large code writes, LLM-doc edits, or test edits in clikernel exec"
|
|
500
|
+
ev, cid = o.get('hookEventName'), o.get('conversationId') or ''
|
|
501
|
+
if ev == 'PostToolUse':
|
|
502
|
+
tc = o.get('toolCall') or {}
|
|
503
|
+
args = tc.get('args') or {}
|
|
504
|
+
srv = args.get('ServerName') or ''
|
|
505
|
+
if tc.get('name') == 'call_mcp_tool' and (srv == 'clikernel' or srv.endswith('_clikernel')) and args.get('ToolName') == 'exec':
|
|
506
|
+
code = (args.get('Arguments') or {}).get('code') or ''
|
|
507
|
+
if cid and (ms := [m for m in (kernel_warn_msg(code), large_write_warn_msg(code), llm_doc_warn_msg(code), test_edit_warn_msg(code)) if m]):
|
|
508
|
+
tid = re.sub(r'[^a-zA-Z0-9_-]', '_', str(tc.get('id') or os.getpid()))
|
|
509
|
+
f = _state_file('agy-kwarn', f'{cid}__{tid}')
|
|
510
|
+
tmp = f.with_suffix(f'.{os.getpid()}.tmp')
|
|
511
|
+
tmp.write_text(json.dumps('\n\n'.join(ms)))
|
|
512
|
+
tmp.replace(f)
|
|
513
|
+
print('{}')
|
|
514
|
+
elif ev in ('PostInvocation', 'PreInvocation'):
|
|
515
|
+
if not cid: return _agy_inject()
|
|
516
|
+
msgs = []
|
|
517
|
+
for f in sorted(_state_dir('agy-kwarn').glob(f'{cid}__*.json')):
|
|
518
|
+
try:
|
|
519
|
+
m = json.loads(f.read_text())
|
|
520
|
+
f.unlink(missing_ok=True)
|
|
521
|
+
if m and m not in msgs: msgs.append(m)
|
|
522
|
+
except (OSError, ValueError): pass
|
|
523
|
+
_agy_inject(*msgs)
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
def agy_statusline(o):
|
|
527
|
+
"Antigravity statusLine: starting workspace directory and context usage"
|
|
528
|
+
ws = o.get('workspace') or {}
|
|
529
|
+
d = ws.get('project_dir') or ws.get('current_dir') or o.get('cwd') or ''
|
|
530
|
+
home = str(Path.home())
|
|
531
|
+
if d == home or d.startswith(home + '/'): d = '~' + d[len(home):]
|
|
532
|
+
cw = o.get('context_window') or {}
|
|
533
|
+
pct, win = cw.get('used_percentage'), cw.get('context_window_size') or 0
|
|
534
|
+
cu = cw.get('current_usage') or {}
|
|
535
|
+
toks = sum(cu.get(k) or 0 for k in ('input_tokens', 'cache_read_input_tokens', 'cache_creation_input_tokens'))
|
|
536
|
+
if not toks and pct and win: toks = round(pct * win / 100)
|
|
537
|
+
ctx = f'{round(pct)}% ({round(toks/1000)}k/{round(win/1000)}k)' if pct is not None and win else f'{round(pct)}%' if pct is not None else ''
|
|
538
|
+
print(' | '.join(filter(None, (d, ctx))))
|
|
324
539
|
|
|
325
540
|
|
|
326
541
|
def main():
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: aai-coding
|
|
3
|
-
Version: 0.1.
|
|
4
|
-
Summary:
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: Shared configuration, hooks, prompts, and skills for Answer.AI coding sessions
|
|
5
5
|
Author: aai-coding contributors
|
|
6
6
|
License-Expression: Apache-2.0
|
|
7
7
|
Project-URL: Homepage, https://github.com/AnswerDotAI/aai-coding
|
|
8
|
+
Project-URL: Documentation, https://AnswerDotAI.github.io/aai-coding/
|
|
8
9
|
Classifier: Programming Language :: Python :: 3
|
|
9
10
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
10
11
|
Requires-Python: >=3.11
|
|
11
12
|
Description-Content-Type: text/markdown
|
|
12
13
|
License-File: LICENSE
|
|
13
|
-
Requires-Dist: pypdfium2>=5
|
|
14
|
-
Requires-Dist: pyvips[binary]>=3
|
|
15
|
-
Requires-Dist: python-fastllm>=0.0.75
|
|
16
|
-
Requires-Dist: pyskills>=0.0.35
|
|
17
14
|
Provides-Extra: dev
|
|
18
15
|
Requires-Dist: fastship; extra == "dev"
|
|
19
16
|
Requires-Dist: build; extra == "dev"
|
|
@@ -52,7 +49,7 @@ Claude Code, Codex, and Antigravity use persistent kernels for Python, file insp
|
|
|
52
49
|
|
|
53
50
|
Run ordinary Claude Code, Codex, or Antigravity with `clikernel-mcp` registered as an MCP server. Each agent has its own kernel and Python state. Claude Code and Antigravity use `clikernel-hook` to isolate callers on a shared MCP connection (subagents in Claude Code; all conversations and subagents in Antigravity). Codex isolates its MCP sessions without that hook.
|
|
54
51
|
|
|
55
|
-
Claude Code uses the `persistent-python` and `pyskills` host skills. Codex and Antigravity use `kernel-notebook-editing` from `skills/clikernel`,
|
|
52
|
+
Claude Code uses the `persistent-python` and `pyskills` host skills. Codex and Antigravity use `kernel-notebook-editing` from `skills/clikernel`, `cli-notebook-editing` only when the user explicitly requests working without a kernel, and `better_swarm` for Antigravity swarm orchestration. Antigravity packages its MCP server, hooks, skills, and `core.md` as one global plugin at `~/.gemini/config/plugins/aai-coding/`. The setup steps link the existing skills without changing them.
|
|
56
53
|
|
|
57
54
|
Task guidance is in pyskills. A pyskill is a Python module docstring, listed by `list_pyskills()` and read with `doc()`. Pyskills are versioned, released, and installed with their Python packages.
|
|
58
55
|
|
|
@@ -60,7 +57,7 @@ Task guidance is in pyskills. A pyskill is a Python module docstring, listed by
|
|
|
60
57
|
|
|
61
58
|
The repository contains:
|
|
62
59
|
|
|
63
|
-
- `aai_coding/`: Python
|
|
60
|
+
- `aai_coding/`: harness-specific Python modules (`harness_docs`, `aai-hook`, and `claudesub`), listed below.
|
|
64
61
|
- `skills/`: host-level `SKILL.md` sources linked into each harness's skills directory. [SETUP.md](SETUP.md#5-skills-safecmd-and-prompts) lists the links.
|
|
65
62
|
- `plugins/safecmd/`: a Claude Code plugin that auto-approves allowlisted Bash commands using the `safecmd` package.
|
|
66
63
|
- `prompts/`: shared behavioural rules and a replacement Claude Code system prompt, described below.
|
|
@@ -68,20 +65,15 @@ The repository contains:
|
|
|
68
65
|
|
|
69
66
|
### Python modules
|
|
70
67
|
|
|
71
|
-
- `coding_patterns` covers coding style, testing judgment, and team policy. Kernel startup imports it and tells the agent to read it with `doc(acp)`.
|
|
72
|
-
- `nbreview` guides notebook style reviews, including chkstyle findings, method extraction, lessons, and testing judgment. It builds on `nbdev.skill` and `coding_patterns`.
|
|
73
|
-
- `write_prose` covers anti-slop rules for narrative prose.
|
|
74
|
-
- `write_docs` covers plain reference prose for docstrings, READMEs, and PRs.
|
|
75
|
-
- `write_summary` covers summaries that a reader can use without the source.
|
|
76
|
-
- `write_llms` covers files that an LLM reads: `llms.txt` files, pyskill docstrings, setup runbooks, and prompts.
|
|
77
68
|
- `harness_docs` explains how to find official harness documentation through `llms.txt`.
|
|
78
|
-
- `vision` describes and transcribes images and PDFs through fastllm, without tools. `look` answers questions; `transcribe` saves Markdown and returns usage, timing and cost.
|
|
79
|
-
- `understand` covers building and holding a Theory (Naur, Socrates, Knoblich et al., Lakatos) before proposing, changing, or reviewing code or designs.
|
|
80
69
|
- `harness` implements hooks for Claude Code, Codex, and Antigravity through the `aai-hook` CLI. It is not a pyskill.
|
|
70
|
+
- `claudesub` launches headless Claude child sessions from a compacted parent transcript.
|
|
71
|
+
|
|
72
|
+
Reusable coding, writing, understanding, and vision pyskills (`coding_patterns`, `nbreview`, `write_prose`, `write_docs`, `write_summary`, `write_llms`, `understand`, `vision`) live in [aai-pyskills](https://github.com/AnswerDotAI/aai-pyskills).
|
|
81
73
|
|
|
82
74
|
### Prompts
|
|
83
75
|
|
|
84
|
-
`prompts/core.md` contains harness-neutral behavioural rules. Codex reads shared and personal rules from `~/.codex/AGENTS.md`, symlinked to `core.md` or merged into an existing personal file. Claude Code appends `core.md` to its system prompt. Antigravity loads `core.md` from `rules/AGENTS.md` and `prompts/agy-kernel.md` (its always-on kernel-first and
|
|
76
|
+
`prompts/core.md` contains harness-neutral behavioural rules. Codex reads shared and personal rules from `~/.codex/AGENTS.md`, symlinked to `core.md` or merged into an existing personal file. Claude Code appends `core.md` to its system prompt. Antigravity loads `core.md` from `rules/AGENTS.md` and `prompts/agy-kernel.md` (its always-on kernel-first rule and `better_swarm` trigger) from `rules/GEMINI.md` inside its global plugin, and has no flag to replace its built-in system prompt.
|
|
85
77
|
|
|
86
78
|
`prompts/sysp.md` replaces Claude Code's default system prompt. It aims to reduce the default prompt's tendency to give consultant-style advice and act without sufficient justification. Launch with:
|
|
87
79
|
|
|
@@ -107,4 +99,4 @@ You do not need to start the harness manually each day. Sessions use the skills
|
|
|
107
99
|
|
|
108
100
|
To change a skill, edit its source in this checkout. Others receive the changes by pulling. Release with the standard fastship command, `ship-release`. Bump the version in `aai_coding/__init__.py` after each release.
|
|
109
101
|
|
|
110
|
-
Tests cover substantive logic where hidden errors are realistic: event ordering, accumulated state, duplicate suppression
|
|
102
|
+
Tests cover substantive logic where hidden errors are realistic: event ordering, accumulated state, and duplicate suppression. Do not add tests for prompt wording, straightforward dispatch, or trivial configuration branches. Run the tests with `pytest`.
|
|
@@ -2,24 +2,13 @@ LICENSE
|
|
|
2
2
|
README.md
|
|
3
3
|
pyproject.toml
|
|
4
4
|
aai_coding/__init__.py
|
|
5
|
-
aai_coding/_writing.py
|
|
6
5
|
aai_coding/claudesub.py
|
|
7
|
-
aai_coding/coding_patterns.py
|
|
8
6
|
aai_coding/harness.py
|
|
9
7
|
aai_coding/harness_docs.py
|
|
10
|
-
aai_coding/llms.py
|
|
11
|
-
aai_coding/nbreview.py
|
|
12
|
-
aai_coding/understand.py
|
|
13
|
-
aai_coding/vision.py
|
|
14
|
-
aai_coding/write_docs.py
|
|
15
|
-
aai_coding/write_llms.py
|
|
16
|
-
aai_coding/write_prose.py
|
|
17
|
-
aai_coding/write_summary.py
|
|
18
8
|
aai_coding.egg-info/PKG-INFO
|
|
19
9
|
aai_coding.egg-info/SOURCES.txt
|
|
20
10
|
aai_coding.egg-info/dependency_links.txt
|
|
21
11
|
aai_coding.egg-info/entry_points.txt
|
|
22
12
|
aai_coding.egg-info/requires.txt
|
|
23
13
|
aai_coding.egg-info/top_level.txt
|
|
24
|
-
tests/test_startup.py
|
|
25
|
-
tests/test_vision.py
|
|
14
|
+
tests/test_startup.py
|