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 .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ body:
id: version
attributes:
label: Version or commit
placeholder: v0.4.0, or the short commit SHA
placeholder: v0.6.0, or the short commit SHA
validations:
required: true

Expand Down
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## Checklist

- [ ] `npm run ci` passes locally (validate, coverage, lint, type-check, test, build, examples).
- [ ] `npm run ci` passes locally (validate, coverage, lint, type-check, test, build, examples, eval self-check).
- [ ] New or changed behaviour has a test in `test/`.
- [ ] If the ontology changed: `npm run validate` reports 0 errors, and
`ontology/periodic-table.schema.json` still describes the shape.
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ jobs:
timeout-minutes: 10

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5

- uses: actions/setup-node@v4
- uses: actions/setup-node@v5
with:
node-version: 22
node-version-file: .nvmrc
cache: npm

- run: npm ci
Expand Down Expand Up @@ -57,11 +57,11 @@ jobs:
timeout-minutes: 10

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5

- uses: actions/setup-node@v4
- uses: actions/setup-node@v5
with:
node-version: 22
node-version-file: .nvmrc
cache: npm

- run: npm ci
Expand Down
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22
95 changes: 95 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Changelog

All notable changes to this project are documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added

- A runtime package root entry point (`src/index.ts`) exporting the ontology
loader, schema validator, composition prompts, and core types. The root used
to resolve to `atoms/core.ts`, which is types only and compiled to `export {}`,
so importing the package by name yielded an empty namespace.
- `engines.node` (`>=20.6.0`) and `.nvmrc`, which CI now reads, so the supported
Node version is declared once instead of repeated in both workflow jobs.
- A packaging test that fails when an entry point resolves outside `files`, and a
public-API test that asserts the root entry actually exports runtime symbols.

### Changed

- `npm run ci` now runs the evaluation self-check, matching the GitHub Actions
workflow and the README's "everything CI runs" claim.
- CI uses `actions/checkout@v5` and `actions/setup-node@v5`, which run on the
supported action runtime instead of the deprecated Node 20 one.

## [0.6.0] - 2026-10-22

### Added

- Behaviour tests for all 35 object atoms. One data-driven suite checks metadata
against the ontology, declares every `PropertyDef` the factory writes, fills
required fields, applies documented defaults, and round-trips optional inputs.
- `test/atom-test-coverage.test.ts`, a guard that fails when an atom module is
imported by no test. It is a floor, not proof of assertion quality, but it
catches entire untested families.
- `test/project.test.ts`, which fails when package, lockfile, ontology, and
citation versions drift; when the atom count in the README badge, package
description, or citation disagrees with the ontology; when the shipped version
has no dated CHANGELOG entry; or when a test file is missing from the README
inventory.

### Changed

- Bumped the version to 0.6.0 in `package.json`, `package-lock.json`,
`ontology/periodic-table.json`, and `CITATION.cff`.
- README test inventory now lists every test file, and the status section reports
that all six families have behaviour tests.
- The published package now includes `docs/`, `CHANGELOG.md`, and `CITATION.cff`,
so the documentation links in the README resolve for npm consumers.
- Corrected `docs/CONTRIBUTING.md`, which claimed `npm run coverage` would show a
drop when an atom has no test. Coverage measures implementations; the new
import guard measures test presence.

### Fixed

- The ontology declared version 0.4.0 while the package and citation declared
0.5.0. A consistency test now prevents the drift.
- `createSubscription` declared `cancelAt` in `SubscriptionProperties` but did
not accept or set it. It now does.
- `createMessage` declared `readBy` in `MessageProperties` but did not accept or
set it. It now does.
- The abstract in `CITATION.cff` still claimed composition was "more reliable and
token-efficient", contradicting the withdrawn 39% result. The claim is gone.

## [0.5.0] - 2026-10-16

### Added

- Test coverage for all 8 intelligence atoms (Search, Summarize, Classify, Recommend, Analyze, Extract, Generate, Prompt)
- Test coverage for all 25 properties atoms (Status, Text, Number, Date, DateTime, Currency, Enum, Boolean, ID, Owner, Priority, CreatedAt, UpdatedAt, Score, Percent, Duration, Count, JSON, Address, AI, StartDate, EndDate, Email, Phone, URL)
- Test coverage for 11 previously untested actions atoms (Create/Update/Delete/View, Notify/Message/Assign, Search/Filter/Sort/Export)
- Test coverage for 4 previously untested interfaces atoms (Calendar, Chart, Detail, Form)
- Test coverage for 3 previously untested rules atoms (Audit, Permission, Policy)
- `test:coverage` npm script for running tests with coverage reporting

### Changed

- Updated README Roadmap to reflect current 100% reference implementation coverage
- Bumped version to 0.5.0 in package.json and CITATION.cff

### Fixed

- Corrected the stale Roadmap section in README that contradicted the Status section

## [0.4.0] - 2026-08-21

### Added

