{"_id":"@aqthevisionnow/core","name":"@aqthevisionnow/core","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@aqthevisionnow/core","version":"0.1.0","description":"Governed AI agents. Soul, Guardian, Brain, Nerve, Mirror, Voice, Router — the biological architecture that makes agents safe, ethical, and excellent.","main":"src/index.js","keywords":["ai-agent","agent-framework","ai-governance","ai-safety","ai-ethics","guardrails","agent-memory","multi-model","ai-router","biological-architecture","aqthevision"],"author":{"name":"AQTheVision","email":"hello@aqthevision.ai"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/aqthevision/aq.git"},"homepage":"https://aqthevision.ai","engines":{"node":">=18.0.0"},"scripts":{"test":"node --test test/aq.test.js"},"gitHead":"2583462fe5b5da2c3079ca9c34d016a962beddff","_id":"@aqthevisionnow/core@0.1.0","bugs":{"url":"https://github.com/aqthevision/aq/issues"},"_nodeVersion":"24.13.1","_npmVersion":"11.8.0","dist":{"integrity":"sha512-7kKr4h0k95JYSD19g+w8gbM4cdKi0EcYCFFgP/ompfTGmsu7+jn6p+LjL/NL2tGIcP3gDBdZjbWaF5B/bklmyQ==","shasum":"4e4345fdaccd1749131734f6a451b33d0b712c76","tarball":"https://registry.npmjs.org/@aqthevisionnow/core/-/core-0.1.0.tgz","fileCount":4,"unpackedSize":18500,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDDJW568VDhoywbSjCugGH40MndVjCGS1BkGEP+J4nfsgIhANy8C7jZRm/OXRY4l74VZcXxD2TKvRgHwbXXpCaF/fS9"}]},"_npmUser":{"name":"iamthe1h","email":"Iamthe1h@proton.me"},"directories":{},"maintainers":[{"name":"iamthe1h","email":"Iamthe1h@proton.me"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/core_0.1.0_1774445577484_0.22490108641106032"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-25T13:32:57.399Z","0.1.0":"2026-03-25T13:32:57.641Z","modified":"2026-03-25T13:32:57.957Z"},"maintainers":[{"name":"iamthe1h","email":"Iamthe1h@proton.me"}],"description":"Governed AI agents. Soul, Guardian, Brain, Nerve, Mirror, Voice, Router — the biological architecture that makes agents safe, ethical, and excellent.","homepage":"https://aqthevision.ai","keywords":["ai-agent","agent-framework","ai-governance","ai-safety","ai-ethics","guardrails","agent-memory","multi-model","ai-router","biological-architecture","aqthevision"],"repository":{"type":"git","url":"git+https://github.com/aqthevision/aq.git"},"author":{"name":"AQTheVision","email":"hello@aqthevision.ai"},"bugs":{"url":"https://github.com/aqthevision/aq/issues"},"license":"MIT","readme":"# aq\r\n\r\nGoverned AI agents. Nine organs. One framework.\r\n\r\n```\r\nnpm install aq\r\n```\r\n\r\n## The Problem\r\n\r\nAI agents hallucinate. They overpromise. They manipulate with false urgency. They give medical advice they shouldn't. They panic vulnerable people. They sound like robots. Every agent framework helps you build agents. None of them help you govern them.\r\n\r\n## One Line of Safety\r\n\r\n```js\r\nconst aq = require('aq');\r\n\r\nconst result = aq.guard('I guarantee 100% results! Act now, limited time only!');\r\n\r\nconsole.log(result.safe);        // true (no critical violations)\r\nconsole.log(result.response);    // \"I believe in strong results!\" (overpromise softened, urgency removed)\r\nconsole.log(result.flags);       // [{ type: 'overpromise', ... }, { type: 'manipulation', ... }]\r\nconsole.log(result.corrections); // ['Softened overpromise language', 'Removed false urgency language']\r\n```\r\n\r\nThat's the entry point. One function. Your agent stops lying, stops manipulating, stops hallucinating. The response gets cleaned before it reaches a human.\r\n\r\n## Five Lines to a Governed Agent\r\n\r\n```js\r\nconst aq = require('aq');\r\n\r\nconst agent = aq.create({\r\n  soul: {\r\n    name: 'my-agent',\r\n    purpose: 'Help restaurant owners manage their business',\r\n    values: ['honesty', 'warmth', 'teach over do'],\r\n    refusals: ['Never fabricate reviews', 'Never invent menu items', 'Never create dependency']\r\n  },\r\n  brain: true,\r\n  nerve: 'business',\r\n  llm: async (systemPrompt, userMessage, maxTokens) => {\r\n    // Bring your own model — Claude, GPT, Gemini, DeepSeek, local, anything\r\n    return await yourLLMCall(systemPrompt, userMessage, maxTokens);\r\n  }\r\n});\r\n\r\nconst result = await agent.ask(\r\n  'You are a helpful restaurant business assistant.',\r\n  'How do I get more 5-star reviews?'\r\n);\r\n\r\nconsole.log(result.text);                    // The response\r\nconsole.log(result.biological.confidence);   // 0.85 — how confident the agent is\r\nconsole.log(result.biological.soulViolations); // 0 — soul rules enforced\r\nconsole.log(result.biological.guardFlags);   // 0 — safety checks passed\r\nconsole.log(result.biological.nerveSignals); // 0 — no distress detected\r\n```\r\n\r\nEvery response comes with biological metadata. You always know: how confident was the agent? Did it violate any values? Did it detect distress? Should it escalate to a human?\r\n\r\n## The Nine Organs\r\n\r\nEvery agent is made from the same parts. Like a human body.\r\n\r\n| Organ | What It Does | One-Line Usage |\r\n|-------|-------------|---------------|\r\n| **Soul** | Values, refusals, personality, enforcement | `aq.soul.createSoul({ name, purpose, values })` |\r\n| **Guardian** | Response safety, vulnerability detection, emergency handling | `aq.guardian.guardResponse(text)` |\r\n| **Sacred Laws** | Governance rules with detect functions, audit trails | `aq.sacredLaws.createLaws([...])` |\r\n| **Brain** | Memory — remember, recall, search, forget, decay | `aq.brain.createBrain()` |\r\n| **Nerve** | Pattern detection, emergency signals, reflexes | `aq.nerve.scan(input, signals)` |\r\n| **Mirror** | Confidence scoring, uncertainty detection, escalation | `aq.mirror.assess(input, output)` |\r\n| **Voice** | Communication style detection, adaptation | `aq.voice.detect(text)` |\r\n| **Router** | 7 AI providers, cost-optimized, auto-fallback | `aq.router.createRouter({ keys })` |\r\n| **Bio-Wrap** | Assembles all organs into a living agent | `aq.bioWrap.createAgent({ soul, llm })` |\r\n\r\nUse `aq.create()` for the quick path. Use individual organs for full control.\r\n\r\n## What Each Organ Does\r\n\r\n### Soul — The Conscience\r\n\r\n```js\r\nconst { createSoul, buildContext, enforce } = aq.soul;\r\n\r\nconst soul = createSoul({\r\n  name: 'my-agent',\r\n  purpose: 'Help small business owners',\r\n  values: ['honesty', 'excellence', 'teach over do'],\r\n  refusals: ['Never fabricate data', 'Never create dependency'],\r\n  personality: { warmth: 0.8, formality: 0.4, directness: 0.9 },\r\n  enforcement: [\r\n    { name: 'no_false_urgency', pattern: 'act now|last chance', action: 'strip', severity: 'high' },\r\n    { name: 'no_fabrication', pattern: 'guaranteed|100% success', action: 'block', severity: 'critical' }\r\n  ]\r\n});\r\n\r\n// Inject into system prompt\r\nconst systemPrompt = 'You are a business assistant.' + buildContext(soul);\r\n\r\n// After AI responds, enforce the soul\r\nconst { response, violations, blocked } = enforce(soul, aiResponse);\r\n```\r\n\r\n### Guardian — The Protector\r\n\r\n```js\r\nconst { guardResponse, detectVulnerability, detectEmergency, honestUncertainty } = aq.guardian;\r\n\r\n// Guard a response\r\nconst guarded = guardResponse(aiResponse, { channel: 'phone', verified_data: false });\r\nif (!guarded.safe) dontSendThis();\r\n\r\n// Detect vulnerable people\r\nconst vuln = detectVulnerability(\"I'm losing everything, I can't cope\");\r\n// vuln.care_level = 'maximum', vuln.adjustments.escalate_to_human = true\r\n\r\n// Detect emergencies\r\nconst emergency = detectEmergency(\"Someone is having a heart attack\");\r\n// emergency.is_emergency = true, emergency.transfer_to_human = true\r\n\r\n// When unsure, be honest\r\nconst honest = honestUncertainty('What are your hours?', { channel: 'sms' });\r\n// \"Great question! Let me verify and get back to you shortly.\"\r\n```\r\n\r\n### Brain — The Memory\r\n\r\n```js\r\nconst { createBrain } = aq.brain;\r\n\r\nconst brain = createBrain();\r\n\r\nbrain.remember('my-agent', 'tenant-123', {\r\n  type: 'preference',\r\n  subject: 'John Smith',\r\n  content: 'Prefers morning appointments. Allergic to peanuts.',\r\n  importance: 8\r\n});\r\n\r\nconst memories = brain.recall('my-agent', 'tenant-123', { subject: 'John Smith' });\r\nconst context = brain.getContext('my-agent', 'tenant-123'); // prompt-ready string\r\nconst results = brain.search('my-agent', 'tenant-123', 'morning appointments');\r\n\r\n// Persistence\r\nconst data = brain.exportAll();\r\n// Save to file, database, wherever\r\nbrain.importAll(JSON.parse(savedData));\r\n```\r\n\r\n### Nerve — The Nervous System\r\n\r\n```js\r\nconst { scan, buildContext } = aq.nerve;\r\n\r\nconst result = scan(userMessage, [\r\n  { name: 'emergency', pattern: '(?:emergency|911|urgent)', severity: 'critical', reflex: 'escalate' },\r\n  { name: 'complaint', pattern: '(?:angry|frustrated|terrible)', severity: 'medium', reflex: 'flag' },\r\n  { name: 'opportunity', pattern: '(?:recommend|upgrade)', severity: 'low', reflex: 'note' }\r\n]);\r\n\r\nif (result.shouldBypassBrain) {\r\n  // Critical signal — act immediately, skip normal processing\r\n  handleEmergency(result.reflexes[0]);\r\n}\r\n```\r\n\r\n### Mirror — The Self-Awareness\r\n\r\n```js\r\nconst { assess } = aq.mirror;\r\n\r\nconst mirror = assess(userQuestion, aiResponse, { brainHits: 3, nerveSignals: 0 });\r\n\r\nif (mirror.escalate) transferToHuman();\r\nif (mirror.assessment === 'uncertain_add_disclaimer') addDisclaimer();\r\n// mirror.confidence = 0.85, mirror.gaps = [], mirror.flags = []\r\n```\r\n\r\n### Voice — The Communication Style\r\n\r\n```js\r\nconst { detect, createProfileStore, buildContext } = aq.voice;\r\n\r\nconst traits = detect(\"Hey! Super excited about this!! Can't wait lol\");\r\n// { formal: 0.3, verbose: 0.12, emotional: 0.53 }\r\n\r\nconst profiles = createProfileStore();\r\nprofiles.detectAndUpdate('my-agent', 'contact-456', userMessage);\r\nconst voiceContext = buildContext(profiles.get('my-agent', 'contact-456'));\r\n// \"Adapt: Keep it casual and friendly. Keep responses brief and direct.\"\r\n```\r\n\r\n## Bring Your Own Model\r\n\r\n`aq` is model-agnostic. Provide an `llm` function and use whatever you want:\r\n\r\n```js\r\n// Claude\r\nconst agent = aq.create({\r\n  soul: { name: 'test', purpose: 'Testing' },\r\n  llm: async (sys, msg, max) => {\r\n    const resp = await anthropic.messages.create({\r\n      model: 'claude-sonnet-4-20250514', max_tokens: max,\r\n      system: sys, messages: [{ role: 'user', content: msg }]\r\n    });\r\n    return { text: resp.content[0].text, usage: resp.usage };\r\n  }\r\n});\r\n\r\n// OpenAI\r\nllm: async (sys, msg, max) => {\r\n  const resp = await openai.chat.completions.create({\r\n    model: 'gpt-4o', max_tokens: max,\r\n    messages: [{ role: 'system', content: sys }, { role: 'user', content: msg }]\r\n  });\r\n  return { text: resp.choices[0].message.content };\r\n}\r\n\r\n// Or use @aq/router for automatic model selection\r\nconst router = aq.router.createRouter({ keys: { claude: ANTHROPIC_KEY, deepseek: DEEPSEEK_KEY } });\r\nllm: (sys, msg, max) => router.route('agent_response', sys, msg, { maxTokens: max })\r\n```\r\n\r\n## Tests\r\n\r\n185 tests. Zero dependencies. All passing.\r\n\r\n```\r\nnpm test\r\n```\r\n\r\n```\r\naq             25 tests — unified API, guard, create, organ access\r\nsoul           23 tests — creation, validation, context, enforcement\r\nsacred-laws    22 tests — laws, check, audit, presets\r\nguardian       41 tests — guard, vulnerability, emergency, uncertainty, audit, fallbacks\r\nbrain          27 tests — remember, recall, search, forget, decay, export/import\r\nnerve          15 tests — scan, signals, reflexes, context\r\nmirror         13 tests — assess, confidence, escalation\r\nvoice          19 tests — detect, profiles, context, adaptation\r\n```\r\n\r\n## Philosophy\r\n\r\n`aq` exists because AI agents are about to handle real decisions — financial, medical, legal, personal. The industry is building agents without governance. We built the governance.\r\n\r\nThe organs are free. The architecture is open. What you build with them is yours.\r\n\r\n## License\r\n\r\nMIT\r\n","readmeFilename":"README.md","_rev":"1-c6ed55fab96de195b49cbeeb31e8e36b"}