Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/lib/application/handlers/PromptSubmitHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,7 @@ export class PromptSubmitHandler implements IRequestHandler<PromptSubmitRequest,
if (this.recursion && request.permissionMode === 'plan') {
if (this.recursion.shouldRun(request.content, request.permissionMode)) {
try {
recursionResult = await this.recursion.run(
request.content,
this.context.hierarchicalGroupIds
);
recursionResult = await this.recursion.run(request.content);
if (recursionResult.hasContext) {
planModeRecursion = true;
additionalContext = recursionResult.summary;
Expand All @@ -93,7 +90,6 @@ export class PromptSubmitHandler implements IRequestHandler<PromptSubmitRequest,
// Add to memory with ephemeral lifecycle (fire-and-forget style)
try {
await this.memory.addFactWithLifecycle(
this.context.groupId,
`User prompt at ${request.timestamp}: ${truncatedContent}`,
{ lifecycle: 'ephemeral', tags: ['type:prompt'] }
);
Expand Down
7 changes: 1 addition & 6 deletions src/lib/application/handlers/SessionStartHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
* Handle a session start request.
*/
async handle(request: SessionStartRequest): Promise<ISessionStartResult> {
const { hierarchicalGroupIds, projectAliases, branch, projectName, userName, folderType, projectRoot } = this.context;

Check warning on line 87 in src/lib/application/handlers/SessionStartHandler.ts

View workflow job for this annotation

GitHub Actions / test

'projectAliases' is assigned a value but never used. Allowed unused vars must match /^_/u

// Sync GitHub issues on startup (non-blocking, fire-and-forget for speed)
await this.syncGitHubOnStartup(request.trigger, hierarchicalGroupIds, projectName);
Expand All @@ -94,12 +94,7 @@

// Load memory and run git triage in parallel
const [memories, gitTriage] = await Promise.all([
this.memoryLoader.loadMemory(
hierarchicalGroupIds,
projectAliases,
branch,
dateOptions,
),
this.memoryLoader.loadMemory(dateOptions),
this.runGitTriage(dateOptions.since, projectRoot),
]);

Expand Down
5 changes: 2 additions & 3 deletions src/lib/application/handlers/SessionStopHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export class SessionStopHandler implements IRequestHandler<SessionStopRequest, I

// Save captured facts to memory with session lifecycle and quality tags
for (const fact of captured.facts) {
await this.memory.addFactWithLifecycle(this.context.groupId, fact, {
await this.memory.addFactWithLifecycle(fact, {
lifecycle: 'session',
tags,
});
Expand All @@ -113,7 +113,6 @@ export class SessionStopHandler implements IRequestHandler<SessionStopRequest, I
await this.events.emit({
type: 'memory:save',
facts: captured.facts,
groupId: this.context.groupId,
timestamp: toISOTimestamp(),
});

Expand All @@ -138,7 +137,7 @@ export class SessionStopHandler implements IRequestHandler<SessionStopRequest, I

try {
// Get current tasks
const tasks = await this.tasks.getTasksSimple([this.context.groupId]);
const tasks = await this.tasks.getTasksSimple();

// Count incomplete tasks without external links
const unlinkedIncompleteTasks = tasks.filter(
Expand Down
7 changes: 3 additions & 4 deletions src/lib/application/handlers/pr/PrPollHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,7 @@ export class PrPollHandler {
private readonly githubClient: IGithubClient,
private readonly prRepository: IPullRequestRepository,
private readonly notificationService?: INotificationService,
private readonly memoryService?: IMemoryWriter,
private readonly groupId?: string
private readonly memoryService?: IMemoryWriter
) {
this.logPath = path.join(os.homedir(), '.lisa', 'pr-poll.log');
this.cachePath = path.join(os.homedir(), '.lisa', 'pr-poll-cache.json');
Expand Down Expand Up @@ -420,11 +419,11 @@ export class PrPollHandler {
log(`${pr.repo}#${pr.number}: PR merged`);

// Auto-capture merged PR to memory
if (this.memoryService && this.groupId) {
if (this.memoryService) {
try {
const fact = `PR MERGED: #${pr.number} ${ghPr.title}`;
const tags = ['github:pr', 'github:pr-merged', `github:pr:${pr.number}`];
await this.memoryService.addFact(this.groupId, fact, tags);
await this.memoryService.addFact(fact, tags);
log(`${pr.repo}#${pr.number}: saved to memory`);
} catch (memError) {
// Don't fail the poll if memory save fails
Expand Down
5 changes: 2 additions & 3 deletions src/lib/application/handlers/pr/PrRememberHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ export interface IPrRememberResult {
export class PrRememberHandler {
constructor(
private readonly githubClient: IGithubClient,
private readonly memoryService: IMemoryWriter,
private readonly groupId: string
private readonly memoryService: IMemoryWriter
) {}

/**
Expand Down Expand Up @@ -85,7 +84,7 @@ export class PrRememberHandler {
const tags = ['github:pr', `github:pr:${prNumber}`];

// 5. Save to memory
await this.memoryService.addFact(this.groupId, fact, tags);
await this.memoryService.addFact(fact, tags);

// 6. Return success
return {
Expand Down
4 changes: 1 addition & 3 deletions src/lib/application/services/GitIndexingService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ export function createGitIndexingService(
return {
async indexFacts(
facts: readonly IHeuristicFact[],
groupId: string,
options: IGitIndexingOptions = {}
): Promise<IGitIndexingResult> {
const {
Expand Down Expand Up @@ -145,7 +144,6 @@ export function createGitIndexingService(
try {
// Search for existing facts with similar metadata
existingFacts = await memory.searchFacts(
[groupId],
'source:code-analysis extractionMethod:heuristic',
100
);
Expand Down Expand Up @@ -183,7 +181,7 @@ export function createGitIndexingService(

// Save to memory with lifecycle metadata
try {
await memory.addFactWithLifecycle(groupId, fact.text, {
await memory.addFactWithLifecycle(fact.text, {
lifecycle: 'project',
tags,
});
Expand Down
14 changes: 4 additions & 10 deletions src/lib/application/services/MemoryContextLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,7 @@ export class MemoryContextLoader {
/**
* Load memory context from git-mem.
*/
async loadMemory(
hierarchicalGroupIds: readonly string[],
projectAliases: readonly string[],
_branch: string | null,
dateOptions?: IMemoryDateOptions,
): Promise<IMemoryLoadResult> {
async loadMemory(dateOptions?: IMemoryDateOptions): Promise<IMemoryLoadResult> {
const result: IMemoryLoadResult = {
facts: [],
nodes: [],
Expand All @@ -53,15 +48,14 @@ export class MemoryContextLoader {
};

const TIMEOUT_MS = 5000;
const allGroupIds = [...new Set([...hierarchicalGroupIds, ...projectAliases])];

const cancellableResult = await withCancellation(
async (abortSignal) => {
// Load init-review
try {
checkCancellation(abortSignal, 'Memory load cancelled before init-review');

const initFacts = await this.memory.searchFacts(allGroupIds, 'init-review', 1);
const initFacts = await this.memory.searchFacts('init-review', 1);

checkCancellation(abortSignal, 'Memory load cancelled after init-review fetch');

Expand All @@ -77,7 +71,7 @@ export class MemoryContextLoader {
try {
checkCancellation(abortSignal, 'Memory load cancelled before facts');

const facts = await this.memory.loadFactsDateOrdered(allGroupIds, 100, dateOptions);
const facts = await this.memory.loadFactsDateOrdered(100, dateOptions);

checkCancellation(abortSignal, 'Memory load cancelled after facts fetch');

Expand All @@ -90,7 +84,7 @@ export class MemoryContextLoader {
try {
checkCancellation(abortSignal, 'Memory load cancelled before tasks');

const loadedTasks = await this.tasks.getTasksSimple(allGroupIds);
const loadedTasks = await this.tasks.getTasksSimple();

checkCancellation(abortSignal, 'Memory load cancelled after tasks fetch');

Expand Down
7 changes: 5 additions & 2 deletions src/lib/commands/doctor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
*
* Comprehensive diagnostic tool for Lisa configuration and connectivity.
* Supports basic, verbose, and JSON output modes.
*
* Note: Group IDs are no longer used - the git repo itself provides scoping
* via git-mem (git notes in refs/notes/mem).
*/

import fs from 'fs-extra';
import path from 'path';
import chalk from 'chalk';
import type { ICliServices } from './cli-services';
import { getCurrentGroupId } from '../skills/shared/utils/group-id';

// ============================================================================
// Types
Expand Down Expand Up @@ -552,7 +554,8 @@ export async function runDoctor(
opts.endpoint ||
config?.endpoint ||
(mode === 'zep-cloud' ? ZEP_CLOUD_ENDPOINT : DEFAULT_ENDPOINT);
const group = getCurrentGroupId(cwd);
// Group ID is derived from folder name for backwards compatibility
const group = getProjectName(cwd);
const zepApiKey = config?.zepApiKey || process.env.ZEP_API_KEY;

// Build config info
Expand Down
3 changes: 1 addition & 2 deletions src/lib/commands/knowledge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -484,14 +484,13 @@ export function registerKnowledgeCommands(program: Command): void {

const summarizer = createSummarizationService(memory, guard);

const groupId = opts.group || 'default';
const since = opts.since ? new Date(opts.since) : undefined;
if (since !== undefined && isNaN(since.getTime())) {
console.log(JSON.stringify({ status: 'error', action: 'summarize', error: `Invalid date: ${opts.since}` }, null, 2));
process.exitCode = 1;
return;
}
const result = await summarizer.summarize(groupId, {
const result = await summarizer.summarize({
since,
topic: opts.topic,
style: opts.style === 'detailed' ? 'detailed' : 'concise',
Expand Down
12 changes: 3 additions & 9 deletions src/lib/commands/pr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,8 @@ export function registerPrCommands(prCmd: Command, cliLogger: ILogger): void {
&& opts.watch !== false;

if (shouldPoll && result.pr) {
const { getCurrentGroupId } = await import('../skills/common/group-id');
const memoryService = await createPrMemoryService();
const groupId = getCurrentGroupId();
const pollHandler = new PrPollHandler(githubClient, prRepository, undefined, memoryService, groupId);
const pollHandler = new PrPollHandler(githubClient, prRepository, undefined, memoryService);
const pollOptions: IPrPollOptions = {
autoUnwatch: true,
logToFile: true,
Expand Down Expand Up @@ -610,13 +608,11 @@ export function registerPrCommands(prCmd: Command, cliLogger: ILogger): void {
try {
const { GithubClient } = await import('../infrastructure');
const { PrRememberHandler } = await import('../application/handlers');
const { getCurrentGroupId } = await import('../skills/common/group-id');

const githubClient = new GithubClient();
const memoryService = await createPrMemoryService();
const groupId = getCurrentGroupId();

const handler = new PrRememberHandler(githubClient, memoryService, groupId);
const handler = new PrRememberHandler(githubClient, memoryService);
const result = await handler.execute({
prNumber: parsedPrNumber,
repo: opts.repo,
Expand Down Expand Up @@ -779,7 +775,6 @@ export function registerPrCommands(prCmd: Command, cliLogger: ILogger): void {
const { GithubClient, Neo4jPullRequestRepository, createNeo4jConnectionManager } = await import('../infrastructure');
const { PrPollHandler } = await import('../application/handlers');
const { NotificationService } = await import('../infrastructure/notifications');
const { getCurrentGroupId } = await import('../skills/common/group-id');

const githubClient = new GithubClient();
neo4jConnection = createNeo4jConnectionManager();
Expand Down Expand Up @@ -814,9 +809,8 @@ export function registerPrCommands(prCmd: Command, cliLogger: ILogger): void {

// Create memory service for auto-capture of merged PRs
const memoryService = await createPrMemoryService();
const groupId = getCurrentGroupId();

const handler = new PrPollHandler(githubClient, prRepository, notificationService, memoryService, groupId);
const handler = new PrPollHandler(githubClient, prRepository, notificationService, memoryService);
const pollOptions = {
autoUnwatch: opts.autoUnwatch,
logToFile: opts.log,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/domain/interfaces/IConsolidationService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ export interface IConsolidationOptions {
* Consolidation service interface.
*
* Provides operations for consolidating duplicate or related facts.
*
* Note: Group IDs are no longer used - the git repo provides scoping via git-mem.
*/
export interface IConsolidationService {
/**
Expand All @@ -62,15 +64,13 @@ export interface IConsolidationService {
* expire the rest, create supersedes relationships
* - `keep-all`: No-op, return empty result
*
* @param groupId - Group ID the facts belong to
* @param factUuids - UUIDs of facts to consolidate (minimum 2)
* @param action - Consolidation action to perform
* @param options - Additional options (retainUuid, mergedText)
* @throws Error if fewer than 2 UUIDs provided
* @throws Error if retainUuid is not in the provided UUIDs
*/
consolidate(
groupId: string,
factUuids: readonly string[],
action: ConsolidationAction,
options?: IConsolidationOptions
Expand Down
4 changes: 2 additions & 2 deletions src/lib/domain/interfaces/ICurationService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ export function parseCurationTag(tags: readonly string[]): CurationMark | null {
*
* Provides operations for curating facts (marking quality)
* and computing quality scores for ranking.
*
* Note: Group IDs are no longer used - the git repo provides scoping via git-mem.
*/
export interface ICurationService {
/**
Expand All @@ -83,12 +85,10 @@ export interface ICurationService {
* - `deprecated`: Also expires the fact
* - `authoritative`: Promotes confidence to `verified`
*
* @param groupId - Group ID the fact belongs to
* @param uuid - UUID of the fact to mark
* @param mark - The curation mark to apply
*/
markFact(
groupId: string,
uuid: string,
mark: CurationMark
): Promise<void>;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/domain/interfaces/IGitIndexingService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ export interface IGitIndexingResult {

/**
* Service for indexing extracted git facts to memory.
*
* Note: Group IDs are no longer used - the git repo provides scoping via git-mem.
*/
export interface IGitIndexingService {
/**
Expand All @@ -99,13 +101,11 @@ export interface IGitIndexingService {
* - Deduplication against existing memories
*
* @param facts - Facts extracted from git history
* @param groupId - Memory group ID to save to
* @param options - Indexing options
* @returns Indexing result with counts
*/
indexFacts(
facts: readonly IHeuristicFact[],
groupId: string,
options?: IGitIndexingOptions
): Promise<IGitIndexingResult>;
}
Loading
Loading