- 115 atoms across 6 families (ontology established in 0.2.0)
- Composition system prompt and plan schema
- Evaluation harness with baseline vs composition comparison
- Reference implementations for 90 of 115 atoms (25 missing: 14 actions, 9 interfaces, 2 rules)
- CI pipeline with validation, coverage, linting, and type-checking
6 changes: 3 additions & 3 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ cff-version: 1.2.0
message: "If you use this work in research, please cite it as below."
title: "Software Periodic Table: A Finite Ontology of Recurring Application Elements for Compositional Code Generation"
type: software
version: 0.4.0
date-released: 2026-08-21
version: 0.6.0
date-released: 2026-10-22
license: MIT

authors:
Expand All @@ -19,4 +19,4 @@ keywords:
- periodic-table
- reusability

abstract: "A curated ontology of 115 recurring software elements across six families (Objects, Properties, Actions, Interfaces, Intelligence, Rules), with typed reference implementations and a composition framework for LLM-based coding agents. The core thesis is that most application software can be expressed as compositions of a finite set of curated atoms, and that composition from such a library is more reliable and token-efficient than regenerating equivalent patterns on every task."
abstract: "A curated ontology of 115 recurring software elements across six families (Objects, Properties, Actions, Interfaces, Intelligence, Rules), with typed reference implementations, behaviour tests, and a composition framework for LLM-based coding agents. The core thesis is that most application software can be expressed as compositions of a finite set of curated atoms. The repository ships an evaluation harness for testing that thesis against a generation baseline; it scores ground-truth recall and acceptance criteria, and makes no measured claim that composition outperforms generation."
66 changes: 53 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ software-periodic-table/
│ ├── intelligence/ # Intelligence atoms: model-backed primitives
│ └── rules/ # Rule atoms: permission.ts, trigger.ts, action.ts
├── src/ # Shared infrastructure
│ ├── index.ts # Package root: loader, schema validator, prompts, types
│ ├── ontology.ts # Loader, name/symbol indexes, family ranges
│ └── jsonschema.ts # Dependency-free JSON Schema subset validator
├── composer/ # Composition layer & agent prompts
Expand Down Expand Up @@ -111,6 +112,9 @@ software-periodic-table/

## Quick Start

Node 20.6 or newer is required. `.nvmrc` pins the version CI uses, so
`nvm use` selects a matching runtime.

```bash
# Install dependencies
npm ci
Expand All @@ -126,22 +130,43 @@ npm run check
npm run lint
npm test

# Tests with coverage reporting
npm run test:coverage

# Run the composition examples
npm run example # Task + Kanban board
npm run example:crm # CRM contact management
npm run example:product # Product catalog + AI Search/Recommend
npm run example:invoice # Invoice dashboard + Filter/Export/Chart

# Everything CI runs, in one command
# Everything CI runs, in one command (includes the evaluation self-check)
npm run ci

# Evaluation harness self-check (no API key needed)
# Evaluation harness self-check on its own (no API key needed)
npm run eval

# Real baseline vs composition (requires OPENAI_API_KEY or LLM_API_KEY)
OPENAI_API_KEY=sk-... npm run eval
```

## Package Entry Points

Installing the package exposes the shared infrastructure at the root and each
atom at its own subpath:

```ts
import { loadOntology, validateSchema } from 'software-periodic-table';
import { COMPOSITION_SYSTEM_PROMPT } from 'software-periodic-table/composer';
import { createTask, TaskMeta } from 'software-periodic-table/atoms/objects/task.js';

const ontology = loadOntology();
const errors = validateSchema(ontology, { type: 'object' });
```

The root entry point is the ontology loader, schema validator, composition
prompts, and the shared types from `atoms/core.ts`. Prefer the per-atom subpaths
when you only need one atom.

## Tests

The ontology is a data artifact that agents consume, so its invariants are
Expand All @@ -156,7 +181,21 @@ enforced by tests rather than by convention:
v0.5.0 (the `notes` characters in `planOverlap`, the acceptance fall-through,
the cross-family name collision) plus consistency between each scenario's
acceptance criteria and its ground truth.
- `test/atoms.test.ts` — behaviour of the atom implementations.
- `test/atoms.test.ts` — behaviour of the core atom implementations.
- `test/atoms-new.test.ts` — behaviour of the atoms added alongside the lifecycle,
scheduling, data, board, grid, list, map, timeline, tree, card, and schedule work.
- `test/atoms-untested.test.ts` — behaviour of the atoms that previously had no
tests, across the intelligence, properties, actions, interfaces, and rules
families.
- `test/objects.test.ts` — all 35 object atoms: metadata matches the ontology,
every declared property is materialized, required fields and defaults hold, and
optional inputs round-trip.
- `test/atom-test-coverage.test.ts` — fails if an atom module is imported by no
test, so a future family cannot ship untested.
- `test/project.test.ts` — fails when versions, atom counts, the CHANGELOG entry,
or the README test inventory drift from the shipped code.
- `test/public-api.test.ts` — the loader, schema entry point, prompt builder, and
an atom are reachable through the paths a package consumer uses.

