開発者向けクイックスタート
1つのキーでファクトを1件記録し、検索します。次にエージェントを起動したときも、同じメモリを利用できます。
ChatGPT、Claude、Grokと接続したい場合は、コード不要の接続ガイドをご覧ください。
始める前に
GoMindのダッシュボードで組織とAPIキーを作成し、サーバーの環境変数
GOMIND_API_KEYに設定します。APIキーをブラウザーのコードに置かないでください。
記録して、検索する
開発者向けコード例
SDK / API
$
npm install @gomind/sdkmemory.ts
import { GomindClient } from '@gomind/sdk';
const memory = new GomindClient(
'https://api.gominddb.com',
process.env.GOMIND_API_KEY!
);
await memory.remember(
'project:exports', 'processing_mode', 'background'
);
const { facts } = await memory.recall('project:exports');
console.log(facts);
セッションが終わっても、メモリは残ります。
$
go get github.com/ingate/[email protected]main.go
package main
import (
"context"
"fmt"
"log"
"os"
gomind "github.com/ingate/gomind-go-sdk"
)
func main() {
memory, err := gomind.NewClient(os.Getenv("GOMIND_API_KEY"))
if err != nil { log.Fatal(err) }
ctx := context.Background()
_, err = memory.Remember(ctx, "project:exports", "processing_mode", "background", "")
if err != nil { log.Fatal(err) }
result, err := memory.Recall(ctx, "project:exports", 20)
if err != nil { log.Fatal(err) }
fmt.Println(result.Facts)
}
セッションが終わっても、メモリは残ります。
$
composer require ingate/gomind-php-sdkmemory.php
<?php
require 'vendor/autoload.php';
use Ingate\Gomind\Client;
$memory = new Client(getenv('GOMIND_API_KEY'));
$memory->remember(
'project:exports', 'processing_mode', 'background'
);
$result = $memory->recall('project:exports', 20);
foreach ($result->getFacts() as $fact) {
echo $fact->getObjectOrValue();
}
セッションが終わっても、メモリは残ります。
$
export GOMIND_API_KEY="your-api-key"terminal
# Store a fact
curl https://api.gominddb.com/v1/remember \
-H "Authorization: Bearer $GOMIND_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"subject": "project:exports",
"predicate": "processing_mode",
"object": "background"
}'
# Recall it in another session
curl https://api.gominddb.com/v1/recall \
-H "Authorization: Bearer $GOMIND_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query": "project:exports", "limit": 20}'
セッションが終わっても、メモリは残ります。
RESTでも同じ操作ができます。
curl https://api.gominddb.com/v1/remember \
-H "Authorization: Bearer $GOMIND_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"subject": "user:maya",
"predicate": "has_skill",
"object": "TypeScript"
}'
curl https://api.gominddb.com/v1/recall \
-H "Authorization: Bearer $GOMIND_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query": "user:maya", "limit": 20}'
次はファクトの形式またはエージェントのMCP接続をご覧ください。