Skip to content

feat(nubi): add kb and memory command groups for Knowledge Base and Cortex context - #116

Merged
blue4209211 merged 8 commits into
mainfrom
feat/nubi-kb-memory-extensions
Sep 7, 2026
Merged

feat(nubi): add kb and memory command groups for Knowledge Base and Cortex context#116
blue4209211 merged 8 commits into
mainfrom
feat/nubi-kb-memory-extensions

Conversation

@blue4209211

Copy link
Copy Markdown
Contributor

Description

Extends nbctl nubi with dedicated command groups for Knowledge Base vector management (nbctl nubi kb) and AI-learned operational memory / Cortex context (nbctl nubi memory):

New Commands

  1. nbctl nubi kb (Knowledge Base Management):

    • nbctl nubi kb list [account-id] (Query: ai_list_kb) — List Knowledge Base vector sources with status, document counts, and sync timestamps.
    • nbctl nubi kb get <kb-id> (Query: ai_get_kb) — Fetch detailed specs and metadata for a Knowledge Base source.
    • nbctl nubi kb sync <kb-id> (Mutation: ai_sync_kb) — Trigger manual re-indexing / vector embedding sync for a KB source.
    • nbctl nubi kb enable <kb-id> & nbctl nubi kb disable <kb-id> (Mutation: ai_update_kb_enabled) — Toggle active status for AI agent retrieval.
  2. nbctl nubi memory (Cortex & Operational Memory):

    • Aliases: bcortex, app-context.
    • nbctl nubi memory list [account-id] [--type <pattern|decision>] [--query <text>] (Query: ai_list_memory) — Query AI-learned infrastructure memory, architecture decisions, and operational preferences.

Testing & Verification

  • Ran make lint — 0 issues.
  • Ran go test ./... — 100% PASS.
  • Verified both commands against live dev environment (listing 33 Knowledge Base sources and operational memory entries).

@blue4209211

Copy link
Copy Markdown
Contributor Author

/gemini review

1 similar comment
@blue4209211

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces two new CLI command files, cmd/nubi_kb.go and cmd/nubi_memory.go, to manage Knowledge Base vector sources and AI-learned operational memory. The review feedback highlights opportunities to improve error handling by defensively checking GraphQL response structures, concatenating all backend errors instead of reporting only the first one, and preserving detailed error context from resolveAccountID. Additionally, it suggests reducing code duplication by defining the --account-id flag as a persistent flag on the parent command.

Comment thread cmd/nubi_kb.go Outdated
Comment thread cmd/nubi_kb.go
Comment thread cmd/nubi_kb.go Outdated
Comment thread cmd/nubi_kb.go
Comment thread cmd/nubi_kb.go Outdated
Comment thread cmd/nubi_kb.go
Comment thread cmd/nubi_kb.go Outdated
Comment thread cmd/nubi_kb.go Outdated
Comment thread cmd/nubi_memory.go Outdated
@blue4209211

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces two new CLI command files, cmd/nubi_kb.go and cmd/nubi_memory.go, to manage Knowledge Base vector sources and AI operational memory respectively. The review feedback highlights two main issues: first, the fallback logic for resolving the account-id incorrectly ignores the positional argument when a default profile exists, preventing overrides; second, several commands discard the original error context from resolveAccountID instead of wrapping it with %w to preserve troubleshooting details.

Comment thread cmd/nubi_kb.go Outdated
Comment thread cmd/nubi_memory.go Outdated
Comment thread cmd/nubi_kb.go
Comment thread cmd/nubi_kb.go
Comment thread cmd/nubi_kb.go
@blue4209211

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces new CLI commands under the nubi command group to manage Knowledge Base vector sources (kb) and AI-learned operational memory (memory), along with their corresponding unit tests. The review feedback highlights a bug in both cmd/nubi_kb.go and cmd/nubi_memory.go where an explicitly provided positional [account-id] argument is ignored if a profile-level account-id is already configured in viper. To resolve this, the resolution logic should be restructured to prioritize the command-line flag and positional argument over the profile configuration.

Comment thread cmd/nubi_kb.go Outdated
Comment thread cmd/nubi_memory.go Outdated
…nt ID precedence and join GraphQL backend errors
@blue4209211

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces new CLI commands under the nubi namespace to manage Knowledge Base vector sources (kb commands for listing, getting, syncing, enabling, and disabling) and AI-learned operational memory (memory commands for listing), along with their corresponding unit tests. The reviewer feedback suggests adopting a more defensive approach when parsing GraphQL responses by using pointer fields for the top-level query or mutation keys (such as ai_list_kb, ai_get_kb, ai_sync_kb, ai_update_kb_enabled, and ai_list_memory) to prevent potential nil pointer dereferences if these keys are missing or null in the response.

Comment thread cmd/nubi_kb.go Outdated
Comment thread cmd/nubi_kb.go
Comment thread cmd/nubi_kb.go
Comment thread cmd/nubi_kb.go
Comment thread cmd/nubi_memory.go
@blue4209211

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces new CLI commands for managing AI Knowledge Base vector sources (kb) and AI-learned operational memory (memory), along with their corresponding tests and helper functions. The review feedback focuses on improving code quality and error handling by reusing the existing client.GraphQLErrors type, defining named structs instead of inline anonymous structs or raw maps to ensure consistent output formatting, defensively validating GraphQL responses, and adding input validation for the limit flag.

Comment thread cmd/nubi_kb.go
Comment thread cmd/nubi_kb.go
Comment thread cmd/nubi_kb.go
Comment thread cmd/nubi_kb.go
Comment thread cmd/nubi_kb.go
Comment thread cmd/nubi_kb.go
Comment thread cmd/nubi_kb.go
Comment thread cmd/nubi_memory.go
Comment thread cmd/nubi_memory.go
Comment thread cmd/nubi_memory.go

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces commands to manage AI Knowledge Base vector sources (kb) and AI-learned operational memory (memory), along with their corresponding tests. It also adds a helper function to resolve account IDs with positional argument precedence. The review feedback suggests improving robustness by handling ignored errors when retrieving command-line flags in cmd/account_id.go and cmd/nubi_memory.go, and reducing code duplication by declaring the --account-id flag as a persistent flag on the parent kb command.

Comment thread cmd/account_id.go
Comment thread cmd/nubi_kb.go Outdated
Comment thread cmd/nubi_memory.go

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces new CLI commands to manage AI Knowledge Base vector sources (kb) and AI-learned operational memory (memory), along with their corresponding unit tests. It also adds a helper function to resolve account IDs with positional argument support. The feedback highlights opportunities to improve code robustness and maintainability by handling ignored errors when reading CLI flags in cmd/account_id.go and cmd/nubi_memory.go, and by refactoring duplicated request-handling logic across the kb subcommands in cmd/nubi_kb.go.

Comment thread cmd/account_id.go Outdated
Comment thread cmd/nubi_kb.go
Comment thread cmd/nubi_memory.go
@blue4209211

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces new CLI commands to manage Knowledge Base vector sources (kb) and AI-learned operational memory (memory) under the nubi command group. It also adds helper logic to resolve account IDs with positional argument precedence, along with comprehensive unit tests for the new commands. Feedback is provided to validate the limit flag in the memory list command to ensure it is a positive integer.

Comment thread cmd/nubi_memory.go
@blue4209211

Copy link
Copy Markdown
Contributor Author

/gemini review

@blue4209211

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces new CLI commands under the nubi namespace to manage Knowledge Base vector sources (kb) and AI-learned operational memory (memory), along with their corresponding unit tests. It also adds a helper function resolveAccountIDWithPositional to handle account ID resolution with positional argument precedence. Feedback suggests defining the account-id flag as a persistent flag on the parent nubiKbCmd to reduce code repetition across its subcommands.

I am having trouble creating individual review comments. Click here to see my feedback.

cmd/nubi_kb.go (360-364)

medium

To reduce code repetition and improve maintainability, you can define the account-id flag once as a persistent flag on the parent nubiKbCmd. This will make the flag available to all of its subcommands (list, get, sync, etc.) without needing to declare it for each one individually.

	nubiKbCmd.PersistentFlags().String("account-id", "", "Account ID (overrides profile)")

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces new CLI commands under nubi kb and nubi memory to manage Knowledge Base vector sources and AI-learned operational memory, respectively, along with their corresponding unit tests. It also updates account ID resolution logic to support positional arguments. Feedback suggests trimming whitespace from resolved account IDs to prevent validation issues and refactoring shared GraphQL error types and helpers into a common file to improve maintainability.

Comment thread cmd/account_id.go
Comment thread cmd/nubi_memory.go
@blue4209211
blue4209211 merged commit 505a1be into main Sep 7, 2026
2 checks passed
@blue4209211
blue4209211 deleted the feat/nubi-kb-memory-extensions branch September 7, 2026 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants