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
14 changes: 12 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
name: Deploy HeadyOS
name: HeadyOS Core CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
deploy:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -13,3 +15,11 @@ jobs:
cache: 'npm'
- run: npm ci
- run: npm test
docker:
needs: test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Build Docker image
run: docker build -t headyos-core:${{ github.sha }} .
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules/
.env
.env.*
*.log
coverage/
.DS_Store
38 changes: 38 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Instructions

You are an autonomous coding subagent spawned by a parent agent to complete a specific task. You run unattended — there is no human in the loop and no way to ask for clarification. You must complete the task fully on your own and then exit.

You have two categories of skills:

- **Coding skills** (`coding-workflow`, `commit-push-pr`, `pr-description`, `code-simplifier`): For repository work, writing code, git operations, pull requests, and code quality
- **Data skills** (`data-triage`, `data-analyst`, `data-model-explorer`): For database queries, metrics, data analysis, and visualizations
- **Repo skills** (`repo-skills`): After cloning any repo, scan for and index its skill definitions

Load the appropriate skill based on the task. If the task involves both code and data, load both. Always load `repo-skills` after cloning a repository.

## Execution Rules

- Do NOT stall. If an approach isn't working, try a different one immediately.
- Do NOT explore the codebase endlessly. Get oriented quickly, then start making changes.
- If a tool is missing (e.g., `rg`), use an available alternative (e.g., `grep -r`) and move on.
- If a git operation fails, try a different approach (e.g., `gh repo clone` instead of `git clone`).
- Stay focused on the objective. Do not go on tangents or investigate unrelated code.
- If you are stuck after multiple retries, abort and report what went wrong rather than looping forever.

## Repo Conventions

After cloning any repository, immediately check for and read these files at the repo root:
- `CLAUDE.md` — Claude Code instructions and project conventions
- `AGENTS.md` — Agent-specific instructions

Follow all instructions and conventions found in these files. They define the project's coding standards, test requirements, commit conventions, and PR expectations. If they conflict with these instructions, the repo's files take precedence.

## Core Rules

- Ensure all changes follow the project's coding standards (as discovered from repo convention files above)
- NEVER approve PRs — you are not authorized to approve pull requests. Only create and comment on PRs.
- Complete the task autonomously and create the PR(s) when done.

## Output Persistence

IMPORTANT: Before finishing, you MUST write your complete final response to `/tmp/claude_code_output.md` using the Write tool. This file must contain your full analysis, findings, code, or whatever the final deliverable is. This is a hard requirement — do not skip it.
15 changes: 12 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
FROM node:20-slim
FROM node:20-slim AS base
WORKDIR /app

COPY package*.json ./
RUN npm ci --production
COPY . .
RUN npm ci --omit=dev

COPY src/ ./src/
COPY index.js ./

ENV NODE_ENV=production
ENV PORT=8080

RUN groupadd -r heady && useradd -r -g heady heady
RUN chown -R heady:heady /app
USER heady

HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD node -e "const http=require('http');const r=http.get('http://127.0.0.1:8080/health',s=>{process.exit(s.statusCode===200?0:1)});r.on('error',()=>process.exit(1))"

EXPOSE 8080
CMD ["node", "index.js"]
77 changes: 64 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,76 @@
# 🧠 HeadyOS
# HeadyOS Core

> **The Latent Operating System**
Latent operating system control plane with capability-based routing, liquid node execution, and async orchestration.

The invisible OS powering continuous AI reasoning across all Heady services. Think in vectors, act in code.
## Architecture

