trucontext 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Alpha Collective LLC
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/PRIVACY.md ADDED
@@ -0,0 +1,119 @@
1
+ # TruContext Privacy Policy
2
+
3
+ **Effective Date:** March 22, 2026
4
+ **Last Updated:** March 22, 2026
5
+
6
+ Alpha Collective LLC ("Company," "we," "us," or "our") operates the TruContext platform, APIs, CLI tools, and related services (collectively, the "Service"). This Privacy Policy describes how we collect, use, and protect information when you use the Service.
7
+
8
+ ## 1. Information We Collect
9
+
10
+ ### Account Information
11
+ When you create an account, we collect:
12
+ - Email address (via OAuth through AWS Cognito)
13
+ - Authentication tokens (stored locally on your device, not on our servers)
14
+
15
+ We do not collect passwords. Authentication is handled entirely through OAuth providers (Google, email-based magic links).
16
+
17
+ ### Your Data (User Content)
18
+ When you use the Service, you may ingest, store, and process:
19
+ - Text content, documents, images, audio, and other files
20
+ - Entities, relationships, and structural data
21
+ - Metadata you provide (author hints, source medium, filenames)
22
+ - Confidence scores, temporal flags, and context relationships
23
+
24
+ **You own Your Data.** See Section 2.
25
+
26
+ ### Usage Data
27
+ We automatically collect:
28
+ - API request logs (endpoint, method, timestamp, response status)
29
+ - Error logs for debugging and service reliability
30
+ - Aggregate usage metrics (ingest volume, query count, API key usage)
31
+
32
+ We do not collect or log the content of your API requests or responses in our usage analytics.
33
+
34
+ ### Device and CLI Information
35
+ The CLI tool stores authentication tokens locally at `~/.trucontext/credentials.json` with restricted file permissions (readable only by your user account). We do not collect device identifiers, IP addresses for tracking purposes, or telemetry from the CLI tool.
36
+
37
+ ## 2. How We Use Your Data
38
+
39
+ ### Your Content
40
+ - **To provide the Service:** We process your content through our AI pipeline (extraction, classification, enrichment) solely to operate the features you use.
41
+ - **Within your tenant only:** Your Data is isolated to your tenant. Other users cannot access it. Our systems enforce tenant isolation at every layer.
42
+ - **Not for training:** We do not use Your Data to train, fine-tune, or improve machine learning models — ours or anyone else's — unless you provide separate, explicit written consent.
43
+ - **Not for sale:** We do not sell, rent, or share Your Data with third parties for their commercial purposes.
44
+
45
+ ### Account Information
46
+ - To authenticate your access to the Service
47
+ - To communicate with you about your account, service updates, and security notices
48
+
49
+ ### Usage Data
50
+ - To monitor and improve Service reliability and performance
51
+ - To detect and prevent abuse, fraud, and security threats
52
+ - To generate aggregate, anonymized statistics about Service usage (which cannot be used to identify you or your content)
53
+
54
+ ## 3. Third-Party Services
55
+
56
+ We use the following third-party services to operate the platform:
57
+
58
+ | Service | Purpose | Data Shared |
59
+ |---------|---------|-------------|
60
+ | **AWS** (DynamoDB, S3, Lambda, Cognito) | Infrastructure and authentication | Your Data is stored and processed in AWS US regions |
61
+ | **Neo4j Aura** | Graph database | Your Data is stored in the intelligent knowledge graph |
62
+ | **Anthropic** (Claude API) | AI processing pipeline | Content you ingest is sent to Claude for extraction and classification |
63
+ | **Google AI** (Gemini API) | Alternative AI processing | Content may be sent to Gemini if configured by admin |
64
+ | **Stripe** | Payment processing | Email and billing information for paid plans |
65
+
66
+ When your content is processed by AI providers (Anthropic, Google), it is sent via their APIs under their respective data processing terms. These providers have committed to not training on API inputs. We select providers whose data practices align with our commitment to your privacy.
67
+
68
+ ## 4. Data Retention
69
+
70
+ - **Your Data:** Retained as long as your account is active. Upon account termination, you may request data export within 30 days. After 30 days, Your Data may be permanently deleted.
71
+ - **Heartbeat events:** Automatically expire after 30 days (TTL).
72
+ - **Heartbeat thoughts:** Automatically expire after 90 days (TTL).
73
+ - **Usage logs:** Retained for up to 12 months for operational purposes, then deleted.
74
+ - **Account information:** Retained until you delete your account.
75
+
76
+ ## 5. Data Security
77
+
78
+ We implement industry-standard security measures:
79
+
80
+ - **Encryption at rest:** All data stored in DynamoDB, S3, and Neo4j is encrypted.
81
+ - **Encryption in transit:** All API communication uses TLS/HTTPS.
82
+ - **Tenant isolation:** Every database query is scoped to your tenant ID. Cross-tenant access is architecturally prevented.
83
+ - **API key security:** API keys are managed through AWS API Gateway with usage plans and throttling.
84
+ - **Authentication:** OAuth 2.0 with PKCE flow. No passwords stored.
85
+ - **Access control:** Role-based access with system admin separation.
86
+ - **Local credential security:** CLI tokens stored with 600 file permissions (user-read-only).
87
+
88
+ ## 6. Your Rights
89
+
90
+ You have the right to:
91
+
92
+ - **Access** your data at any time through the API, CLI, or dashboard.
93
+ - **Export** your data in structured format upon request.
94
+ - **Delete** your data by deleting entities, content, or your entire account.
95
+ - **Correct** your data by updating entities and ingesting corrections.
96
+ - **Object** to specific processing by contacting us.
97
+ - **Withdraw consent** for any optional processing at any time.
98
+
99
+ For data subject requests, contact us at privacy@alphacollective.com.
100
+
101
+ ## 7. Children's Privacy
102
+
103
+ The Service is not directed to individuals under 16. We do not knowingly collect information from children under 16. If you become aware that a child has provided us with personal information, please contact us and we will take steps to delete such information.
104
+
105
+ ## 8. International Data Transfers
106
+
107
+ Your Data is processed and stored in the United States (AWS US-East-1 region). If you are located outside the United States, your data will be transferred to and processed in the United States. By using the Service, you consent to this transfer.
108
+
109
+ ## 9. Changes to This Policy
110
+
111
+ We may update this Privacy Policy from time to time. We will notify you of material changes via email or through the Service. Your continued use of the Service after changes take effect constitutes acceptance of the updated policy.
112
+
113
+ ## 10. Contact
114
+
115
+ For privacy-related questions or data subject requests:
116
+
117
+ **Alpha Collective LLC**
118
+ Email: privacy@alphacollective.com
119
+ Website: https://trucontext.ai
package/README.md ADDED
@@ -0,0 +1,183 @@
1
+ # TruContext CLI
2
+
3
+ Persistent, intelligent memory for AI agents.
4
+
5
+ Your agent forgets everything. Every session starts from zero. Context compaction destroys what it learned. Memory plugins store facts but can't connect them. Your agent retrieves text snippets and hopes for the best.
6
+
7
+ **TruContext is different.** It's an intelligent knowledge graph — not flat storage, not keyword search, not GraphRAG. Your agent doesn't just *remember*. It *understands*.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npx trucontext login
13
+ ```
14
+
15
+ That's it. No API keys to copy, no config files to edit. Browser-based OAuth, then you're in.
16
+
17
+ ## The 30-Second Version
18
+
19
+ ```bash
20
+ # Create an entity for the person your agent works with
21
+ npx trucontext entities create --id dustin --type Person \
22
+ --properties '{"name": "Dustin", "role": "founder"}' \
23
+ --recipe recipe:personal-assistant-memory
24
+
25
+ # Ingest what your agent learned
26
+ npx trucontext ingest "Dustin prefers async communication and dark mode. \
27
+ He values clean code over backwards compatibility." \
28
+ --context dustin:ABOUT --confidence 0.85 --temporal
29
+
30
+ # Ask an intelligent question
31
+ npx trucontext query "What does Dustin prefer?"
32
+ ```
33
+
34
+ The response isn't a list of matching documents. It's structured understanding — concepts with confidence scores, emotional signatures, relationship context, and temporal awareness.
35
+
36
+ ## What Makes TruContext Different
37
+
38
+ ### Intelligent Knowledge Graph, Not Flat Storage
39
+
40
+ Memory plugins give you key-value pairs. TruContext gives you an intelligent knowledge graph where every piece of knowledge is connected to the entities, concepts, and emotions it relates to. When you ask "What does Dustin believe about AI?", the system traverses from the Person node through relationships to concepts, content, and emotional primitives — returning structured understanding, not text matches.
41
+
42
+ ### Confidence + Temporal Decay
43
+
44
+ Not all memory is equal. A stated preference has higher confidence than an inferred pattern. A fact ("attended the Super Bowl") never decays. A preference ("likes morning meetings") fades if not reinforced. TruContext tracks both — so your agent knows what it's sure about and what's getting stale.
45
+
46
+ ```bash
47
+ # High confidence, temporal — a strong preference that may change
48
+ npx trucontext ingest "Dustin prefers dark mode" \
49
+ --context dustin:ABOUT --confidence 0.9 --temporal
50
+
51
+ # Low confidence, permanent — an unverified fact
52
+ npx trucontext ingest "Dustin attended the Super Bowl in 2024" \
53
+ --context dustin:ABOUT --confidence 0.3 --no-temporal
54
+ ```
55
+
56
+ ### Curiosity — The System Asks What's Missing
57
+
58
+ Most memory systems only answer questions. TruContext also asks them. The heartbeat — a background intelligence layer — dreams about your data and surfaces what's missing, what's contradictory, and what needs more evidence. It generates attention directives that make every future interaction smarter.
59
+
60
+ ### Recipes — Cognitive Templates
61
+
62
+ Recipes teach your agent *how to think* about a use case. Attach a recipe to a context node, and the heartbeat dreams about that data through the recipe's lens.
63
+
64
+ 12 built-in recipes:
65
+
66
+ | Recipe | What It Does |
67
+ |--------|-------------|
68
+ | `personal-assistant-memory` | Persistent 1:1 user memory with preference tracking |
69
+ | `meeting-memory` | Cross-meeting decisions, action items, position tracking |
70
+ | `competitive-intelligence` | Competitor tracking, strategic early warning |
71
+ | `customer-voice` | Sentiment tracking, churn signals, feature request aggregation |
72
+ | `ai-agent-self-reflection` | The agent learns about itself — decisions, errors, feedback |
73
+ | `behavioral-observation` | Actions vs words — say-do gap analysis |
74
+ | `organizational-context` | Living org charts, relationship mapping |
75
+ | `customer-persona` | Aggregate archetypes that evolve with evidence |
76
+ | `decision-archive` | Decisions + rationale + rejected alternatives |
77
+ | `curiosity-loop` | The graph's gaps as the primary signal |
78
+ | `values-alignment` | Tension between stated values and actions |
79
+ | `temporal-drift` | Belief evolution tracking over time |
80
+
81
+ ```bash
82
+ # See all recipes
83
+ npx trucontext recipes list
84
+
85
+ # Read the full recipe — WHY (how the system interprets) + HOW (implementation guide)
86
+ npx trucontext recipes get recipe:personal-assistant-memory
87
+ ```
88
+
89
+ ### Model-Agnostic Memory
90
+
91
+ TruContext doesn't care which LLM reads or writes to it. An OpenClaw agent using GPT can ingest. A Claude Code agent can query. A custom Gemini pipeline can recall. Switch models — keep the knowledge. The intelligent knowledge graph is the constant. The model is the variable.
92
+
93
+ ### Self-Reflection
94
+
95
+ Your agent can track its own learning — what decisions it made, where it was wrong, what feedback it received. Attach the `ai-agent-self-reflection` recipe and the agent builds meta-cognition over time. It doesn't just learn about the world. It learns about itself.
96
+
97
+ ### 36 Relationship Types
98
+
99
+ Content connects to entities through typed relationships — not just "related to" but *how*. BY, ABOUT, CAPTURES, RESPONDS_TO, REINFORCES, OPPOSES, DERIVED_FROM, and 29 more. Your agent speaks a rich vocabulary about how knowledge connects.
100
+
101
+ ```bash
102
+ # See all relationship types
103
+ npx trucontext relationship-types
104
+
105
+ # Link content to multiple entities with different relationships
106
+ npx trucontext ingest "Session summary..." \
107
+ --context dustin:ABOUT \
108
+ --context agent-claude:BY \
109
+ --context session-mar-22:CAPTURES
110
+ ```
111
+
112
+ ## The Lifecycle
113
+
114
+ The ideal loop for an AI agent using TruContext:
115
+
116
+ ```
117
+ Observe → Capture → Sleep → Wake → Query → Observe → ...
118
+ ```
119
+
120
+ 1. **Observe** during the session — accumulate signal
121
+ 2. **Capture** before compaction — ingest summaries, decisions, preferences
122
+ 3. **Sleep** — the heartbeat dreams about your data (decay, patterns, curiosity)
123
+ 4. **Wake** — query to rebuild working memory
124
+ 5. **Repeat** — each cycle makes the agent smarter
125
+
126
+ ## Commands
127
+
128
+ ### Auth
129
+ | Command | Description |
130
+ |---------|-------------|
131
+ | `login` | Sign in via browser (OAuth + PKCE) |
132
+ | `logout` | Clear stored credentials |
133
+ | `whoami` | Show current user and active app |
134
+
135
+ ### Apps
136
+ | Command | Description |
137
+ |---------|-------------|
138
+ | `init [name]` | Create a new app with AI-generated schema |
139
+ | `apps` | List your apps |
140
+ | `use <app>` | Set the active app |
141
+
142
+ ### Data
143
+ | Command | Description |
144
+ |---------|-------------|
145
+ | `ingest <source>` | Ingest text or file with confidence, temporal, and context linking |
146
+ | `query <question>` | Query the intelligent knowledge graph |
147
+ | `recall <query>` | Semantic memory recall with graph expansion |
148
+
149
+ ### Structure
150
+ | Command | Description |
151
+ |---------|-------------|
152
+ | `entities list` | List entities |
153
+ | `entities create` | Create entity with recipe, confidence, temporal, contexts |
154
+ | `entities get <id>` | Get entity details |
155
+ | `entities update <id>` | Update entity properties, recipe, heartbeat settings |
156
+ | `entities delete <id>` | Delete entity |
157
+ | `contexts list` | List contexts |
158
+ | `contexts create <name>` | Create a scoping context |
159
+ | `contexts delete <id>` | Delete context |
160
+
161
+ ### Intelligence
162
+ | Command | Description |
163
+ |---------|-------------|
164
+ | `recipes list` | List all recipes (system + custom) |
165
+ | `recipes get <id>` | Get recipe details (WHY + HOW) |
166
+ | `recipes create` | Create a custom recipe |
167
+ | `recipes delete <id>` | Delete a custom recipe |
168
+ | `relationship-types` | List all relationship types |
169
+ | `schema show` | Show current app schema |
170
+ | `schema generate` | AI-generate a schema from description |
171
+
172
+ ## API
173
+
174
+ TruContext has two API surfaces:
175
+
176
+ - **Data Plane** (`api.trucontext.ai`) — ingest, query, recall, entities, contexts. Authenticated with API keys.
177
+ - **Control Plane** (`platform.trucontext.ai`) — apps, schema, recipes, settings. Authenticated with JWT.
178
+
179
+ Full API documentation: [app.trucontext.ai/docs](https://app.trucontext.ai/docs)
180
+
181
+ ## License
182
+
183
+ MIT
package/TERMS.md ADDED
@@ -0,0 +1,101 @@
1
+ # TruContext Terms of Service
2
+
3
+ **Effective Date:** March 22, 2026
4
+ **Last Updated:** March 22, 2026
5
+
6
+ These Terms of Service ("Terms") govern your access to and use of the TruContext platform, APIs, CLI tools, and related services (collectively, the "Service") provided by Alpha Collective LLC ("Company," "we," "us," or "our").
7
+
8
+ By creating an account, accessing the Service, or using the CLI tool, you agree to be bound by these Terms. If you do not agree, do not use the Service.
9
+
10
+ ## 1. Your Data, Your Ownership
11
+
12
+ **You own your data.** All content, entities, relationships, and knowledge graph data that you or your applications create, ingest, or store through the Service ("Your Data") remains your property. We claim no ownership rights over Your Data.
13
+
14
+ We will not use Your Data to train machine learning models, improve our AI systems, or for any purpose beyond providing and maintaining the Service to you — unless you provide separate, explicit written consent.
15
+
16
+ ## 2. What We Do With Your Data
17
+
18
+ We process Your Data solely to provide the Service:
19
+
20
+ - **Storage:** Your Data is stored in encrypted databases (DynamoDB, Neo4j, S3) within AWS infrastructure.
21
+ - **Processing:** When you ingest content, our AI pipeline extracts concepts, relationships, and patterns as part of the Service's core functionality. This processing is done exclusively for your benefit within your tenant.
22
+ - **Heartbeat:** Our background intelligence layer ("heartbeat") analyzes patterns in Your Data to surface insights, manage confidence decay, and generate attention directives — all within your tenant boundary.
23
+
24
+ We do not access, review, or analyze Your Data for any purpose other than operating the Service, unless required by law or with your explicit consent.
25
+
26
+ ## 3. Account and Security
27
+
28
+ - You are responsible for maintaining the security of your account credentials.
29
+ - You must not share API keys or authentication tokens with unauthorized parties.
30
+ - You are responsible for all activity that occurs under your account.
31
+ - You must notify us promptly of any unauthorized access to your account.
32
+
33
+ ## 4. Acceptable Use
34
+
35
+ You agree not to:
36
+
37
+ - Use the Service for any unlawful purpose or in violation of any applicable laws.
38
+ - Ingest content that you do not have the right to use or that infringes third-party intellectual property rights.
39
+ - Attempt to access another user's data, circumvent tenant isolation, or probe the Service's security.
40
+ - Use the Service to store or process data subject to specific regulatory requirements (e.g., HIPAA, PCI-DSS) unless you have obtained a separate written agreement with us for such use.
41
+ - Reverse engineer, decompile, or attempt to extract the source code of our proprietary systems.
42
+ - Resell, redistribute, or sublicense access to the Service without our written consent.
43
+
44
+ ## 5. Service Availability
45
+
46
+ We strive to maintain high availability but do not guarantee uninterrupted access. The Service is provided on an "as available" basis. We may perform maintenance, updates, or modifications that temporarily affect availability. We will make reasonable efforts to provide advance notice of planned downtime.
47
+
48
+ ## 6. API Usage and Rate Limits
49
+
50
+ - API usage is subject to rate limits and quotas based on your plan tier.
51
+ - We reserve the right to throttle or suspend access if usage patterns indicate abuse or threaten the stability of the Service.
52
+ - Plan tiers, pricing, and associated limits are published on our website and may be updated with reasonable notice.
53
+
54
+ ## 7. Intellectual Property
55
+
56
+ - The Service, including its architecture, algorithms, documentation, recipes, and all related intellectual property, is owned by Alpha Collective LLC and protected by applicable intellectual property laws.
57
+ - Your use of the Service does not grant you any rights to our intellectual property except the limited right to use the Service in accordance with these Terms.
58
+ - The TruContext CLI is licensed under the MIT License. This license applies to the CLI software only, not to the Service.
59
+
60
+ ## 8. Limitation of Liability
61
+
62
+ TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL ALPHA COLLECTIVE LLC, ITS OFFICERS, DIRECTORS, EMPLOYEES, OR AGENTS BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, OR PUNITIVE DAMAGES, INCLUDING BUT NOT LIMITED TO LOSS OF PROFITS, DATA, USE, OR GOODWILL, ARISING OUT OF OR IN CONNECTION WITH YOUR USE OF THE SERVICE, REGARDLESS OF THE THEORY OF LIABILITY.
63
+
64
+ OUR TOTAL AGGREGATE LIABILITY ARISING OUT OF OR RELATING TO THESE TERMS OR THE SERVICE SHALL NOT EXCEED THE GREATER OF (A) THE AMOUNTS YOU PAID TO US IN THE TWELVE MONTHS PRECEDING THE CLAIM, OR (B) ONE HUNDRED DOLLARS ($100).
65
+
66
+ ## 9. Indemnification
67
+
68
+ You agree to indemnify, defend, and hold harmless Alpha Collective LLC and its officers, directors, employees, and agents from and against any claims, liabilities, damages, losses, costs, or expenses (including reasonable attorneys' fees) arising out of or relating to:
69
+
70
+ - Your use of the Service.
71
+ - Your violation of these Terms.
72
+ - Your violation of any third-party rights, including intellectual property rights.
73
+ - Any content you ingest, store, or process through the Service.
74
+
75
+ ## 10. Disclaimer of Warranties
76
+
77
+ THE SERVICE IS PROVIDED "AS IS" AND "AS AVAILABLE" WITHOUT WARRANTIES OF ANY KIND, WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
78
+
79
+ WE DO NOT WARRANT THAT THE SERVICE WILL BE UNINTERRUPTED, ERROR-FREE, OR SECURE, OR THAT ANY DEFECTS WILL BE CORRECTED. THE AI-GENERATED OUTPUTS OF THE SERVICE (INCLUDING EXTRACTED CONCEPTS, INSIGHTS, AND HEARTBEAT ANALYSES) ARE PROVIDED FOR INFORMATIONAL PURPOSES AND SHOULD NOT BE RELIED UPON AS THE SOLE BASIS FOR DECISIONS.
80
+
81
+ ## 11. Termination
82
+
83
+ - You may terminate your account at any time by contacting us or deleting your account through the dashboard.
84
+ - We may suspend or terminate your access if you violate these Terms, upon reasonable notice where practicable.
85
+ - Upon termination, you may request export of Your Data within 30 days. After 30 days, we may delete Your Data from our systems.
86
+
87
+ ## 12. Changes to These Terms
88
+
89
+ We may update these Terms from time to time. We will notify you of material changes via email or through the Service. Your continued use of the Service after changes take effect constitutes acceptance of the updated Terms.
90
+
91
+ ## 13. Governing Law
92
+
93
+ These Terms are governed by and construed in accordance with the laws of the State of Colorado, United States, without regard to conflict of law principles. Any disputes arising under these Terms shall be resolved in the state or federal courts located in Colorado.
94
+
95
+ ## 14. Contact
96
+
97
+ For questions about these Terms, contact us at:
98
+
99
+ **Alpha Collective LLC**
100
+ Email: legal@alphacollective.com
101
+ Website: https://trucontext.ai
package/bin/cli.js ADDED
@@ -0,0 +1,157 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { program } from 'commander';
4
+ import { loginCommand } from '../src/commands/login.js';
5
+ import { logoutCommand } from '../src/commands/logout.js';
6
+ import { whoamiCommand } from '../src/commands/whoami.js';
7
+ import { appsCommand, useCommand } from '../src/commands/apps.js';
8
+ import { initCommand } from '../src/commands/init.js';
9
+ import { ingestCommand } from '../src/commands/ingest.js';
10
+ import { queryCommand } from '../src/commands/query.js';
11
+ import { recallCommand } from '../src/commands/recall.js';
12
+ import { contextsListCommand, contextsCreateCommand, contextsDeleteCommand } from '../src/commands/contexts.js';
13
+ import { schemaShowCommand, schemaGenerateCommand } from '../src/commands/schema.js';
14
+ import { entitiesListCommand, entitiesGetCommand, entitiesCreateCommand, entitiesUpdateCommand, entitiesDeleteCommand } from '../src/commands/entities.js';
15
+ import { recipesListCommand, recipesGetCommand, recipesCreateCommand, recipesDeleteCommand } from '../src/commands/recipes.js';
16
+ import { relationshipTypesListCommand } from '../src/commands/relationship-types.js';
17
+
18
+ program
19
+ .name('trucontext')
20
+ .description('TruContext CLI — contextual memory for AI applications')
21
+ .version('0.1.0');
22
+
23
+ // Auth
24
+ program.command('login')
25
+ .description('Sign in via browser')
26
+ .option('-g, --google', 'Sign in with Google (skip hosted UI)')
27
+ .action(loginCommand);
28
+
29
+ program.command('logout')
30
+ .description('Clear stored credentials')
31
+ .action(logoutCommand);
32
+
33
+ program.command('whoami')
34
+ .description('Show current user and active app')
35
+ .action(whoamiCommand);
36
+
37
+ // Init
38
+ program.command('init [name]')
39
+ .description('Create a new app and set it as active')
40
+ .option('-d, --description <text>', 'App description')
41
+ .action(initCommand);
42
+
43
+ // Apps
44
+ program.command('apps')
45
+ .description('List your apps')
46
+ .action(appsCommand);
47
+
48
+ program.command('use <app>')
49
+ .description('Set active app (by ID or name)')
50
+ .action(useCommand);
51
+
52
+ // Ingest
53
+ program.command('ingest <source>')
54
+ .description('Ingest a file or text string')
55
+ .option('-c, --context <entry>', 'Link to context node (entity-id:RELATIONSHIP, repeatable)', (val, prev) => [...prev, val], [])
56
+ .option('--confidence <n>', 'Confidence level (0.0-1.0)')
57
+ .option('--temporal', 'Content can decay over time (default)')
58
+ .option('--no-temporal', 'Content is a permanent fact')
59
+ .action(ingestCommand);
60
+
61
+ // Query
62
+ program.command('query <question>')
63
+ .description('Query the knowledge graph')
64
+ .option('-c, --context <id>', 'Scope to a context')
65
+ .option('-m, --mode <mode>', 'Query mode: answer (default) or context', 'answer')
66
+ .option('-l, --limit <n>', 'Max results', '20')
67
+ .action(queryCommand);
68
+
69
+ // Recall
70
+ program.command('recall <query>')
71
+ .description('Semantic memory recall')
72
+ .option('-c, --context <id>', 'Scope to a context')
73
+ .option('-l, --limit <n>', 'Max seed results', '10')
74
+ .option('-d, --depth <n>', 'Graph expansion depth', '2')
75
+ .action(recallCommand);
76
+
77
+ // Contexts
78
+ const contexts = program.command('contexts').description('Manage contexts');
79
+ contexts.command('list').description('List contexts').action(contextsListCommand);
80
+ contexts.command('create <name>')
81
+ .description('Create a context')
82
+ .option('--metadata <json>', 'JSON metadata object')
83
+ .action(contextsCreateCommand);
84
+ contexts.command('delete <id>').description('Delete a context').action(contextsDeleteCommand);
85
+
86
+ // Entities
87
+ const entities = program.command('entities').description('Manage entities');
88
+ entities.command('list')
89
+ .description('List entities')
90
+ .option('--type <type>', 'Filter by entity type')
91
+ .option('-l, --limit <n>', 'Max results')
92
+ .action(entitiesListCommand);
93
+ entities.command('get <entityId>')
94
+ .description('Get an entity')
95
+ .action(entitiesGetCommand);
96
+ entities.command('create')
97
+ .description('Create an entity')
98
+ .requiredOption('--id <entityId>', 'Entity ID')
99
+ .requiredOption('--type <Type>', 'Entity type (PascalCase)')
100
+ .option('--properties <json>', 'JSON properties object')
101
+ .option('--recipe <recipeId>', 'Recipe ID')
102
+ .option('--no-heartbeat', 'Disable heartbeat')
103
+ .option('--confidence <n>', 'Confidence level (0.0-1.0)')
104
+ .option('--temporal', 'Content can decay over time (default)')
105
+ .option('--no-temporal', 'Content is a permanent fact')
106
+ .option('-c, --context <entry>', 'Link to context (entity-id:RELATIONSHIP, repeatable)', (val, prev) => [...prev, val], [])
107
+ .action(entitiesCreateCommand);
108
+ entities.command('update <entityId>')
109
+ .description('Update an entity')
110
+ .option('--properties <json>', 'JSON properties object')
111
+ .option('--recipe <recipeId>', 'Recipe ID')
112
+ .option('--heartbeat', 'Enable heartbeat')
113
+ .option('--no-heartbeat', 'Disable heartbeat')
114
+ .option('--confidence <n>', 'Confidence level (0.0-1.0)')
115
+ .option('--temporal', 'Content can decay over time')
116
+ .option('--no-temporal', 'Content is a permanent fact')
117
+ .action(entitiesUpdateCommand);
118
+ entities.command('delete <entityId>')
119
+ .description('Delete an entity')
120
+ .action(entitiesDeleteCommand);
121
+
122
+ // Recipes
123
+ const recipes = program.command('recipes').description('Manage recipes');
124
+ recipes.command('list')
125
+ .description('List recipes')
126
+ .action(recipesListCommand);
127
+ recipes.command('get <recipeId>')
128
+ .description('Get recipe details')
129
+ .action(recipesGetCommand);
130
+ recipes.command('create')
131
+ .description('Create a recipe')
132
+ .requiredOption('--id <recipeId>', 'Recipe ID')
133
+ .requiredOption('--name <name>', 'Recipe name')
134
+ .requiredOption('--purpose <text>', 'Recipe purpose')
135
+ .option('--decay-profile <text>', 'Decay profile description')
136
+ .option('--confidence-bias <text>', 'Confidence bias description')
137
+ .action(recipesCreateCommand);
138
+ recipes.command('delete <recipeId>')
139
+ .description('Delete a recipe')
140
+ .action(recipesDeleteCommand);
141
+
142
+ // Relationship Types
143
+ program.command('relationship-types')
144
+ .description('List relationship types')
145
+ .option('--category <cat>', 'Filter by category')
146
+ .action(relationshipTypesListCommand);
147
+
148
+ // Schema
149
+ const schema = program.command('schema').description('Manage app schema');
150
+ schema.command('show').description('Show current schema').action(schemaShowCommand);
151
+ schema.command('generate')
152
+ .description('AI-generate a schema')
153
+ .requiredOption('-d, --description <text>', 'App description for schema generation')
154
+ .option('-n, --name <name>', 'App name')
155
+ .action(schemaGenerateCommand);
156
+
157
+ program.parse();
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "trucontext",
3
+ "version": "0.1.0",
4
+ "description": "TruContext CLI — contextual memory for AI applications",
5
+ "type": "module",
6
+ "bin": {
7
+ "trucontext": "./bin/cli.js"
8
+ },
9
+ "files": [
10
+ "bin/",
11
+ "src/",
12
+ "README.md",
13
+ "LICENSE",
14
+ "TERMS.md",
15
+ "PRIVACY.md"
16
+ ],
17
+ "engines": {
18
+ "node": ">=18"
19
+ },
20
+ "dependencies": {
21
+ "@inquirer/checkbox": "^5.1.2",
22
+ "@inquirer/input": "^5.0.10",
23
+ "@inquirer/select": "^5.1.2",
24
+ "chalk": "^5.3.0",
25
+ "commander": "^12.0.0",
26
+ "open": "^10.0.0"
27
+ },
28
+ "publishConfig": {
29
+ "access": "public"
30
+ },
31
+ "license": "MIT",
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "https://github.com/AlphaCollectiveLLC/trucontext-cli"
35
+ },
36
+ "homepage": "https://trucontext.ai",
37
+ "bugs": {
38
+ "url": "https://github.com/AlphaCollectiveLLC/trucontext-cli/issues"
39
+ },
40
+ "keywords": [
41
+ "trucontext",
42
+ "memory",
43
+ "ai",
44
+ "graph",
45
+ "knowledge-graph",
46
+ "cli",
47
+ "context"
48
+ ]
49
+ }