Run with `npm test`. No test framework dependency; `node:test` and `tsx` only.

Expand Down Expand Up @@ -190,12 +229,14 @@ See `docs/AGENT_USAGE.md` for a detailed walkthrough of both patterns, including

## Status

The ontology (115 elements) is stable. **Every element has a tested reference
The ontology (115 elements) is stable. **Every element has a reference
implementation — 115 of 115 (100%)**, across all six families (run `npm run
coverage` for the live report). `test/ontology.test.ts` fails if any atom loses its
implementation, because a symbol with no implementation is a hole in the claim that
the table is composable end to end. The composition system prompt, examples, and
evaluation harness are functional and unit-tested.
coverage` for the live report). Behaviour tests cover all six families, including
all 35 object atoms; `test/atom-test-coverage.test.ts` fails if any atom module is
imported by no test. `test/ontology.test.ts` fails if any atom loses its
implementation, because a symbol with no implementation is a hole in the claim
that the table is composable end to end. The composition system prompt, examples,
and evaluation harness are functional and unit-tested.

**No empirical claim is made yet.** An earlier version of this README reported a
39% token saving from composition. That figure is withdrawn and the metric is
Expand Down Expand Up @@ -238,11 +279,9 @@ against the feature requests, and collect empirical results.

## Roadmap

- **Near term:** Expand reference implementations to cover all 115 elements. Remaining families: Actions (13 missing), Interfaces (7 missing), Rules (1 missing).
- **Medium term:** Run a corrected LLM evaluation, publish the results with the
raw JSON, and collect community-contributed atoms.
- **Near term:** Run a corrected LLM evaluation, publish the results with the raw JSON, and collect community-contributed atoms.
- **Medium term:** Develop domain packs for common verticals (CRM, healthcare, fintech).
- **Long term:** Port the ontology to additional languages (Python, Rust, Go).
Develop domain packs for common verticals.

## Contributing

Expand Down Expand Up @@ -271,7 +310,8 @@ npm run ci
```

That runs the validator, the coverage report, lint, type-checking across all
three tsconfig projects, the test suite, a build, and every example.
three tsconfig projects, the test suite, a build, every example, and the
evaluation self-check — the same steps as the GitHub Actions workflow.

### Governance

Expand Down
2 changes: 2 additions & 0 deletions atoms/objects/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export function createMessage(input: {
channel?: Message['properties']['channel'];
threadId?: string;
recipientIds?: string[];
readBy?: string[];
sentAt?: string;
}): Message {
return {
Expand All @@ -52,6 +53,7 @@ export function createMessage(input: {
channel: input.channel ?? 'in_app',
threadId: input.threadId,
recipientIds: input.recipientIds,
readBy: input.readBy,
sentAt: input.sentAt ?? new Date().toISOString(),
},
};
Expand Down
2 changes: 2 additions & 0 deletions atoms/objects/subscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export function createSubscription(input: {
billingInterval?: Subscription['properties']['billingInterval'];
startDate?: string;
renewalDate?: string;
cancelAt?: string;
}): Subscription {
const now = new Date().toISOString();
return {
Expand All @@ -62,6 +63,7 @@ export function createSubscription(input: {
billingInterval: input.billingInterval ?? 'monthly',
startDate: input.startDate ?? now.slice(0, 10),
renewalDate: input.renewalDate,
cancelAt: input.cancelAt,
createdAt: now,
updatedAt: now,
},
Expand Down
10 changes: 6 additions & 4 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ Five names each exist in two families — `Email`, `Message`, `Search`, `Trigger
4. Prefer pure data + small functions. Avoid framework-specific code in the core atoms.
5. Add a test. `npm test` covers the validator, the schema validator, the eval
metrics, and the atom implementations. A new atom without a test is
incomplete — the coverage report counts implementation files, and
`npm run coverage` will show the drop.
incomplete: `test/atom-test-coverage.test.ts` fails if the module is never
imported by a test, and the contribution is expected to assert behaviour, not
merely import it. `npm run coverage` is a different check — it measures
whether an implementation exists, not whether it is tested.
6. Keep the public surface minimal and well-typed.

## The Invariants the Validator Enforces
Expand Down Expand Up @@ -100,5 +102,5 @@ npm run ci
```

This runs validation, the coverage report, lint, type-checking across all three
tsconfig projects, the test suite, a build, and every example. The PR template
repeats this checklist.
tsconfig projects, the test suite, a build, every example, and the evaluation
self-check. The PR template repeats this checklist.
2 changes: 1 addition & 1 deletion ontology/periodic-table.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.4.0",
"version": "0.6.0",
"description": "Canonical Periodic Table of Software Elements. Finite building blocks for compositional application development and LLM code generation.",
"families": [
{
Expand Down
7 changes: 5 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading