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
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The repo has exactly **two content homes**, enforced by
`make validate-structure` (CI runs it on every push/PR):

- **`wiki/<domain>/`** — every sub-wiki, following the shared schema in
[`wiki/CLAUDE.md`](wiki/CLAUDE.md). New sub-wikis are added beside the
[`wiki/AGENTS.md`](wiki/AGENTS.md). New sub-wikis are added beside the
existing ones, never at the repo root.
- **`bibliography/`** — the *only* place BibTeX lives. One canonical file
(`pyautomemory.bib`); never add loose `.bib` files anywhere else.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ and the claim support together, then passes `make validate` (CI-enforced on
every push).

The wiki schema is defined in
[`wiki/CLAUDE.md`](wiki/CLAUDE.md) and inherited by every
[`wiki/AGENTS.md`](wiki/AGENTS.md) and inherited by every
sub-wiki. How agents should read this repo: [AGENTS.md](AGENTS.md). The
organism this repo is the Memory of:
[PyAutoBrain/ORGANISM.md](https://github.com/PyAutoLabs/PyAutoBrain/blob/main/ORGANISM.md),
Expand Down
2 changes: 1 addition & 1 deletion bibliography/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ personal library in 2026-07 — the merge audit is in git history.)
2. Search `pyautomemory.bib` by DOI, arXiv ID, and title. Reuse the existing canonical key;
otherwise add verified metadata under a unique, stable author-year key.
3. Add a compact section to the relevant `../wiki/<domain>/sources/*.md` using the inherited
schema in [`../wiki/CLAUDE.md`](../wiki/CLAUDE.md).
schema in [`../wiki/AGENTS.md`](../wiki/AGENTS.md).
4. Add concept/entity links only where the paper materially supports existing text.
5. Run `make validate-literature-citations`.

Expand Down
6 changes: 3 additions & 3 deletions index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
The PyAuto organism's long-term knowledge: a multi-domain knowledge base of
accumulated scientific and project knowledge, organised as several
Karpathy-style LLM wikis over a shared canonical bibliography. Each sub-wiki uses
the schema in [`wiki/CLAUDE.md`](wiki/CLAUDE.md).
the schema in [`wiki/AGENTS.md`](wiki/AGENTS.md).

## Sub-wikis

Expand Down Expand Up @@ -62,8 +62,8 @@ the schema in [`wiki/CLAUDE.md`](wiki/CLAUDE.md).
## Schema

The schema is defined once in
[`wiki/CLAUDE.md`](wiki/CLAUDE.md) and inherited by
all sub-wikis. Each sub-wiki has its own `CLAUDE.md` that diverges
[`wiki/AGENTS.md`](wiki/AGENTS.md) and inherited by
all sub-wikis. Each sub-wiki has its own `AGENTS.md` that diverges
only on the `## Scope` section. Per-page frontmatter, naming
conventions, `[[wiki-links]]`, status flags (`stub | drafted |
reviewed`), and source-page layout are uniform across sub-wikis.
Expand Down
2 changes: 1 addition & 1 deletion reading-queue.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Papers waiting to be read and filed. Format:
- A line that is *only* an arXiv link is still a paper — the title was just
never written, so the board labels it `arXiv:<id>`.
- Filing a read paper: add its canonical entry to `bibliography/`, stub it in
the matching `wiki/<domain>/sources/*.md` page per `wiki/CLAUDE.md`, then
the matching `wiki/<domain>/sources/*.md` page per `wiki/AGENTS.md`, then
mark the line DONE and run `make validate`.

