aai-coding 0.1.0__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.
Files changed (34) hide show
  1. aai_coding-0.1.2/PKG-INFO +102 -0
  2. aai_coding-0.1.2/README.md +83 -0
  3. aai_coding-0.1.2/aai_coding/__init__.py +2 -0
  4. aai_coding-0.1.2/aai_coding/claudesub.py +44 -0
  5. aai_coding-0.1.2/aai_coding/harness.py +543 -0
  6. aai_coding-0.1.2/aai_coding/harness_docs.py +23 -0
  7. aai_coding-0.1.2/aai_coding.egg-info/PKG-INFO +102 -0
  8. {aai_coding-0.1.0 → aai_coding-0.1.2}/aai_coding.egg-info/SOURCES.txt +2 -11
  9. aai_coding-0.1.2/aai_coding.egg-info/entry_points.txt +6 -0
  10. {aai_coding-0.1.0 → aai_coding-0.1.2}/aai_coding.egg-info/requires.txt +0 -1
  11. {aai_coding-0.1.0 → aai_coding-0.1.2}/pyproject.toml +6 -16
  12. aai_coding-0.1.2/tests/test_startup.py +12 -0
  13. aai_coding-0.1.0/CHANGELOG.md +0 -25
  14. aai_coding-0.1.0/MANIFEST.in +0 -3
  15. aai_coding-0.1.0/PKG-INFO +0 -46
  16. aai_coding-0.1.0/README.md +0 -27
  17. aai_coding-0.1.0/aai_coding/__init__.py +0 -1
  18. aai_coding-0.1.0/aai_coding/coding_patterns.py +0 -137
  19. aai_coding-0.1.0/aai_coding/harness.py +0 -304
  20. aai_coding-0.1.0/aai_coding/harness_docs.py +0 -20
  21. aai_coding-0.1.0/aai_coding/llms.py +0 -40
  22. aai_coding-0.1.0/aai_coding/looker.py +0 -71
  23. aai_coding-0.1.0/aai_coding/theory.py +0 -23
  24. aai_coding-0.1.0/aai_coding/write_docs.py +0 -101
  25. aai_coding-0.1.0/aai_coding/write_prose.py +0 -127
  26. aai_coding-0.1.0/aai_coding/write_summary.py +0 -62
  27. aai_coding-0.1.0/aai_coding.egg-info/PKG-INFO +0 -46
  28. aai_coding-0.1.0/aai_coding.egg-info/entry_points.txt +0 -11
  29. aai_coding-0.1.0/tests/test_harness.py +0 -191
  30. aai_coding-0.1.0/tests/test_looker.py +0 -37
  31. {aai_coding-0.1.0 → aai_coding-0.1.2}/LICENSE +0 -0
  32. {aai_coding-0.1.0 → aai_coding-0.1.2}/aai_coding.egg-info/dependency_links.txt +0 -0
  33. {aai_coding-0.1.0 → aai_coding-0.1.2}/aai_coding.egg-info/top_level.txt +0 -0
  34. {aai_coding-0.1.0 → aai_coding-0.1.2}/setup.cfg +0 -0
@@ -0,0 +1,102 @@
1
+ Metadata-Version: 2.4
2
+ Name: aai-coding
3
+ Version: 0.1.2
4
+ Summary: Shared configuration, hooks, prompts, and skills for Answer.AI coding sessions
5
+ Author: aai-coding contributors
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/AnswerDotAI/aai-coding
8
+ Project-URL: Documentation, https://AnswerDotAI.github.io/aai-coding/
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3 :: Only
11
+ Requires-Python: >=3.11
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Provides-Extra: dev
15
+ Requires-Dist: fastship; extra == "dev"
16
+ Requires-Dist: build; extra == "dev"
17
+ Requires-Dist: twine; extra == "dev"
18
+ Dynamic: license-file
19
+
20
+ # aai-coding
21
+
22
+ `aai-coding` contains Answer.AI's shared configuration, skills, and tools for Claude Code, Codex, and Antigravity. It defines the team's coding and writing guidance, tool permissions, and Python workflows. An LLM setting up the harness should read this README before following `SETUP.md`. The design decisions below also help you advise users who already have a setup.
23
+
24
+ ## Getting started
25
+
26
+ You do not need an Answer.AI account or our existing workspace. [SETUP.md](SETUP.md) starts by creating a workspace in a directory you choose, managed by [fastws](https://github.com/AnswerDotAI/fastws). It then covers harness configuration.
27
+
28
+ The workspace holds separate Git checkouts that share one uv environment. Because its Python projects use editable installs, changes in a checkout are available without reinstalling it.
29
+
30
+ Start with:
31
+
32
+ ```bash
33
+ uvx --from 'fastws-cli>=0.0.14' ws-setup AnswerDotAI/aai-ws ~/aai-ws
34
+ ```
35
+
36
+ Activate the new environment and follow [SETUP.md](SETUP.md). The public [aai-ws baseline](https://github.com/AnswerDotAI/aai-ws) includes aai-coding, fastws, kernel startup and editing tools, and tools used by the Claude hooks. Other Python dependencies are installed as packages.
37
+
38
+ Answer.AI team members use `AnswerDotAI/private-ws` instead of `AnswerDotAI/aai-ws` in that command. Both workspace repos receive shared baseline updates through `ws-sync`. In either setup:
39
+
40
+ - `repos.txt` holds the shared baseline.
41
+ - Gitignored `repos-local.txt` holds personal extras.
42
+ - fastws creates and maintains the workspace's untracked `pyproject.toml`.
43
+
44
+ Reuse existing workspaces. Do not run `ws-setup` on them. See the [team migration instructions](https://github.com/AnswerDotAI/private-ws#migrating-an-existing-workspace).
45
+
46
+ ## Tool workflows
47
+
48
+ Claude Code, Codex, and Antigravity use persistent kernels for Python, file inspection, searching, notebooks, and most edits. Pyskills provide the tools; exhash provides hash-verified editing. Use Bash for shell commands, builds, and Git. Use native tools where the installed skills call for them.
49
+
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.
51
+
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.
53
+
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.
55
+
56
+ ## What is in here
57
+
58
+ The repository contains:
59
+
60
+ - `aai_coding/`: harness-specific Python modules (`harness_docs`, `aai-hook`, and `claudesub`), listed below.
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.
62
+ - `plugins/safecmd/`: a Claude Code plugin that auto-approves allowlisted Bash commands using the `safecmd` package.
63
+ - `prompts/`: shared behavioural rules and a replacement Claude Code system prompt, described below.
64
+ - `SETUP.md`: a setup runbook written as a prompt for an LLM session. It is not an installer script.
65
+
66
+ ### Python modules
67
+
68
+ - `harness_docs` explains how to find official harness documentation through `llms.txt`.
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).
73
+
74
+ ### Prompts
75
+
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.
77
+
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:
79
+
80
+ ```bash
81
+ claude --system-prompt-file <this repo>/prompts/sysp.md --append-system-prompt-file <this repo>/prompts/core.md
82
+ ```
83
+
84
+ Replacing the default prompt removes its prose, its dynamic environment block and its scratchpad path. Tool schemas remain available.
85
+
86
+ ## Design decisions, and why
87
+
88
+ - Task skills use Python's packaging and discovery rather than a harness's skill machinery. Their instructions and executable tools can share a module. Host skills bootstrap the kernel and explain how to use its tools with the harness.
89
+ - This repo's hooks are subcommands of `aai-hook` in `aai_coding/harness.py`. The kernel isolation hook for Claude Code and Antigravity comes from `clikernel`. Harness settings register the commands rather than copying their implementations.
90
+ - Each harness's skills and the kernel startup file are symlinks into this checkout. Pulling updates them without copying files. The setup steps merge harness settings and personal instruction files with the user's existing configuration.
91
+ - Where the harnesses differ, a module gives each version in the same place, in a dictionary keyed by harness or in neighbouring bullets. There are no generated per-harness templates.
92
+ - This repo contains agreed team guidance. Model choice, sounds, and personal workflows such as release management belong in each person's `CLAUDE.md`, settings, and local skills. `SETUP.md` identifies which settings are shared and which are personal.
93
+
94
+ ## Using and changing it
95
+
96
+ Activate the workspace's `.venv`, then work in a project checkout. Use `ws-status` to inspect local changes, `ws-sync` to pull and install updates, and `ws-add owner/repo` to add a project. See [the workspace workflow](SETUP.md#using-the-workspace) for details, including what syncing changes.
97
+
98
+ You do not need to start the harness manually each day. Sessions use the skills described in [Tool workflows](#tool-workflows). Agents find Python tools in the pyskills catalog and read their documentation with `doc()` or `pyskills-doc`.
99
+
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.
101
+
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`.
@@ -0,0 +1,83 @@
1
+ # aai-coding
2
+
3
+ `aai-coding` contains Answer.AI's shared configuration, skills, and tools for Claude Code, Codex, and Antigravity. It defines the team's coding and writing guidance, tool permissions, and Python workflows. An LLM setting up the harness should read this README before following `SETUP.md`. The design decisions below also help you advise users who already have a setup.
4
+
5
+ ## Getting started
6
+
7
+ You do not need an Answer.AI account or our existing workspace. [SETUP.md](SETUP.md) starts by creating a workspace in a directory you choose, managed by [fastws](https://github.com/AnswerDotAI/fastws). It then covers harness configuration.
8
+
9
+ The workspace holds separate Git checkouts that share one uv environment. Because its Python projects use editable installs, changes in a checkout are available without reinstalling it.
10
+
11
+ Start with:
12
+
13
+ ```bash
14
+ uvx --from 'fastws-cli>=0.0.14' ws-setup AnswerDotAI/aai-ws ~/aai-ws
15
+ ```
16
+
17
+ Activate the new environment and follow [SETUP.md](SETUP.md). The public [aai-ws baseline](https://github.com/AnswerDotAI/aai-ws) includes aai-coding, fastws, kernel startup and editing tools, and tools used by the Claude hooks. Other Python dependencies are installed as packages.
18
+
19
+ Answer.AI team members use `AnswerDotAI/private-ws` instead of `AnswerDotAI/aai-ws` in that command. Both workspace repos receive shared baseline updates through `ws-sync`. In either setup:
20
+
21
+ - `repos.txt` holds the shared baseline.
22
+ - Gitignored `repos-local.txt` holds personal extras.
23
+ - fastws creates and maintains the workspace's untracked `pyproject.toml`.
24
+
25
+ Reuse existing workspaces. Do not run `ws-setup` on them. See the [team migration instructions](https://github.com/AnswerDotAI/private-ws#migrating-an-existing-workspace).
26
+
27
+ ## Tool workflows
28
+
29
+ Claude Code, Codex, and Antigravity use persistent kernels for Python, file inspection, searching, notebooks, and most edits. Pyskills provide the tools; exhash provides hash-verified editing. Use Bash for shell commands, builds, and Git. Use native tools where the installed skills call for them.
30
+
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
+
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
+
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
+
37
+ ## What is in here
38
+
39
+ The repository contains:
40
+
41
+ - `aai_coding/`: harness-specific Python modules (`harness_docs`, `aai-hook`, and `claudesub`), listed below.
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
+ - `plugins/safecmd/`: a Claude Code plugin that auto-approves allowlisted Bash commands using the `safecmd` package.
44
+ - `prompts/`: shared behavioural rules and a replacement Claude Code system prompt, described below.
45
+ - `SETUP.md`: a setup runbook written as a prompt for an LLM session. It is not an installer script.
46
+
47
+ ### Python modules
48
+
49
+ - `harness_docs` explains how to find official harness documentation through `llms.txt`.
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).
54
+
55
+ ### Prompts
56
+
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.
58
+
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:
60
+
61
+ ```bash
62
+ claude --system-prompt-file <this repo>/prompts/sysp.md --append-system-prompt-file <this repo>/prompts/core.md
63
+ ```
64
+
65
+ Replacing the default prompt removes its prose, its dynamic environment block and its scratchpad path. Tool schemas remain available.
66
+
67
+ ## Design decisions, and why
68
+
69
+ - Task skills use Python's packaging and discovery rather than a harness's skill machinery. Their instructions and executable tools can share a module. Host skills bootstrap the kernel and explain how to use its tools with the harness.
70
+ - This repo's hooks are subcommands of `aai-hook` in `aai_coding/harness.py`. The kernel isolation hook for Claude Code and Antigravity comes from `clikernel`. Harness settings register the commands rather than copying their implementations.
71
+ - Each harness's skills and the kernel startup file are symlinks into this checkout. Pulling updates them without copying files. The setup steps merge harness settings and personal instruction files with the user's existing configuration.
72
+ - Where the harnesses differ, a module gives each version in the same place, in a dictionary keyed by harness or in neighbouring bullets. There are no generated per-harness templates.
73
+ - This repo contains agreed team guidance. Model choice, sounds, and personal workflows such as release management belong in each person's `CLAUDE.md`, settings, and local skills. `SETUP.md` identifies which settings are shared and which are personal.
74
+
75
+ ## Using and changing it
76
+
77
+ Activate the workspace's `.venv`, then work in a project checkout. Use `ws-status` to inspect local changes, `ws-sync` to pull and install updates, and `ws-add owner/repo` to add a project. See [the workspace workflow](SETUP.md#using-the-workspace) for details, including what syncing changes.
78
+
79
+ You do not need to start the harness manually each day. Sessions use the skills described in [Tool workflows](#tool-workflows). Agents find Python tools in the pyskills catalog and read their documentation with `doc()` or `pyskills-doc`.
80
+
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.
82
+
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`.
@@ -0,0 +1,2 @@
1
+ __version__ = "0.1.2"
2
+ BOOT_CALLS = ('doc(clik, pysk)', 'doc(edsk)', 'doc(dsk)', 'doc(exh)', 'doc(rgsk)', 'doc(acp)', 'list_pyskills()')
@@ -0,0 +1,44 @@
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
+
4
+ from fastcore.script import call_parse
5
+
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."""
7
+
8
+ @call_parse(nested=True, pos=['directive'])
9
+ def main(
10
+ directive:str, # The child's task
11
+ Resume:str=None, # A child session id to continue with `directive` as its next prompt, instead of spawning from this session
12
+ sid:bool=False, # Print the prepared child session id instead of launching
13
+ Quiet:bool=False, # Print only the child's final report, not its progress text
14
+ cwd:str=None, # Project directory to work from, for the parent lookup, the child session, and the child itself; the current directory if None
15
+ ):
16
+ "Start or resume a headless Claude child and print its progress and result."
17
+ import json, os, subprocess, sys
18
+ from fastclaude.core import claude_env
19
+ from fastclaude.session import save_sess
20
+ from llmsurgery.ant import prepare_compaction
21
+ from llmsurgery.sess import launch_args
22
+ if cwd: os.chdir(cwd)
23
+ s = Resume
24
+ if not s:
25
+ parent = os.environ.get('CLAUDE_CODE_SESSION_ID')
26
+ if not parent: sys.exit('CLAUDE_CODE_SESSION_ID is unset: claudesub runs from inside a Claude Code session')
27
+ s = save_sess(list(prepare_compaction(parent).records), ts=True)
28
+ if sid: return print(s)
29
+ argv = ['claude', '-p', directive, f'--resume={s}', '--output-format=stream-json', '--verbose',
30
+ '--append-system-prompt', PROTOCOL, *launch_args('claude'), *sys.argv[1:]]
31
+ p = subprocess.Popen(argv, stdout=subprocess.PIPE, text=True, env=claude_env())
32
+ res = None
33
+ for line in p.stdout:
34
+ try: e = json.loads(line)
35
+ except json.JSONDecodeError: continue
36
+ if e.get('type') == 'result': res = e
37
+ elif e.get('type') == 'assistant' and not Quiet:
38
+ for b in e['message'].get('content', []):
39
+ if b.get('type') == 'text' and b['text'].strip(): print(b['text'].strip(), flush=True)
40
+ p.wait()
41
+ if res is None: sys.exit(f'claude exited {p.returncode} without a result')
42
+ if Quiet: print(res.get('result', ''))
43
+ print(f"[claudesub {res['subtype']}] session {res['session_id']}, {res['num_turns']} turns, ${res.get('total_cost_usd', 0):.2f}", flush=True)
44
+ if res['subtype'] != 'success': sys.exit(1)