Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .claude/skills/ag_build_imaging_model.md
1 change: 1 addition & 0 deletions .claude/skills/ag_configure_search.md
1 change: 1 addition & 0 deletions .claude/skills/ag_debug_fit_failure.md
1 change: 1 addition & 0 deletions .claude/skills/ag_load_results.md
1 change: 1 addition & 0 deletions .claude/skills/ag_plot_fit.md
1 change: 1 addition & 0 deletions .claude/skills/ag_prepare_imaging_data.md
1 change: 1 addition & 0 deletions .claude/skills/ag_run_search.md
1 change: 1 addition & 0 deletions .claude/skills/ag_setup_environment.md
1 change: 1 addition & 0 deletions .claude/skills/ag_simulate_dataset.md
44 changes: 28 additions & 16 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@ ask one focused question β€” never default to the longest possible explanation.
```
Exit 0 = documented API matches the stack. Exit 1 = genuine drift: recommend the pinned
version or an audit β€” [`skills/ag_audit_skill_apis.md`](./skills/ag_audit_skill_apis.md)
owns that procedure. Exit 2/3 = absent/broken stack: report the interpreter, then diagnose
and repair the environment directly
([`wiki/core/operations/installation.md`](./wiki/core/operations/installation.md) for the
install routes, [`wiki/core/operations/sandbox.md`](./wiki/core/operations/sandbox.md) for
the cache env vars). The `ag_setup_environment` skill that will own the repair itself is not
written yet; `PENDING.md` tracks it. Skip this step by default in maintainer mode.
owns that procedure. Exit 2/3 = absent/broken stack: report the interpreter, then follow
[`skills/ag_setup_environment.md`](./skills/ag_setup_environment.md), which owns the repair
(`wiki/core/operations/installation.md` for the install routes and
`wiki/core/operations/sandbox.md` for the cache env vars are the pages it cites).
Skip this step by default in maintainer mode.

## Safety invariants β€” default non-negotiable

Expand All @@ -44,10 +43,11 @@ deliberate refactor). Two are NEVER overridden: the real-data gate and never-rew
real data. **If you can't plot it yourself β€” no code execution, e.g. a GitHub-connector chat
β€” the gate is not waived: ask the user to plot and inspect the data, and to confirm both (a)
contaminants and (b) the mask extent, before you compose the fit.** These are the questions
every real-data run must ask, on every harness. Ground the procedure in
every real-data run must ask, on every harness. The procedure itself is owned by
[`skills/ag_prepare_imaging_data.md`](./skills/ag_prepare_imaging_data.md) β€” read it before
the first real-data fit; it is grounded in
`autogalaxy_workspace:scripts/imaging/data_preparation/start_here.py` and the
`imaging/start_here.py` masking section until the `ag_prepare_imaging_data` skill that will own
it is written (see `PENDING.md`). Simulated data is exempt.
`imaging/start_here.py` masking section. Simulated data is exempt.
- **Code gate.** A PreToolUse hook validates PyAuto* symbols against the installed library
and blocks ones written from memory. If blocked, don't guess β€” grep `skills/` or introspect
`dir()`, then re-run. The hook fires only on harnesses with hook support (Claude Code);
Expand Down Expand Up @@ -81,10 +81,13 @@ Map every request onto one or more layers:
task. Library-API skills are `ag_<task>.md` and produce/evolve a Python script;
project-workflow skills (`start-new-project.md`, `contribute-upstream.md`) drive repo-level
operations. Skills starting with `_` (`_style.md`, `_bootstrap_skill.md`) are meta-skills β€”
don't surface them when answering science questions. **No `ag_*` skill for doing galaxy
science is written yet**: the three that exist (`ag_audit_skill_apis`, `ag_update_wiki`,
`ag_refresh_api_docs`) are maintenance workflows for this repo's own content.
`skills/README.md` lists all seven live skills and catalogues the rest by phase with the
don't surface them when answering science questions. The **core modelling loop** is live β€”
`ag_setup_environment`, `ag_prepare_imaging_data`, `ag_simulate_dataset`,
`ag_build_imaging_model`, `ag_configure_search`, `ag_run_search`, `ag_plot_fit`,
`ag_load_results`, `ag_debug_fit_failure` β€” and is what a galaxy-science request routes to.
Three further `ag_*` skills (`ag_audit_skill_apis`, `ag_update_wiki`, `ag_refresh_api_docs`)
are maintenance workflows for this repo's own content, not science workflows.
`skills/README.md` lists all sixteen live skills and catalogues the rest by phase with the
`autogalaxy_workspace` script that grounds each one. Never activate a skill name you
have not confirmed is a file on disk.
3. **Wiki** (`wiki/**/*.md`) β€” *content*: what a Sersic profile is, which searches exist,
Expand Down Expand Up @@ -226,16 +229,25 @@ When **not** in maintainer mode, commit at natural checkpoints (a script + its
- **Working directories.** Committed scripts β†’ `scripts/`; throwaway plots/data dumps β†’
`scripts/scratch/` (gitignored); `search.fit(...)` output β†’ `./output/`.
- **Plot path announcement.** The plot API is **functional-only**: pass
`output_path="scripts/scratch/<context>/"`, `output_filename=...`, `output_format="png"`
straight to the `aplt.*` call (e.g. `aplt.subplot_imaging_dataset`, `aplt.subplot_fit_imaging`).
`output_path="scripts/scratch/<context>/"` and `output_format="png"` straight to the `aplt.*`
call (e.g. `aplt.subplot_imaging_dataset`, `aplt.subplot_fit_imaging`).
**The object-oriented plotters (`aplt.FitImagingPlotter`, `ImagingPlotter`, `GalaxyPlotter`,
`GalaxiesPlotter`, `InversionPlotter`, …) and the `aplt.MatPlot2D` / `aplt.Include2D` /
`aplt.Output` objects have been removed β€” do not use them.
They are the #1 stale-from-memory API error, especially on a harness with no code gate (a
connector chat).** Wrong:
`aplt.FitImagingPlotter(fit=fit, mat_plot_2d=aplt.MatPlot2D(...)).subplot_fit_imaging()`.
Right:
`aplt.subplot_fit_imaging(fit=fit, output_path="scripts/scratch/ring/", output_filename="fit", output_format="png")`.
`aplt.subplot_fit_imaging(fit=fit, output_path="scripts/scratch/ngc1300/", output_format="png")`.
**`output_filename` is not universal** β€” passing it to a call that does not take it raises
`TypeError`. Only `plot_array`, `plot_grid`, `subplot_imaging_dataset`,
`subplot_imaging_dataset_list`, `subplot_interferometer_dataset` and
`subplot_interferometer_dirty_images` accept it;
`subplot_galaxies` names its file with `auto_filename`; and the remaining fit and galaxy
subplots write a **fixed stem** into `output_path` (`subplot_fit_imaging` β†’ `fit.png`), so the
*directory* is what separates one context from another. Check the signature β€”
[`skills/ag_plot_fit.md`](./skills/ag_plot_fit.md) and
[`wiki/core/api/plotting.md`](./wiki/core/api/plotting.md) carry the full split.
If unsure a PyAuto* symbol exists, ground it against `skills/` or `dir(aplt)` β€” never write it
from memory. Then `print(...)` the absolute path, and after running **quote that absolute path**
and offer to open it (platform opener: `open` on macOS, `xdg-open` on Linux,
Expand Down
31 changes: 8 additions & 23 deletions PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,29 +90,14 @@ where it is acted on β€” the run-time and GPU sections of `concepts/non_linear_s

