ag-cortex 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agent/rules/00-constitution.md +7 -4
- package/.agent/rules/90-general-best-practices.md +27 -0
- package/.agent/workflows/work.md +2 -2
- package/README.md +9 -1
- package/lib/core.js +53 -8
- package/package.json +10 -2
- package/.agent/rules/project-rules.md +0 -49
- /package/.agent/{commands → workflows}/test-browser.md +0 -0
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
trigger: always_on
|
|
3
|
+
---
|
|
4
|
+
|
|
1
5
|
# Antigravity Codex
|
|
2
6
|
|
|
3
7
|
This is the central "brain" for Antigravity-powered agents. It defines the core primitives—Skills, Workflows, and Rules—and how they should be used to maintain a high standard of engineering.
|
|
@@ -13,13 +17,12 @@ This is the central "brain" for Antigravity-powered agents. It defines the core
|
|
|
13
17
|
## Repository Structure
|
|
14
18
|
|
|
15
19
|
```
|
|
16
|
-
|
|
20
|
+
[Project Root]/
|
|
17
21
|
├── .agent/
|
|
18
22
|
│ ├── rules/ # Context & Identity (e.g., specific engineering personas)
|
|
19
23
|
│ ├── skills/ # Capabilities (formerly plugins)
|
|
20
|
-
│
|
|
21
|
-
|
|
22
|
-
└── README.md
|
|
24
|
+
│ └── workflows/ # Step-by-step procedures (formerly plans/workflows)
|
|
25
|
+
└── ...
|
|
23
26
|
```
|
|
24
27
|
|
|
25
28
|
## Philosophy: Compounding Engineering
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# General Engineering Standards
|
|
2
|
+
|
|
3
|
+
These are the baseline operating procedures for this project. They are designed to keep velocity high and technical debt low.
|
|
4
|
+
|
|
5
|
+
## 1. Documentation
|
|
6
|
+
Code is read more often than it is written.
|
|
7
|
+
- **Update Docs with Code**: Never ship a feature without updating the relevant documentation (README, API docs, or inline comments).
|
|
8
|
+
- **Why > What**: Comments should explain *why* a complex decision was made, not just *what* the code does.
|
|
9
|
+
|
|
10
|
+
## 2. Testing
|
|
11
|
+
Unverified code is broken code.
|
|
12
|
+
- **Verification First**: Before marking a task as "Done", verify it.
|
|
13
|
+
- **Reproducible**: If you fix a bug, try to add a test case or a reproduction script to prevent regression.
|
|
14
|
+
|
|
15
|
+
## 3. Commit Conventions
|
|
16
|
+
Keep history clean and searchable.
|
|
17
|
+
- `feat: ...` for new features
|
|
18
|
+
- `fix: ...` for bug fixes
|
|
19
|
+
- `refactor: ...` for code structure changes
|
|
20
|
+
- `docs: ...` for documentation updates
|
|
21
|
+
- `chore: ...` for maintenance tasks
|
|
22
|
+
|
|
23
|
+
## 4. Workflows
|
|
24
|
+
Leverage the agents to scale your output.
|
|
25
|
+
- Use `/plan` before starting complex features.
|
|
26
|
+
- Use `/review` to catch issues early.
|
|
27
|
+
- Use `/compound` to save knowledge for the next developer.
|
package/.agent/workflows/work.md
CHANGED
|
@@ -82,7 +82,7 @@ This command takes a work document (plan, specification, or todo file) and execu
|
|
|
82
82
|
- The plan should reference similar code - read those files first
|
|
83
83
|
- Match naming conventions exactly
|
|
84
84
|
- Reuse existing components where possible
|
|
85
|
-
- Follow project coding standards (see
|
|
85
|
+
- Follow project coding standards (see .agent/rules/)
|
|
86
86
|
- When in doubt, grep for similar implementations
|
|
87
87
|
|
|
88
88
|
3. **Test Continuously**
|
|
@@ -117,7 +117,7 @@ This command takes a work document (plan, specification, or todo file) and execu
|
|
|
117
117
|
# Run full test suite
|
|
118
118
|
bin/rails test
|
|
119
119
|
|
|
120
|
-
# Run linting (per
|
|
120
|
+
# Run linting (per .agent/rules/)
|
|
121
121
|
# Use linting-agent before pushing to origin
|
|
122
122
|
```
|
|
123
123
|
|
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Antigravity Cortex
|
|
2
2
|
|
|
3
|
+
[**Documentation**](https://i3ringit.github.io/antigravity-cortex/) | [**Repository**](https://github.com/i3ringit/antigravity-cortex)
|
|
4
|
+
|
|
3
5
|
The central "brain" and standard library for Antigravity-powered agents. This package distributes shared **Skills**, **Workflows**, and **Rules** that are injected into project workspaces to ensure consistent, high-quality engineering.
|
|
4
6
|
|
|
5
7
|
## Architecture
|
|
@@ -20,10 +22,16 @@ To add Antigravity Cortex to your project:
|
|
|
20
22
|
npm install -D ag-cortex
|
|
21
23
|
|
|
22
24
|
# 2. Initialize the brain
|
|
23
|
-
# This copies
|
|
25
|
+
# This copies assets to .agent/, creates a manifest, and automatically installs required browser binaries.
|
|
24
26
|
npx ag-cortex install
|
|
25
27
|
```
|
|
26
28
|
|
|
29
|
+
> [!NOTE]
|
|
30
|
+
> **Linux Users**: If you encounter errors about missing shared libraries, you likely need to install system dependencies. Run:
|
|
31
|
+
> ```bash
|
|
32
|
+
> sudo npx agent-browser install --with-deps
|
|
33
|
+
> ```
|
|
34
|
+
|
|
27
35
|
## Usage
|
|
28
36
|
|
|
29
37
|
### Updating Assets
|
package/lib/core.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const fs = require('fs-extra');
|
|
2
2
|
const path = require('path');
|
|
3
|
-
const {
|
|
3
|
+
const { spawn } = require('child_process');
|
|
4
4
|
|
|
5
5
|
// Paths
|
|
6
6
|
const PKG_ROOT = path.resolve(__dirname, '..');
|
|
@@ -37,6 +37,21 @@ async function walk(dir, baseDir = dir) {
|
|
|
37
37
|
return results;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Helper to run commands asynchronously using spawn, avoiding event loop blocking.
|
|
43
|
+
*/
|
|
44
|
+
async function spawnCommand(command, args, options = {}) {
|
|
45
|
+
return new Promise((resolve, reject) => {
|
|
46
|
+
const proc = spawn(command, args, { stdio: 'inherit', ...options });
|
|
47
|
+
proc.on('close', code => {
|
|
48
|
+
if (code === 0) resolve();
|
|
49
|
+
else reject(new Error(`Command '${command} ${args.join(' ')}' failed with code ${code}`));
|
|
50
|
+
});
|
|
51
|
+
proc.on('error', reject);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
40
55
|
async function install() {
|
|
41
56
|
const chalk = (await import('chalk')).default;
|
|
42
57
|
console.log(chalk.blue(`📦 Installing Cortex assets to ${TARGET_AGENT_DIR}...`));
|
|
@@ -62,7 +77,18 @@ async function install() {
|
|
|
62
77
|
const destPath = path.join(TARGET_AGENT_DIR, file);
|
|
63
78
|
|
|
64
79
|
await fs.ensureDir(path.dirname(destPath));
|
|
65
|
-
|
|
80
|
+
|
|
81
|
+
// Force removal of existing symlinks to replace with real files
|
|
82
|
+
try {
|
|
83
|
+
const destStat = await fs.lstat(destPath);
|
|
84
|
+
if (destStat.isSymbolicLink()) {
|
|
85
|
+
await fs.remove(destPath);
|
|
86
|
+
}
|
|
87
|
+
} catch (e) {
|
|
88
|
+
// Ignore ENOENT
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
await fs.copy(srcPath, destPath, { overwrite: true, dereference: true });
|
|
66
92
|
}
|
|
67
93
|
console.log(chalk.green(` ✅ Installed ${sourceFiles.length} files.`));
|
|
68
94
|
|
|
@@ -80,20 +106,39 @@ async function install() {
|
|
|
80
106
|
|
|
81
107
|
try {
|
|
82
108
|
if (isLinux) {
|
|
83
|
-
console.log(chalk.yellow(` 🐧 Linux detected
|
|
84
|
-
console.log(chalk.
|
|
85
|
-
|
|
109
|
+
console.log(chalk.yellow(` 🐧 Linux detected.`));
|
|
110
|
+
console.log(chalk.yellow(` ⚠️ To ensure all system dependencies are met for headless browsing, you should run:`));
|
|
111
|
+
console.log(chalk.bold(` sudo npx agent-browser install --with-deps`));
|
|
112
|
+
console.log(chalk.gray(` (Proceeding with basic installation to avoid sudo prompt...)`));
|
|
113
|
+
const npx = process.platform === 'win32' ? 'npx.cmd' : 'npx';
|
|
114
|
+
await spawnCommand(npx, ['agent-browser', 'install'], { cwd: TARGET_ROOT });
|
|
86
115
|
} else {
|
|
87
|
-
|
|
116
|
+
const npx = process.platform === 'win32' ? 'npx.cmd' : 'npx';
|
|
117
|
+
await spawnCommand(npx, ['agent-browser', 'install'], { cwd: TARGET_ROOT });
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
console.log(chalk.blue(` 🌐 Ensuring correct Playwright browsers are installed...`));
|
|
121
|
+
let pwVersion = 'latest';
|
|
122
|
+
try {
|
|
123
|
+
const pwCorePkg = require('playwright-core/package.json');
|
|
124
|
+
pwVersion = pwCorePkg.version;
|
|
125
|
+
console.log(chalk.gray(` Detected runtime: playwright-core v${pwVersion}`));
|
|
126
|
+
} catch (e) {
|
|
127
|
+
console.warn(chalk.yellow(` Could not resolve playwright-core version, defaulting to 'latest'.`));
|
|
88
128
|
}
|
|
89
|
-
|
|
129
|
+
|
|
130
|
+
const npx = process.platform === 'win32' ? 'npx.cmd' : 'npx';
|
|
131
|
+
await spawnCommand(npx, ['--yes', `playwright@${pwVersion}`, 'install', 'chromium', 'chromium-headless-shell'], { cwd: TARGET_ROOT });
|
|
132
|
+
|
|
133
|
+
console.log(chalk.green(` ✅ Agent Browser setup complete.`));
|
|
90
134
|
} catch (e) {
|
|
91
135
|
if (isLinux) {
|
|
92
136
|
console.warn(chalk.yellow(` ⚠️ Automatic setup failed. You likely need sudo for system dependencies.`));
|
|
93
137
|
console.warn(chalk.bold(` Please run: sudo npx agent-browser install --with-deps`));
|
|
94
138
|
} else {
|
|
95
|
-
console.warn(chalk.yellow(` ⚠️ Agent Browser setup had issues
|
|
139
|
+
console.warn(chalk.yellow(` ⚠️ Agent Browser setup had issues.`));
|
|
96
140
|
}
|
|
141
|
+
console.warn(chalk.bold(` Also ensure browsers are installed: npx playwright install chromium`));
|
|
97
142
|
}
|
|
98
143
|
}
|
|
99
144
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ag-cortex",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Antigravity Cortex - Agentic Workflow Distribution. The central brain and standard library for Antigravity-powered agents.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"ag-cortex": "./bin/ag-cortex.js"
|
|
@@ -20,6 +20,14 @@
|
|
|
20
20
|
"workflows",
|
|
21
21
|
"skills"
|
|
22
22
|
],
|
|
23
|
+
"homepage": "https://i3ringit.github.io/antigravity-cortex/",
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "git+https://github.com/i3ringit/antigravity-cortex.git"
|
|
27
|
+
},
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://github.com/i3ringit/antigravity-cortex/issues"
|
|
30
|
+
},
|
|
23
31
|
"author": "Marcos del Cristo",
|
|
24
32
|
"license": "MIT",
|
|
25
33
|
"dependencies": {
|
|
@@ -28,4 +36,4 @@
|
|
|
28
36
|
"commander": "^11.0.0",
|
|
29
37
|
"fs-extra": "^11.0.0"
|
|
30
38
|
}
|
|
31
|
-
}
|
|
39
|
+
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
# Cortex Lab Project Rules
|
|
2
|
-
|
|
3
|
-
This file documents the project's rules, conventions, and workflows. It was migrated from `CLAUDE.md`.
|
|
4
|
-
|
|
5
|
-
## Commands
|
|
6
|
-
|
|
7
|
-
- **`/release-docs`**: Run the release-docs command to update all documentation pages.
|
|
8
|
-
- **`/review`**: Run the review command to perform exhaustive code reviews.
|
|
9
|
-
- **`/test-browser`**: Run browser tests using Playwright.
|
|
10
|
-
- **`/xcode-test`**: Run iOS tests using Xcode simulator.
|
|
11
|
-
|
|
12
|
-
## Project Structure
|
|
13
|
-
|
|
14
|
-
```
|
|
15
|
-
cortex/
|
|
16
|
-
├── .agent/
|
|
17
|
-
│ ├── rules/ # Project rules and conventions
|
|
18
|
-
│ ├── skills/ # Specialized agent skills
|
|
19
|
-
│ └── workflows/ # Automated workflows
|
|
20
|
-
├── docs/ # Documentation site (HTML/CSS)
|
|
21
|
-
├── plugins/ # Plugin source code
|
|
22
|
-
└── ...
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## Documentation
|
|
26
|
-
|
|
27
|
-
The documentation site is at `/docs` in the repository root.
|
|
28
|
-
|
|
29
|
-
### Keeping Docs Up-to-Date
|
|
30
|
-
|
|
31
|
-
After ANY change to agents, commands, skills, or MCP servers, update documentation.
|
|
32
|
-
|
|
33
|
-
## Commit Conventions
|
|
34
|
-
|
|
35
|
-
Follow these patterns for commit messages:
|
|
36
|
-
|
|
37
|
-
- `Add [agent/command name]` - Adding new functionality
|
|
38
|
-
- `Remove [agent/command name]` - Removing functionality
|
|
39
|
-
- `Update [file] to [what changed]` - Updating existing files
|
|
40
|
-
- `Fix [issue]` - Bug fixes
|
|
41
|
-
- `Simplify [component] to [improvement]` - Refactoring
|
|
42
|
-
|
|
43
|
-
## Key Learnings
|
|
44
|
-
|
|
45
|
-
### 2024-11-22: Added gemini-imagegen skill and fixed component counts
|
|
46
|
-
Always count actual files before updating descriptions.
|
|
47
|
-
|
|
48
|
-
### 2024-10-09: Simplified marketplace.json to match official spec
|
|
49
|
-
Stick to the official spec. Custom fields may confuse users.
|
|
File without changes
|