[![Projected](https://img.shields.io/badge/projected-Heady%20Latent%20OS-purple)](https://github.com/HeadyMe/Heady-pre-production-9f2f0642)
```
Interface (HTTP API)
|
Gateway (CapabilityRouter + AsyncCoordinator)
|
Execution (LiquidNode pool with spawn/route/retire lifecycle)
|
Memory (pluggable adapters: in-memory, redis, postgres)
|
Observability (structured JSON logging, correlation IDs, metrics)
```

## Quick Start

```bash
git clone https://github.com/HeadyMe/headyos-core.git
cd headyos-core && npm install && npm start
npm install
npm start # Starts on PORT 8080 (configurable)
npm test # Runs all tests
```

## Features
## API Endpoints

| Method | Path | Description |
|--------|------|-------------|
| GET | `/health` | Health check |
| GET | `/readiness` | Readiness probe |
| GET | `/status` | System status with pool and coordinator info |
| GET | `/capabilities` | Registered task handler capabilities |
| GET | `/metrics` | Runtime metrics snapshot |
| GET | `/docs` | API documentation |
| POST | `/tasks` | Submit a single task |
| POST | `/tasks/batch` | Submit a batch of tasks (parallel execution) |
| POST | `/pipeline` | Execute an orchestration pipeline |

## Configuration

All configuration is via environment variables with validated defaults:

| Variable | Default | Description |
|----------|---------|-------------|
| `PORT` | `8080` | HTTP listen port |
| `NODE_ENV` | `production` | Environment |
| `LOG_LEVEL` | `info` | Logging level (debug/info/warn/error) |
| `CORS_ORIGINS` | `` | Comma-separated allowed origins |
| `MAX_CONCURRENCY` | `10` | Max concurrent tasks |
| `TASK_TIMEOUT_MS` | `30000` | Default task timeout |
| `NODE_POOL_SIZE` | `5` | Liquid node pool capacity |
| `NODE_IDLE_TTL_MS` | `60000` | Idle node reap threshold |
| `MEMORY_ADAPTER` | `in-memory` | State adapter (in-memory/redis/postgres) |
| `METRICS_ENABLED` | `false` | Enable metrics collection |
| `SHUTDOWN_TIMEOUT_MS` | `10000` | Graceful shutdown timeout |

## Task Submission

- 🧠 **Latent Reasoning** — Continuous AI inference in vector space
- 💾 **Persistent Memory** — pgvector-backed 3D knowledge graph
- ♾️ **Self-Evolution** — Auto-mutating logic via the Synaptic Forge
- 🔮 **Sacred Geometry Core** — PHI-timed orchestration patterns
```bash
curl -X POST https://headyos.com/tasks \
-H "Content-Type: application/json" \
-d '{"type":"echo","payload":{"message":"hello"}}'
```

## Docker

```bash
docker build -t headyos-core .
docker run -p 8080:8080 headyos-core
```

---
## License

**© 2026 Heady Systems LLC.** Built with Sacred Geometry · Powered by the Heady Latent OS
MIT - Heady Systems LLC
33 changes: 23 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
const express = require('express');
const app = express();
const PORT = process.env.PORT || 3000;
const siteConfig = require('./site-config.json');
app.use(express.json({ limit: '1mb' }));
app.get('/health', (req, res) => res.json({ ok: true, service: 'HeadyOS', domain: 'headyos.com', projected: true, ts: new Date().toISOString() }));
app.get('/', (req, res) => {
res.setHeader('Content-Type', 'text/html; charset=utf-8');
res.send(`<html><head><title>${siteConfig.name}</title></head><body><h1>${siteConfig.name}</h1><p>${siteConfig.description}</p></body></html>`);
'use strict';

const { createApp } = require('./src/app');

const { app, kernel } = createApp();

const server = app.listen(kernel.config.PORT, () => {
kernel.logger.info('HeadyOS Core listening', { port: kernel.config.PORT, env: kernel.config.NODE_ENV });
});
app.listen(PORT, () => console.log(`🐝 HeadyOS running at http://localhost:${PORT}`));

function gracefulShutdown(signal) {
kernel.logger.info('Shutdown signal received', { signal });
server.close(async () => {
await kernel.shutdown();
process.exit(0);
});
setTimeout(() => {
kernel.logger.error('Forced shutdown after timeout');
process.exit(1);
}, kernel.config.SHUTDOWN_TIMEOUT_MS);
}

process.on('SIGTERM', () => gracefulShutdown('SIGTERM'));
process.on('SIGINT', () => gracefulShutdown('SIGINT'));
Loading
Loading