## Phase 4a β€” the core modelling loop (9 skills)

- [ ] `skills/ag_setup_environment.md` β€” grounding: `guides/modeling/bug_fix.py`, plus
`wiki/core/operations/installation.md` and `wiki/core/operations/sandbox.md` (both live
since Phase 3) and the RTD installation pages they were written from. `AGENTS.md`'s
session-start step and `skills/ag_audit_skill_apis.md` route environment failures here;
until it exists they route to `--check-install` and those two pages.
- [ ] `skills/ag_prepare_imaging_data.md` β€” grounding:
`imaging/data_preparation/start_here.py`, `imaging/data_preparation/examples/`,
`imaging/data_preparation/gui/`. **This skill owns the real-data inspection gate's
procedure**, which `AGENTS.md` currently points at the workspace scripts for.
- [ ] `skills/ag_simulate_dataset.md` β€” grounding: `imaging/simulator.py`,
`imaging/simulator_sersic.py`, `imaging/simulator_sample.py`.
- [ ] `skills/ag_build_imaging_model.md` β€” grounding: `imaging/start_here.py`,
`imaging/modeling.py`, `guides/modeling/cookbook.py`.
- [ ] `skills/ag_configure_search.md` β€” grounding: `guides/modeling/searches.py`,
`guides/modeling/customize.py`.
- [ ] `skills/ag_run_search.md` β€” grounding: `imaging/modeling.py`,
`guides/modeling/bug_fix.py`.
- [ ] `skills/ag_plot_fit.md` β€” grounding: `imaging/plot.py`, `guides/plot/start_here.py`,
`guides/plot/plotters.py`.
- [ ] `skills/ag_load_results.md` β€” grounding: `guides/results/start_here.py`,
`guides/results/aggregator/`, `guides/results/latent_variables.py`.
- [ ] `skills/ag_debug_fit_failure.md` β€” grounding: `guides/modeling/bug_fix.py`,
HowToGalaxy `chapter_2_modeling/tutorial_4_dealing_with_failure`.
**Delivered.** All nine core-loop skills are on disk with `.claude/skills/` symlinks, rows in
`wiki/core/external/skill_citation_map.md` and entries in the `skills/README.md` Index:
`ag_setup_environment`, `ag_prepare_imaging_data`, `ag_simulate_dataset`,
`ag_build_imaging_model`, `ag_configure_search`, `ag_run_search`, `ag_plot_fit`,
`ag_load_results`, `ag_debug_fit_failure`. Two `AGENTS.md` hand-offs closed with them: the
session-start environment repair now routes to `ag_setup_environment`, and the real-data
inspection gate's procedure is owned by `ag_prepare_imaging_data` rather than pointing at the
workspace scripts directly.

