Skip to content

Add OMOS starter architecture and OT conversion API#29

Merged
ohi-stack merged 2 commits intomainfrom
codex/create-omos-repo-structure-and-code
Apr 12, 2026
Merged

Add OMOS starter architecture and OT conversion API#29
ohi-stack merged 2 commits intomainfrom
codex/create-omos-repo-structure-and-code

Conversation

@ohi-stack
Copy link
Copy Markdown
Owner

Motivation

  • Provide a deployment-ready OMOS starter system that mirrors the four-layer architecture (Identity → Algorithm → Protocol → Institution) and exposes it as an API surface.
  • Implement a deterministic OTS‑V5 time layer (OT ↔ UTC) and runtime alignment enforcement so protocol documents become executable code.
  • Scaffold canonical repository seeds (omos-core, onegodian-time, onegodian-agent) so the repo structure maps to the institutional architecture.

Description

  • Added an OMOS API under /api/omos with endpoints POST /classify, POST /align, POST /timestamp/convert, and POST /decision/run wired into the main router (src/routes/api/omosRoutes.js, src/routes/index.js).
  • Implemented core OMOS services: identity classification (src/services/omos/identityService.js), alignment checks with a system prompt loader (alignment/system-prompt.txt and src/services/omos/alignmentService.js), algorithmic decision pipeline (src/services/omos/algorithmService.js), and OTS‑V5 time conversions plus record builder (src/services/omos/timeService.js).
  • Added controller handlers (src/controllers/omosController.js) that expose service behavior as JSON APIs and updated documentation (README.md, docs/omos/repo-architecture.md) to list the new endpoints and architecture mapping.
  • Created in-tree starter repo scaffolds and supporting artifacts (omos-core/, onegodian-time/, onegodian-agent/) including an openapi.yaml, kernel decision stub, OT engine bridge, and agent template, plus integration tests (test/omos.test.js).

Testing

  • Ran the integration test suite with npm test which passed all tests (6 tests, 0 failures).
  • Ran static checks with npm run check which completed without errors.
  • Executed enforcement validation with npm run validate:enforcement which returned Enforcement validation checks passed.

Codex Task

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2ae45908d1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

};

export const buildTimestampRecord = (inputUtcIso) => {
const timestampUtc = new Date(inputUtcIso);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Reject timezone-less UTC timestamps in OT conversion

buildTimestampRecord accepts any date string and parses it with new Date(inputUtcIso), which treats values like 2025-03-18T00:00:00 as local time instead of UTC. That makes the same API request produce different OT results across server timezones (and can incorrectly throw “predates OT epoch” in positive-offset regions), so the conversion is not deterministic as designed. Require an explicit Z/offset or parse/normalize strictly as UTC before calling utcToOt.

Useful? React with 👍 / 👎.

@@ -0,0 +1,4 @@
export const validateOtInput = ({ year, dayOfYear }) => {
if (!Number.isInteger(year) || year < 0) throw new Error('Invalid year');
if (!Number.isInteger(dayOfYear) || dayOfYear < 1) throw new Error('Invalid dayOfYear');
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Bound OT dayOfYear during input validation

validateOtInput only enforces dayOfYear >= 1 and never checks the upper limit for the specified year, so impossible values (for example dayOfYear: 999) are treated as valid. Any caller using this validator as a gate can accept invalid OT timestamps and fail later when conversion logic rejects them, so this validator should enforce the same 365/366-day constraints as otToUtc.

Useful? React with 👍 / 👎.

@ohi-stack ohi-stack merged commit 8a783b4 into main Apr 12, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant