* feat: independent versioning for integrations
- Add per-integration changelog pages at /changelog/integrations/<name>
- Move main changelog to changelog/index.md (URL unchanged)
- Add --integration flag to generate-changelog for LLM-based per-integration changelog generation
- Add scripts/release-integration.sh <name> <version> for cutting integration releases
- Add .github/workflows/release-integration.yml to publish on integrations/** tags
- Remove integrations from main release.sh and release.yml cycle
* fix: add agno and hermes integration docs to version-0.4 for production build
* chore: apply ruff formatting to generate_changelog.py
* feat: add 4-tab code parity across all documentation examples
Every code snippet Tabs block now has Python, Node.js, CLI, and Go variants.
Raw HTTP/curl tabs replaced with proper SDK calls.
New example files:
- Go: retain.go, recall.go, reflect.go, memory-banks.go, directives.go,
mental-models.go, documents.go, main-methods.go
- Shell: memory-banks.sh, directives.sh, mental-models.sh
- Node.js: mental-models.mjs
Extended example files with missing sections:
- recall.mjs/sh: world/experience/observation types, token-budget, all tag modes
- reflect.sh: reflect-with-params, reflect-disposition, reflect-sources, reflect-with-tags
- reflect.mjs: reflect-with-tags, fixed reflect-sources API usage
- retain.mjs/sh: retain-conversation, retain-batch, retain-files-batch
SDK/CLI additions:
- TypeScript: getMentalModelHistory method
- CLI recall: --tags, --tags-match flags
- CLI reflect: --tags, --tags-match, --include-facts flags
- CLI directive update: --is-active flag
- CLI bank set-config: --retain-mission, --retain-extraction-mode,
--observations-mission, --reflect-mission, --disposition-* flags
Build validation:
- scripts/check-code-parity.mjs validates 4-tab parity across all MDX files
- Integrated into npm run build — fails if any Tabs block is missing a variant
* fix: fix doc examples for Go, Node.js, CLI + add mental model with-id examples
- Fix Go Budget constants: BUDGET_HIGH/LOW/MID → HIGH/LOW/MID
- Fix Go documents.go: ListDocuments returns []map[string]interface{}, use map access
- Fix Go retain.go: use correct relative path for sample.pdf
- Fix Node.js createMentalModel: use positional args (name, sourceQuery) not object
- Add CLI 'history' subcommand for mental models (api.rs, main.rs, mental_model.rs)
- Rebuild TypeScript/Python clients to support id param in createMentalModel
- Add create-mental-model-with-id examples across all 4 languages and docs
* fix: move id param to end of create_mental_model signature for backwards compat
114 lines
4.3 KiB
Go
114 lines
4.3 KiB
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"net/http"
|
|
"os"
|
|
|
|
hindsight "github.com/vectorize-io/hindsight/hindsight-clients/go"
|
|
)
|
|
|
|
func main() {
|
|
apiURL := os.Getenv("HINDSIGHT_API_URL")
|
|
if apiURL == "" {
|
|
apiURL = "http://localhost:8888"
|
|
}
|
|
|
|
cfg := hindsight.NewConfiguration()
|
|
cfg.Servers = hindsight.ServerConfigurations{{URL: apiURL}}
|
|
client := hindsight.NewAPIClient(cfg)
|
|
ctx := context.Background()
|
|
|
|
// =============================================================================
|
|
// Doc Examples
|
|
// =============================================================================
|
|
|
|
// [docs:create-bank]
|
|
client.BanksAPI.CreateOrUpdateBank(ctx, "my-bank").
|
|
CreateBankRequest(hindsight.CreateBankRequest{}).Execute()
|
|
// [/docs:create-bank]
|
|
|
|
// [docs:bank-with-disposition]
|
|
client.BanksAPI.CreateOrUpdateBank(ctx, "architect-bank").
|
|
CreateBankRequest(hindsight.CreateBankRequest{
|
|
ReflectMission: *hindsight.NewNullableString(hindsight.PtrString(
|
|
"You're a senior software architect - keep track of system designs, " +
|
|
"technology decisions, and architectural patterns. Prefer simplicity over cutting-edge.",
|
|
)),
|
|
DispositionSkepticism: *hindsight.NewNullableInt32(hindsight.PtrInt32(4)),
|
|
DispositionLiteralism: *hindsight.NewNullableInt32(hindsight.PtrInt32(4)),
|
|
DispositionEmpathy: *hindsight.NewNullableInt32(hindsight.PtrInt32(2)),
|
|
}).Execute()
|
|
// [/docs:bank-with-disposition]
|
|
|
|
// [docs:bank-background]
|
|
client.BanksAPI.CreateOrUpdateBank(ctx, "my-bank").
|
|
CreateBankRequest(hindsight.CreateBankRequest{
|
|
ReflectMission: *hindsight.NewNullableString(hindsight.PtrString(
|
|
"I am a research assistant specializing in machine learning.",
|
|
)),
|
|
}).Execute()
|
|
// [/docs:bank-background]
|
|
|
|
// [docs:bank-mission]
|
|
client.BanksAPI.CreateOrUpdateBank(ctx, "my-bank").
|
|
CreateBankRequest(hindsight.CreateBankRequest{
|
|
ReflectMission: *hindsight.NewNullableString(hindsight.PtrString(
|
|
"You're a senior software architect - keep track of system designs, " +
|
|
"technology decisions, and architectural patterns.",
|
|
)),
|
|
}).Execute()
|
|
// [/docs:bank-mission]
|
|
|
|
// [docs:bank-support-agent]
|
|
client.BanksAPI.CreateOrUpdateBank(ctx, "support-bank").
|
|
CreateBankRequest(hindsight.CreateBankRequest{}).Execute()
|
|
client.BanksAPI.UpdateBankConfig(ctx, "support-bank").
|
|
BankConfigUpdate(hindsight.BankConfigUpdate{
|
|
Updates: map[string]interface{}{
|
|
"observations_mission": "I am a customer support agent. Track customer preferences, " +
|
|
"recurring issues, and resolution history to provide consistent, personalized support.",
|
|
},
|
|
}).Execute()
|
|
// [/docs:bank-support-agent]
|
|
|
|
// [docs:update-bank-config]
|
|
client.BanksAPI.UpdateBankConfig(ctx, "my-bank").
|
|
BankConfigUpdate(hindsight.BankConfigUpdate{
|
|
Updates: map[string]interface{}{
|
|
"retain_mission": "Always include technical decisions, API design choices, and architectural trade-offs. " +
|
|
"Ignore meeting logistics and social exchanges.",
|
|
"retain_extraction_mode": "verbose",
|
|
"observations_mission": "Observations are stable facts about people and projects. " +
|
|
"Always include preferences, skills, and recurring patterns. Ignore one-off events.",
|
|
"disposition_skepticism": 4,
|
|
"disposition_literalism": 4,
|
|
"disposition_empathy": 2,
|
|
},
|
|
}).Execute()
|
|
// [/docs:update-bank-config]
|
|
|
|
// [docs:get-bank-config]
|
|
// Returns resolved config (server defaults merged with bank overrides) and the raw overrides
|
|
result, _, _ := client.BanksAPI.GetBankConfig(ctx, "my-bank").Execute()
|
|
// result.Config — full resolved configuration
|
|
// result.Overrides — only fields overridden at the bank level
|
|
fmt.Println("Config keys:", len(result.GetConfig()))
|
|
// [/docs:get-bank-config]
|
|
|
|
// [docs:reset-bank-config]
|
|
// Remove all bank-level overrides, reverting to server defaults
|
|
client.BanksAPI.ResetBankConfig(ctx, "my-bank").Execute()
|
|
// [/docs:reset-bank-config]
|
|
|
|
// =============================================================================
|
|
// Cleanup (not shown in docs)
|
|
// =============================================================================
|
|
for _, bankID := range []string{"my-bank", "architect-bank", "support-bank"} {
|
|
req, _ := http.NewRequest("DELETE", fmt.Sprintf("%s/v1/default/banks/%s", apiURL, bankID), nil)
|
|
http.DefaultClient.Do(req)
|
|
}
|
|
|
|
fmt.Println("memory-banks.go: All examples passed")
|
|
}
|