## Phase 4b β€” features beyond a single smooth profile (8 skills)

Expand Down
6 changes: 3 additions & 3 deletions llms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ from memory.

Read order: [AGENTS.md](./AGENTS.md) β†’ [skills/README.md](./skills/README.md) β†’ the relevant skill β†’ [wiki/](./wiki). **In chat, lead by engaging.** Ask what the user is trying to do, ask them to describe or plot their data (you can't inspect files on their machine), plan the model, and draft the scripts β€” do this *first*, and never open a reply with what you can't do. The assistant can also route to examples, explain galaxy morphology and surface-brightness fitting, and review pasted scripts / errors / figures. It cannot run code or guarantee drafts against the installed PyAutoGalaxy version, so switching to a local coding agent (Claude Code, Codex, or Codex web with the repo connected) is the step for **actually running the fit or iterating live** β€” raise that handoff when execution becomes the blocker, not as an opening disclaimer.

**⚠️ API currency β€” read before writing any PyAutoGalaxy code.** Older PyAutoGalaxy releases are heavily represented in model training data and their API is **out of date**. Do **not** write PyAutoGalaxy from memory. The single most common stale error: **plotting is functional now.** Use `aplt.subplot_fit_imaging(fit=fit, output_path=..., output_filename=..., output_format="png")` and `aplt.subplot_imaging_dataset(dataset=..., ...)`. The old object-oriented plotters β€” `aplt.FitImagingPlotter`, `aplt.ImagingPlotter`, `aplt.GalaxyPlotter`, `aplt.GalaxiesPlotter`, `aplt.InversionPlotter` β€” and the `aplt.MatPlot2D` / `aplt.Include2D` / `aplt.Output` configuration objects have all been **removed**; never emit them. The whole plotting surface is module-level functions, and `dir(autogalaxy.plot)` is the authoritative list. If you can't point at a live example or a `dir()` listing for a call, say it's unverified rather than guessing.
**⚠️ API currency β€” read before writing any PyAutoGalaxy code.** Older PyAutoGalaxy releases are heavily represented in model training data and their API is **out of date**. Do **not** write PyAutoGalaxy from memory. The single most common stale error: **plotting is functional now.** Use `aplt.subplot_fit_imaging(fit=fit, output_path=..., output_format="png")` and `aplt.subplot_imaging_dataset(dataset=..., output_path=..., output_filename=..., output_format="png")` β€” note that `output_filename` is accepted by the dataset subplots, `plot_array` and `plot_grid`, but **not** by `subplot_fit_imaging`, which writes a fixed `fit.png` into `output_path` (passing it raises `TypeError`). The old object-oriented plotters β€” `aplt.FitImagingPlotter`, `aplt.ImagingPlotter`, `aplt.GalaxyPlotter`, `aplt.GalaxiesPlotter`, `aplt.InversionPlotter` β€” and the `aplt.MatPlot2D` / `aplt.Include2D` / `aplt.Output` configuration objects have all been **removed**; never emit them. The whole plotting surface is module-level functions, and `dir(autogalaxy.plot)` is the authoritative list. If you can't point at a live example or a `dir()` listing for a call, say it's unverified rather than guessing.

**⚠️ This assistant is young.** Four skills exist (two meta, two project-workflow); the `ag_*` task skills and most of `wiki/core/` are still being written, phase by phase. [`skills/README.md`](./skills/README.md) and [`PENDING.md`](./PENDING.md) say exactly what is present and what is planned, and every planned item names the `autogalaxy_workspace` script that grounds it. **Answer from those grounding scripts and say that you did** β€” never describe a pending skill or wiki page as though you had read it.
**⚠️ This assistant is young.** Sixteen skills exist: the nine-skill core modelling loop (environment, data preparation, simulation, model building, search configuration, running the fit, plotting, results, debugging), two meta, two project-workflow and three maintenance. The Phase-4b **feature** skills (bases and MGE, pixelisations, ellipse fitting, multi-dataset, interferometry, multi-galaxy, search chaining), the literature wiki and the benchmark suite are still being written, phase by phase. [`skills/README.md`](./skills/README.md) and [`PENDING.md`](./PENDING.md) say exactly what is present and what is planned, and every planned item names the `autogalaxy_workspace` script that grounds it. **Answer from those grounding scripts and say that you did** β€” never describe a pending skill or wiki page as though you had read it.

## Agent instructions (canonical)

Expand All @@ -32,7 +32,7 @@ Read order: [AGENTS.md](./AGENTS.md) β†’ [skills/README.md](./skills/README.md)

## Reference

- [wiki/core/index.md](./wiki/core/index.md): curated PyAuto\* reference. The `stack/` pages (one per library) are live; concepts, API catalogues, operations and external routing arrive in a later phase, and the index itself marks the gap.
- [wiki/core/index.md](./wiki/core/index.md): curated PyAuto\* reference. The `stack/`, `api/`, `concepts/`, `operations/` and `external/` sections are live; the index itself names the pages still missing (dataset layout, HPC).
- [PENDING.md](./PENDING.md): the authoritative ledger of every unwritten skill and wiki page, with its grounding script and target phase.

## Runnable examples & tutorials (elsewhere)
Expand Down
Loading
Loading