(Moved from `admin_jammy/papers.md` on 2026-05-22, when this repo — then
Expand Down
10 changes: 5 additions & 5 deletions scripts/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
how mature each sub-wiki is — each work queue carrying a one-tap 📋 copy
block holding a paste-ready Claude Code prompt that executes this repo's own
documented workflow (``bibliography/README.md`` "Adding a paper",
``wiki/CLAUDE.md``'s schema) — plus contents cards with ``/memory <domain>``
``wiki/AGENTS.md``'s schema) — plus contents cards with ``/memory <domain>``
recall chips. Reading-queue sections expand to the individual papers: each
title links out to the arXiv abstract page (or, when the line carries no ref,
a title search — see ``scripts/arxiv_refs.py``), carries a 📄 button onto the
Expand Down Expand Up @@ -508,7 +508,7 @@ def _queue_issue_url(snapshot: dict, section: str, paper: dict,
f"{where}\n\n"
f"{notes}\n\n"
"Workflow (bibliography/README.md \"Adding a paper\", "
"wiki/CLAUDE.md): verify the paper against an authoritative "
"wiki/AGENTS.md): verify the paper against an authoritative "
"record, add its canonical entry to the bibliography/ BibTeX "
"file, add a minimal section to the matching "
"wiki/<domain>/sources/ page — canonical key plus the notes "
Expand All @@ -522,7 +522,7 @@ def _queue_issue_url(snapshot: dict, section: str, paper: dict,
f"{where}\n\n"
f"{notes}\n\n"
"Workflow (bibliography/README.md \"Adding a paper\", "
"wiki/CLAUDE.md): verify the paper against an authoritative "
"wiki/AGENTS.md): verify the paper against an authoritative "
"record, add its canonical entry to the bibliography/ BibTeX "
"file, stub it in the matching wiki/<domain>/sources/ page — "
"incorporating the notes above — mark its queue line "
Expand Down Expand Up @@ -661,7 +661,7 @@ def _read_prompt(snapshot: dict, section: str) -> str:
f"{repo}/reading-queue.md: verify it against an authoritative "
f"record, add its canonical entry to the bibliography/ BibTeX "
f"file, stub it in the matching wiki/<domain>/sources/ page per "
f"wiki/CLAUDE.md, mark its queue line 'DONE <date> — <title>', "
f"wiki/AGENTS.md, mark its queue line 'DONE <date> — <title>', "
f"and run make validate.")


Expand All @@ -678,7 +678,7 @@ def _stub_prompt(snapshot: dict, wiki: str) -> str:
repo = snapshot.get("repo") or "the memory repo"
return (f"Upgrade one stub page in {repo}/wiki/{wiki}/ to drafted: verify "
f"its claims against the cited sources, expand it per the schema "
f"in wiki/CLAUDE.md, set status: drafted, and run make validate.")
f"in wiki/AGENTS.md, set status: drafted, and run make validate.")


def _inbox_freshness(snapshot: dict, key: str = "inbox_last_digest") -> dict:
Expand Down
6 changes: 3 additions & 3 deletions scripts/validate_wikilinks.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Resolve every ``[[wikilink]]`` in the wiki against the pages that exist.

``[[slug]]`` is the wiki's cross-reference mechanism (``wiki/CLAUDE.md``,
``[[slug]]`` is the wiki's cross-reference mechanism (``wiki/AGENTS.md``,
"Cross-references"): a slug is a page's filename without ``.md``, slugs are
unique across sub-wikis so a link needs no path (``wiki/smbh/CLAUDE.md``), and
unique across sub-wikis so a link needs no path (``wiki/smbh/AGENTS.md``), and
a link with no target yet is *legal* — it marks a page somebody meant to write.

That last rule is why this lint is a **ratchet, not a gate**. The wiki carries
Expand Down Expand Up @@ -64,7 +64,7 @@

#: The schema page itself is documentation *of* the syntax, not a page of
#: references: every example slug in it is illustrative.
SKIP_FILES = ("wiki/CLAUDE.md",)
SKIP_FILES = ("wiki/AGENTS.md", "wiki/CLAUDE.md")


def strip_code(text: str) -> str:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_board.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def test_work_queue_prompts_reference_the_documented_workflow(tmp_path):
assert "reading-queue.md" in html # file-the-next-paper prompt
assert "make validate" in html # every prompt ends at the gate
assert "/memory demo" in html # the recall chip
assert "wiki/CLAUDE.md" in html # the schema anchor
assert "wiki/AGENTS.md" in html # the schema anchor


def test_paper_links_and_issue_actions(tmp_path):
Expand Down
167 changes: 167 additions & 0 deletions wiki/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
# PyAutoMemory wikis — shared schema + usage rules

Every sub-wiki under `wiki/` gives an AI assistant broad scientific context
for one domain. They follow Karpathy's "LLM Wiki" pattern: concise,
cross-linked pages are read at query time, while canonical citation metadata
lives separately in [`../bibliography/`](../bibliography/README.md). This
file defines the schema once; each sub-wiki's own `AGENTS.md` diverges only
on scope.

## Layout

```
PyAutoMemory/ # repo root
├── wiki/ # all sub-wikis (in git)
│ ├── AGENTS.md # this file — schema + usage rules
│ └── <domain>/ # one domain per sub-wiki, e.g. lensing/
│ ├── AGENTS.md # the sub-wiki's scope notes
│ ├── index.md # the sub-wiki's own navigation
│ ├── log.md # append-only compilation log
│ ├── concepts/ # one topic per page — the science
│ ├── entities/ # named things: surveys, instruments, software
│ ├── sources/ # compact claim support (one paper = one section)
│ └── seed/ # unverified 2026-05 import, not citeable yet
└── bibliography/ # canonical BibTeX and citation tooling
```

Papers are the ground truth; wiki pages are syntheses. If they disagree, update
the wiki and note the change in the sub-wiki's `log.md`.

## References and citation metadata

- `sources/*.md` records compact guidance about what claims a paper supports.
- `seed/*.md` is the same shape, unverified: the 2026-05 import's stubs, held
apart so nothing cites them by accident.
- `../bibliography/pyautomemory.bib` records canonical metadata and keys.

Never record local PDF paths or fabricate metadata — source PDFs live
off-repo. One declared exception: a page's frontmatter may carry an
`archive:` list — the **read-only archival filenames** of the off-repo PDFs
the 2026-05 import seeded it from (e.g. `Strong_Lens/Suyu2016Holicow.pdf`).
These are provenance history, never live paths; nothing may resolve or grow
them — new papers cite the bibliography, not an archive path. A canonical
key is local to PyAutoMemory: resolve it against a target project's `.bib`
before patching LaTeX. See
[`../bibliography/README.md`](../bibliography/README.md) for the workflow.

## Page types

| Type | Folder | Scope |
|-------------|--------------|-------------------------------------------------------|
| Concept | `concepts/` | One scientific concept (e.g. mass-sheet degeneracy) |
| Entity | `entities/` | One named thing (survey, lens, code, collaboration) |
| Sources | `sources/` | Claim support for one topic, one section per paper |
| Seed | `seed/` | Source pages from the 2026-05 import whose every entry is still a filename-inferred stub (`Canonical BibTeX key: TODO`) — never cite one until the paper is verified and the entry promoted into `sources/` |
| Index/log | root | Navigation and provenance |

## Naming

- File names are lowercase kebab-case: `mass-sheet-degeneracy.md`,
`h0licow.md`, `time-delay-cosmography.md`.
- One concept per concept page. If a page tries to cover two ideas, split it.
- Source-collection pages are named by topic: `sources/dark-matter-substructure.md`.

## Cross-references

Use `[[page-slug]]` for wiki-internal links — for example
`[[mass-sheet-degeneracy]]` or `[[h0licow]]`. Slugs match the filename without
`.md`; a `sources/` page also answers to `[[sources-<topic>]]` and a `seed/`
page to `[[seed-<topic>]]`. A `[[link]]` that has no target file yet is fine —
it marks a future page to write, and `scripts/validate_wikilinks.py` ratchets
that backlog (it fails only on a *new* unresolved target, against
`scripts/wikilink_baseline.txt`).

External references use verified DOI, arXiv, journal, or author/year/title
metadata, never a local path.

## Frontmatter

Every wiki file starts with YAML frontmatter:

```yaml
---
title: Mass-sheet degeneracy
type: concept # concept | entity | sources | meta
topics: [degeneracies, cosmography]
sources: # optional — papers most relevant to this page
- Suyu et al. 2017 — H0LiCOW overview
- Birrer et al. 2020 — TDCOSMO IV
status: stub # stub | drafted | reviewed
---
```

Sources may be `[]` for pages that synthesize general field knowledge.

## Concept page structure

```
# Title

## TL;DR
One paragraph an assistant can quote back to a user.

## What it is
The physics / definition.

## Why it matters
How this concept shows up in the decisions the domain's software users make.

## Key results from the literature
Bullet list. Each bullet ends with `([[author-year-stub]])` so the LLM can
follow the link to the per-paper section.

## See also
- [[related-concept-1]]
- [[related-concept-2]]
```

## Entity page structure

Same idea but the headings are "What it is / Key facts / Papers / See also".
Use entity pages for: surveys (BELLS, H0liCOW), specific objects
(Abell 1201, the Cosmic Horseshoe), software (PyAutoLens, lenstronomy),
collaborations (TDCOSMO, Space Warps).

## Source-collection page structure

```
# Sources: <topic>

Papers covering this topic. Each paper has its own H2 section; cross-link with
`[[sources-<topic>#author-year-slug]]`.

## Author Year — short tag

**Canonical BibTeX key:** `KeyYYYY`
**Reference:** DOI/arXiv/journal reference if known
**Concepts:** [[concept-1]], [[concept-2]]

**Supports:**
- Claim this paper directly supports.
- Another claim this paper directly supports.

**Use when:**
- Situation where the citation is appropriate.

**Do not use for:**
- Similar but unsupported claim.
```

Keep entries short: normally 2–5 support bullets and no long prose. Do not copy
abstracts or infer claims from filenames. Add a TODO when support is unverified.

## How the assistant should use a wiki

1. On a user question, first open the sub-wiki's `index.md`.
2. Follow the relevant `concepts/` or `entities/` page.
3. Follow the source entry for claim scope and its canonical key for metadata.
4. Resolve that key against downstream `.bib` files before changing LaTeX.
5. If support or metadata is unclear, read the public paper and add a TODO
rather than guessing. Log verified upgrades.

## Adding a sub-wiki

Create `wiki/<domain>/` with its own `AGENTS.md` (scope notes only — this
schema is inherited, not copied), `index.md`, `log.md`, and the page folders it
needs (`seed/` only if it is taking an unverified import). Give it a row in the
repo-root `index.md` and `README.md` tables.
Loading
Loading