AIKit
Health Uyari
- License — License: MIT
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Low visibility — Only 5 GitHub stars
Code Gecti
- Code scan — Scanned 12 files during light audit, no dangerous patterns found
Permissions Gecti
- Permissions — No dangerous permissions requested
Bu listing icin henuz AI raporu yok.
Universal AI coding principles, cross-IDE governance, and power-loss disruption recovery for autonomous agents.
🤖 Universal AI Principles & Agent Operating System (Portable Kit)
Plug-and-Play AI Assistant Governance, Architecture Principles & Disruption Recovery for Any Software Project.
This kit contains the AI governance system extracted from production development. It ensures that any AI coding assistant follows strict engineering principles, prevents progress loss from unexpected power cuts or crashes, maintains living documentation, and executes automated regression-shielded git workflows.
⚡ 30-Second Cold-Start Quick Reference
Orientation Contract for AI Agents & Developers: Orient yourself in seconds with the verified commands and prerequisites below.
- Runtime Prerequisites: Python 3.10+ (Standard Library only — zero external pip dependencies) and
git. - Canonical Regression Shield Gate:
(100% test pass required before staging or committing changes).python -m unittest discover tests
🛠️ Core Operational Command Matrix
| Operational Role | Canonical Command | Verification Gate |
|---|---|---|
| Manage Projects | python aikit.py <cmd> |
new, attach, list, status, check, fix (ADR-119..124) |
| Run Regression Suite | python -m unittest discover tests |
100% tests pass (both tiers, ~5s) |
| Run Unit Tier Only | python -m unittest tests.test_kit |
100% pass, strict <1s gate |
| Run Integration Tier Only | python -m unittest tests.test_integration |
100% pass, <5s, bounded spawns |
| Synchronize IDE Rules | python scripts/sync_principles.py |
<=1,600 est. tokens/target incl. a reserved 300-token Tier 1B |
| Verify Rule Freshness | python scripts/sync_principles.py --check |
Read-only; exits 1 on rule drift, or when a principle changed since the last commit lacks an ADR naming its --citing set (PRINCIPLE-000 R3) |
| Find Principles to Read | python scripts/sync_principles.py --involved <paths/commands/output> |
Same answer for every agent (PRINCIPLE-001 R3) |
| Cross-Principle Check Set | python scripts/sync_principles.py --citing <PRINCIPLE-NNN> |
Principles a rule change must be checked against (PRINCIPLE-000 R3) |
| Update AST & Knowledge | python scripts/update_knowledge_base.py |
Rewrites the codebase map, then runs every audit of --check below; exits 1 on a syntax error (Python 3.10 grammar) or any audit failure |
| Verify AST Map Freshness | python scripts/update_knowledge_base.py --check |
Read-only; exits 1 on a stale codebase map, README drift (PRINCIPLE-005), an ADR ID out of order, unfinished code (PRINCIPLE-007 R3) or a code-structure violation (PRINCIPLE-009 to PRINCIPLE-011) |
| Classify Lifecycle Track | python scripts/disruption_recovery.py --track |
Prints Track A/B/C of current changes (PRINCIPLE-002 R3) |
| Audit Disruption Recovery | python scripts/disruption_recovery.py --audit |
Clean status check; detects surviving uncommitted files |
| Resume Interrupted Task | python scripts/disruption_recovery.py --resume |
Cold-start command: every --audit finding, then the interrupted task, its plan and resumption phase |
| Record Task Checkpoint | python scripts/disruption_recovery.py --checkpoint <task_id> --phase-num <1-5> --desc <text> |
Appends a checkpoint (PRINCIPLE-002 R4); exits 2 when a task's first plan lacks --why --benefits --risks --mitigation, and warns when a task reaches Phase 3 with none (PRINCIPLE-007 R1, R6) |
| Complete Task Ledger | python scripts/disruption_recovery.py --complete <task_id> |
Marks the active task completed in .agents/task_ledger.json; exits 1, changing nothing, if <task_id> is not the active task |
| Reset Active Task | python scripts/disruption_recovery.py --reset [reason] |
Abandons/clears in-progress task in ledger |
| Purge Temp Buffers | python scripts/disruption_recovery.py --clean |
Deletes orphaned *.tmp_* buffers older than 60 s; younger ones may be a write in progress |
| Secret Scan Gate | python scripts/check_secrets.py --staged [--workspace <project>] |
Exits 1 on a credential pattern in the staged diff or agent memory, or when any surface could not be scanned (PRINCIPLE-019) |
| Reachability Shield | python scripts/check_reachability.py |
No unwired capability or phantom state key (PRINCIPLE-014 R7) |
| Operational Dogfood Gate | python scripts/dogfood.py |
5/5 tracks pass; zero host mutation (PRINCIPLE-015) |
| Discover Any CLI | python scripts/<script>.py --help |
Prints usage and exits 0 in <200ms as a fresh process, writing nothing |
| Sandbox the Ledger CLI | python scripts/disruption_recovery.py --workspace <dir> --audit |
Operates on <dir>/.agents/, never the repo ledger |
Universal CLI contract (PRINCIPLE-011, PRINCIPLE-015). Every CLI: --help / -h prints usage and exits 0, writing nothing; exit 0 = success, 1 = operational failure, 2 = misuse (an unknown flag is refused, never run as the default action); every failure prints What → Why → Fix on stderr, never a traceback. --check is the read-only mode of sync_principles.py and update_knowledge_base.py.
📦 What's Inside
portable_agent_kit/
├── README.md <- This Integration & Setup Guide
├── LICENSE <- MIT Open Source License
├── aikit.py <- Project CLI: new, attach, list, status, check, fix, delegate
├── .gitignore <- Credential & local-state baseline (PRINCIPLE-019 R3)
├── AGENTS.md <- Generated Tier 1 capsules (auto-loaded by AGENTS.md-convention agents)
├── GUIDELINES.md <- Single source of truth: every principle, rule & checklist (Tier 2)
├── GEMINI.md <- Google Gemini & Antigravity IDE rules
├── CLAUDE.md <- Anthropic Claude Code configuration
├── .cursorrules <- Cursor IDE instructions
├── .windsurfrules <- Codeium Windsurf IDE instructions
├── .clinerules <- Cline / Roo Code IDE instructions
├── .github/
│ ├── copilot-instructions.md <- GitHub Copilot instructions
│ └── workflows/
│ └── ci.yml <- Continuous verification gate (both tiers + freshness)
├── .claude/
│ ├── agents/ <- Claude sub-agents (generated)
│ ├── settings.json <- no agent may edit a task ledger
│ └── skills/
│ └── aikit/
│ └── SKILL.md <- Claude Code operational runbook (native skill)
├── .agents/
│ ├── rules/
│ │ ├── principles.md <- Antigravity / Agent IDE workspace rules
│ │ ├── domain.md.template <- Template for project domain rules (Tier 1B)
│ │ └── readme_quickref.md.template <- Adopter README Quick Reference & tree (PRINCIPLE-005 R6)
│ ├── skills/
│ │ └── aikit/
│ │ └── SKILL.md <- Antigravity operational runbook & command matrix
│ ├── agents/
│ │ └── opencode_worker.md <- OpenCode subagent spec for free model delegation
│ └── task_ledger.json <- Disruption ledger for power-loss resilience (WAL)
├── .opencode/
│ └── agents/ <- Native OpenCode specialized subagent profiles (architect, coder, etc.)
├── opencode.jsonc <- OpenCode v2 provider, model and permissions configuration
├── scripts/
│ ├── sync_principles.py <- Generates all 8 Tier 1 files from GUIDELINES.md, budget-gated
│ ├── disruption_recovery.py <- Power-loss audit, atomic checkpointing & ledger CLI
│ ├── update_knowledge_base.py <- Automatic codebase AST symbol extractor & validator
│ ├── dogfood.py <- Operational dogfood runner (sandbox jail + chaos tracks)
│ ├── check_reachability.py <- Invariant reachability shield (anti-dead-capability)
│ ├── project_registry.py <- Project discovery, stack detection, .aikit/ memory
│ ├── project_gates.py <- A project's gates: detection, overrides, runs
│ ├── aikit_cli.py <- `aikit.py` commands and error triads
│ ├── subagent_delegate.py <- `aikit delegate`: bounded OpenCode sub-agent runs
│ ├── project_publish.py <- Uploads a project to its own GitHub repository
│ └── check_secrets.py <- Secret & sensitive data scanner (pre-commit gate)
├── tests/
│ ├── test_kit.py <- Unit tier: in-process regression shield (strict <1s gate)
│ └── test_integration.py <- Integration tier: concurrency, CLI contracts & dogfooding
└── knowledge/
├── INDEX.md <- Knowledge base table of contents & architecture map
├── architecture.md <- High-level system architecture and component boundaries
├── services.md <- Core services, API contracts, and business logic
├── data_models.md <- Data structures, schemas, and persistence models
├── state_and_ui.md <- Presentation layer, UI state, and event loops
├── decisions.md <- Architectural Decision Records (ADRs)
├── codebase_map.md <- Auto-generated AST catalog of classes and functions
├── model_benchmarks.md <- Subagent model benchmark database & selection tree
├── host_clients.md <- Host client portability & cross-environment parity
└── principles_audit_ledger.md <- Snapshot audit at ADR-107 (not kept current)
🚀 Start a Project
Open this folder in any AI host and describe what to build. Each project gets its own folder under projects/ (ignored by AIKit's git) and its own git repository; AIKit's gates, map and ledger never read it.
python aikit.py new my-app # projects/my-app/: new git repo + .aikit/ memory
python aikit.py attach ../existing # register a folder elsewhere; adds only .aikit/ and .gitignore lines
python aikit.py list # every project, its stack and test command
python aikit.py status my-app # its task, open changes, last decision
python aikit.py check my-app # its tests and configured checks, AIKit's guidelines, secret scan
python aikit.py fix my-app # restore memory/README, refresh map, then check
python aikit.py guideline my-app "money is integer cents" --source user # project rule
python aikit.py publish my-app # own private GitHub repo, scanned first
A project's memory is its .aikit/ folder (record, ledger, decisions, guidelines: its own rules, ranked below the principles), committed in its repository; ledger commands take --workspace projects/<name>. The stack and test command are detected from its files on every call (Python, Node, Rust, Go, Java, .NET); --test "<cmd>" overrides.
📥 Alternative: Copy AIKit Into an Existing Project
Step 1: Copy Governance Assets
- Copy only the source of truth and tooling; the Tier 1 files are generated in Step 3, never copied:
Do not copycd portable_agent_kit mkdir -p /path/to/target/.agents cp -r GUIDELINES.md scripts knowledge /path/to/target/ cp -r .agents/rules .agents/skills /path/to/target/.agents/tests/,.github/or.agents/task_ledger.json(they are AIKit's own). Enforcement travels as the CLI gates in the command matrix above. Replace copiedknowledge/documents with your project's. Copy.agents/rules/readme_quickref.md.templateinto yourREADME.mdand replace<FILLplaceholders.
Step 2: Move Your Own Agent Instructions into Tier 1B
If the target already has its own instruction files, move project-specific rules into .agents/rules/domain.md (max 1,200 chars), then delete the originals. Sync injects that block into every generated file. It never overwrites hand-authored files without a generated header ([PROTECTED]).
Step 3: Run Principle Synchronization
Generate every Tier 1 file from GUIDELINES.md:
python scripts/sync_principles.py
This writes all 8 Tier 1 files (AGENTS.md, CLAUDE.md, GEMINI.md, .cursorrules, .github/copilot-instructions.md, .windsurfrules, .clinerules, .agents/rules/principles.md), each <=1,600 tokens including Tier 1B.
Step 4: Generate Your Knowledge Base
Run the knowledge base AST scanner to automatically index your project's classes and functions:
python scripts/update_knowledge_base.py
This generates knowledge/codebase_map.md with every exported class, method, argument, and docstring.
🏛️ The 20 Core Principles (Lifecycle-Ordered)
The principles are strictly organized across 5 chronological execution phases:
🏛️ Phase 1: Meta-Governance & Attentional Grounding
| Principle | Title | Capsule |
|---|---|---|
| PRINCIPLE-000 | Meta-Principle Integrity & Mutual Alignment | Every rule binds; conflicts follow R6 order; rule edits re-check every citing principle; gaming a gate is a violation; quality doubts go to the user. |
| PRINCIPLE-001 | Progressive Rule Disclosure & Governance Frugality | Pre-Flight checklist before the first Track C edit; Post-Flight checklist before any Track B or C commit; report only failed items (R8). |
| PRINCIPLE-002 | Lifecycle-Aligned Instruction Ordering & Attentional Priming | Track via disruption_recovery.py --track (A none, B docs/comments but not rule files, C rest); urgency alone never skips P018 gates (R5). |
| PRINCIPLE-003 | Empirical Grounding & Anti-Hallucination Invariant | Read-before-write slice freshness; git grep -w -e call-site check; deps only if declared; platform parity; ask on intent ambiguity; strict AST syntax gate. |
| PRINCIPLE-004 | Attentional Drift Prevention & Compaction Resilience | Plan = latest [1/ Phase 2 --desc in task_ledger.json; cold start --resume; never re-ask recorded answers; ADR before commit; reads/output <=100 lines. |
🧭 Phase 2: Pre-Flight Orientation & Planning
| Principle | Title | Capsule |
|---|---|---|
| PRINCIPLE-005 | AI Cold-Start Readiness & Living Documentation | README <=20k chars: prerequisites, test command, tree; user-visible changes update it same commit; update_knowledge_base.py --check gates it. |
| PRINCIPLE-006 | Incremental Progress Checkpointing & Disruption Recovery | Commit each [milestone N/M] once Phase 4 passes; failing work stays uncommitted, described by --checkpoint; --complete or --reset before switching tasks; --clean stale .tmp_*. |
| PRINCIPLE-007 | Pre-flight Impact & Quality Checklist | Track C first plan checkpoint carries --why --benefits --risks (contract, dependency, concurrency, state) --mitigation; no TODO or stub; no change outside the plan. |
| PRINCIPLE-008 | Hierarchical Problem & Task Decomposition | Plan of M<=6 milestones (more: split into tasks), built bottom-up, each passing Phase 4 alone; re-plan = new [1/M'] checkpoint; sub-agents never write the ledger. |
🏗️ Phase 3: Architecture & Lean Implementation
| Principle | Title | Capsule |
|---|---|---|
| PRINCIPLE-009 | Modularity & Pluggable Architecture | Every module: no junk-drawer name, roles of 1-5 methods, no import cycle (gated). At a pluggable boundary: 4 layers, registry lookup, constructor DI with default, frozen DTOs. |
| PRINCIPLE-010 | Performance & Resource Optimization | Stream uncontrolled input; threads only for steps >=200ms; timeout= on subprocess, with on open(); one fsync per file; --help <200ms; unit <1s, integ <5s. |
| PRINCIPLE-011 | Zero-Friction Onboarding & Instant Usability | Only declared deps; creates its dirs; prompts only with --interactive; no os.environ[...] reads; exit 0/1/2; errors give Why:/Fix:; demo <10s; other software: its aikit.py project is the workspace (R8). |
| PRINCIPLE-012 | Token Frugality & Lean Code Architecture | LLM code: <=16k-char payloads, static prefix first, schema-checked replies, 429 backoff, step caps; agent: diff -U3, search <=50 hits, relative paths. |
🛡️ Phase 4: Operational Verification & Resilience
| Principle | Title | Capsule |
|---|---|---|
| PRINCIPLE-013 | Crash Resilience, State Atomicity & Power-Loss Recovery | State files: >=10MB free, temp + fsync + os.replace (5 tries) + dir fsync, .bak, advisory locking 3s/30s stale, corrupt -> quarantine/.bak/migrate. Generated: temp + fsync + replace. |
| PRINCIPLE-014 | Automated Test Verification & Continuous Test Coverage | 100% test pass gate; behaviour change = failing-first test; weakening a test needs user approval + ADR naming it; unit <1s, no spawns/sleeps; integration <5s; tempdir + addCleanup; reachability shield (scripts/check_reachability.py). |
| PRINCIPLE-015 | Universal Operational Dogfooding & Chaos Verification | Domain-specific interactive dogfooding via scripts/dogfood.py as a commit gate; golden path + chaos perturbation; non-interactive stdin parity; portable RAII process tree teardown; ephemeral safety jail; terse reporting (<=15 lines). |
🚀 Phase 5: Living Synchronization & Delivery
| Principle | Title | Capsule |
|---|---|---|
| PRINCIPLE-016 | AI Knowledge Base & Continuous Synchronization | Canonical knowledge/ sync; atomic code-and-doc pairing; monotonic append-only ADR register; strict AST syntax validation; link integrity shield; scripts/update_knowledge_base.py. |
| PRINCIPLE-017 | Living Principles System & Automated Synchronization | Rule sync (scripts/sync_principles.py); context budget check; schema compliance; freshness test gate; Tier 1B domain rules (<=1,200 chars). |
| PRINCIPLE-018 | Automatic Git Workflow | Automatic conventional commits (--validate-commit) + adaptive push, unless the user opts out, never forced; explicit staging (zero git add .); pre-commit delivery triad (tests, read-only gates, staged diff); non-destructive recoil. |
| PRINCIPLE-019 | Secret & Sensitive Data Hygiene | Zero credentials in tracked files, logs or ledgers; secrets via env/secret store; .gitignore credential baseline; scripts/check_secrets.py scans staged diffs + ledger; redacted diagnostics; rotate, never revert. |
⚡ Disruption Recovery & Power-Loss Protection
If electricity cuts out, battery dies, or the computer crashes mid-task:
- Pre-flight Audit: On a cold start, run this one command first (PRINCIPLE-004 R2):
It prints everypython scripts/disruption_recovery.py --resume--auditfinding, then the interrupted task, its plan and the phase to resume at. With no interrupted task it says "Ready" only when no uncommitted files exist. - Everything else (
--audit,--checkpoint,--complete,--reset,--clean) is in the command matrix above; a task's first plan checkpoint must carry--why --benefits --risks --mitigation. - Atomic File Safety: state files are written to a temp file, fsynced and renamed (PRINCIPLE-013); a corrupt ledger is moved to
*.corrupt_*and restored from its.bak.
🛠️ Adding New Principles to Your Project
- Add
### PRINCIPLE-0XX: [Title](the next free ID) toGUIDELINES.mdonly, withProblem,Concept,Invariantand numberedRules, under the right lifecycle heading. - Raise
MIN_PRINCIPLESinscripts/sync_principles.pyandEXPECTED_PRINCIPLE_COUNTintests/test_kit.py; add the ID to this README and both checklists. - Run
python scripts/sync_principles.py. On[TOKEN EXCEEDED]or[TIER 1B HEADROOM], pay for the new capsule by condensing existing capsule narrative (PRINCIPLE-001 R9). - All 8 generated Tier 1 files then carry the new capsule.
Yorumlar (0)
Yorum birakmak icin giris yap.
Yorum birakSonuc bulunamadi