@groundtrack/hooks 0.1.15 → 0.1.17
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.
|
@@ -178,6 +178,7 @@ export function discoverSessions(options) {
|
|
|
178
178
|
return null;
|
|
179
179
|
return identity.remotes.values().next().value ?? null;
|
|
180
180
|
};
|
|
181
|
+
const targetRemote = soleRemote(options.repository);
|
|
181
182
|
for (const candidate of discovered.included) {
|
|
182
183
|
const { path, metadata } = candidate;
|
|
183
184
|
const modifiedAtMs = candidate.modifiedAt?.getTime() ??
|
|
@@ -202,11 +203,16 @@ export function discoverSessions(options) {
|
|
|
202
203
|
const normalizedRemote = metadata.repositoryUrl
|
|
203
204
|
? normalizeRepositoryUrl(metadata.repositoryUrl)
|
|
204
205
|
: null;
|
|
205
|
-
const
|
|
206
|
-
const currentRepositoryRemote = cwdMatchesCurrentRepository
|
|
207
|
-
? soleRemote(options.repository)
|
|
208
|
-
: null;
|
|
206
|
+
const pathMatchesCurrentRepository = Boolean(options.repository && metadata.cwd && isInside(metadata.cwd, options.repository.root));
|
|
209
207
|
const remoteMatchesCurrentRepository = Boolean(options.repository && normalizedRemote && options.repository.remotes.has(normalizedRemote));
|
|
208
|
+
// A session may retain an old remote after an owner rename. Its recorded checkout
|
|
209
|
+
// can still identify the target repository even when importing from another worktree.
|
|
210
|
+
const checkoutMatchesCurrentRepository = Boolean(targetRemote &&
|
|
211
|
+
!pathMatchesCurrentRepository &&
|
|
212
|
+
!remoteMatchesCurrentRepository &&
|
|
213
|
+
soleRemote(repositoryIdentityForCwd(metadata.cwd)) === targetRemote);
|
|
214
|
+
const cwdMatchesCurrentRepository = pathMatchesCurrentRepository || checkoutMatchesCurrentRepository;
|
|
215
|
+
const currentRepositoryRemote = cwdMatchesCurrentRepository ? targetRemote : null;
|
|
210
216
|
const matchesCurrentRepository = options.repository
|
|
211
217
|
? remoteMatchesCurrentRepository ||
|
|
212
218
|
(!normalizedRemote && cwdMatchesCurrentRepository) ||
|
package/package.json
CHANGED
package/templates/AGENTS.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!-- groundtrack:start version=
|
|
1
|
+
<!-- groundtrack:start version=5 -->
|
|
2
2
|
|
|
3
3
|
## Groundtrack
|
|
4
4
|
|
|
@@ -8,7 +8,7 @@ Use Groundtrack as the shared engineering memory for this repository.
|
|
|
8
8
|
- Before non-trivial investigation or implementation where prior decisions, failures, or constraints could matter, call `search_experiences`. Start with a focused description of the work, then inspect the results and search one or two materially different adjacent concepts when related components, constraints, failure modes, or prior decisions could change the approach. Do not stop merely because the first search has no exact match; try a meaningfully broader or neighboring query. Keep this expansion bounded, and also search before repeating an approach that may already have been tried.
|
|
9
9
|
- When a relevant experience needs more context or verification, call `get_experience_events` with its id to inspect the underlying raw evidence and provenance.
|
|
10
10
|
- Apply relevant current experiences and heed any caveats that an experience was contradicted, superseded, or expired.
|
|
11
|
-
-
|
|
11
|
+
- Only call `report_experience_use` if `search_experiences` returned experiences; skip it for empty results, even with a retrieval id. For non-empty results, report when one changed the approach or avoided a failure, and report `not_helpful` after review when none applied.
|
|
12
12
|
- After a task reaches a concrete result, call `record_outcome` with a short title, a concise summary, and the retrieval ids for searches that contributed. Include measurements only for sourced, quantified impact on time, cost, reliability, quality, performance, or throughput; tests, typechecks, lint, and builds are validation rather than impact. Include avoided work only when it was explicitly estimated, and never infer unknown values.
|
|
13
13
|
- After a non-obvious discovery, decision, workaround, correction, or failed approach that would help a future agent, call `store_event` promptly with a concise title and an explanation of what happened and why it matters.
|
|
14
14
|
- Do not store routine implementation details, obvious facts, unrestricted transcripts, or secrets.
|