Skip to content

Analysis-task conventions: task_paths, task template, AGENTS.md - #12

Closed
Marius1311 wants to merge 3 commits into
mainfrom
feat/analysis-task-conventions
Closed

Analysis-task conventions: task_paths, task template, AGENTS.md#12
Marius1311 wants to merge 3 commits into
mainfrom
feat/analysis-task-conventions

Conversation

@Marius1311

Copy link
Copy Markdown
Member

Adds working conventions for agent-run analysis tasks, so a repo made from this template starts consistent instead of growing its own layout. Ported from what we settled in gli3_merscope_analysis and generalised.

The model

A task is one agent session, one worktree, one branch, one directory (analysis/<topic>/.../<name_vN>/). Its outputs split by durability, not by kind:

dir tracked lives in
results/, reports/ yes the calling checkout — rides the PR
figures/, outputs/, logs/ no the main checkout — survives worktree teardown

task_paths(__file__) resolves both.

Why main_checkout() doesn't use FilePaths.ROOT

_find_root walks up for a .git marker. A worktree's .git is a file, and it exists, so it stops at the worktree. Untracked output would then be written into a directory that later disappears — silently, because worktrees are gitignored so git never warns about them. git rev-parse --path-format=absolute --git-common-dir gives the main checkout from any worktree.

The same trap catches Slurm: --output resolves against the submit directory, so slurm/submit.sh passes it absolutely.

Data rules

AGENTS.md states the ones that are genuinely general: accumulate by addition (commutative, so concurrent sessions can't lose each other's work); never write your in-memory object back over a shared one; which object is current is stated per session and recorded in the task README rather than hardcoded, which is how a config ends up pointing at something retired months ago.

Other changes

  • .gitignore gains outputs/ and logs/ (unanchored, matching at any depth), plus negations so a task's small evidence tables and HTML report stay tracked — they are what a reviewer actually reads on GitHub.
  • AGENTS.md owns the conventions; CLAUDE.md is a pointer to it and copilot-instructions.md defers to it rather than restating, so there is one owner per fact.
  • The top-level figures/ keeps its role for curated output (talks, papers), which is distinct from task output.

Notebook conventions are unchanged — humans work in the main checkout and the same output rules apply.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VYsKhgGuNCFtxqFhSLGtCK

Marius1311 and others added 3 commits August 21, 2026 15:12
Adds the working conventions for agent-run analysis tasks, so a repo made from
this template starts consistent instead of growing its own layout.

A task is one session, one worktree, one branch, one directory. Its outputs split
by durability rather than by kind: tracked `results/`/`reports/` stay in the
calling checkout and ride the PR, while untracked `figures/`/`outputs/`/`logs/`
are anchored to the main checkout so they survive the worktree being removed.
`task_paths(__file__)` resolves both.

The anchoring is why `main_checkout()` uses `git rev-parse --git-common-dir`
rather than `FilePaths.ROOT`: `_find_root` walks up for a `.git` marker, and a
worktree's `.git` is a file that exists, so it stops at the worktree. Untracked
output would then be written somewhere that later disappears — silently, since
worktrees are gitignored and git never warns about them.

Also:
- `.gitignore` gains `outputs/` and `logs/` (unanchored, matching at any depth)
  plus negations so a task's small evidence tables and HTML report stay tracked —
  they are what a reviewer actually reads on GitHub.
- `AGENTS.md` carries the conventions; `CLAUDE.md` is a pointer to it, and
  `copilot-instructions.md` defers to it rather than restating.

The top-level `figures/` keeps its role for curated output (talks, papers), which
is distinct from task output.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VYsKhgGuNCFtxqFhSLGtCK
…r-agnostic

The template shipped an Euler-flavoured slurm/ pair that restated four facts owned
by the euler-slurm skill (--output semantics, the missing-log-dir requeue loop, sbatch
idiom, MAIN resolution) — two of them already drifted: OMP_NUM_THREADS was dropped
while requesting 8 CPUs, and the requeue loop was described as a silent failure.

The one fact the template owns is a path fact, not a scheduler fact: log paths come
from task_paths().logs and are passed absolutely. That is now stated once, without
naming a scheduler.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VYsKhgGuNCFtxqFhSLGtCK
… instructions

Paths had two parallel mechanisms. `_find_root` walked up for a marker while
`main_checkout` asked git, and `FilePaths.ROOT` used the former — so central data would
resolve into a worktree if the package were ever installed from one, the hazard AGENTS.md
had to warn about. There is now one resolver, git-first with the marker walk as fallback,
and `FilePaths.ROOT` is it.

`DatasetPaths` and `TaskPaths` were the same idea twice with different spellings
(properties vs fields, `create()` vs `ensure()`). Both are now field-only dataclasses over
a shared base with a single `create()`, and both are built by expanding the directory-name
tuples, so a directory name is written once. `EXAMPLE_DATASET` is gone: `FilePaths.dataset()`
is the one way to reach a dataset.

The copilot instructions restated AGENTS.md; they are now a pointer, matching CLAUDE.md,
and the session rule no longer names a specific agent's exit command.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VYsKhgGuNCFtxqFhSLGtCK
@Marius1311

Copy link
Copy Markdown
Member Author

Superseded by #13, which keeps only the housekeeping half: agent-neutral guidance (AGENTS.md canonical, CLAUDE.md and copilot instructions as pointers) and a single git-based root resolver with dataset paths as a directory set.

The analysis-task conventions — task_paths, the task template, the tracked/untracked split, the write-back rules — are held back deliberately. They are untested, and the template is the wrong place to find out whether they work. They will be exercised in gli3_merscope_analysis first and ported here only once practice has shaped them.

Branch feat/analysis-task-conventions is kept for reference.

@Marius1311 Marius1311 closed this Aug 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant