跳到正文
Skillpedia
分析与电子表格14k · #11156

temporal

它能做什么

这项技能对 Semantica 知识图谱运行基于时间的查询,例如某个日期成立的事实。适合需要把结果限定在某个时间点的人。

适用场景

  • ✓当你只想查看在某个特定日期处于活跃状态的条目的结果的时候。
  • ✓当你想查看整个图谱在更早时间时的样子的时候。
  • ✓当你想知道某个过去时刻适用哪些先例或原因的时候。

技能链接

https://github.com/semantica-agi/semantica/blob/main/plugins/skills/temporal/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/semantica-agi/semantica/blob/main/plugins/skills/temporal/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“截至 3 月 15 日,图谱显示了我们哪些供应商批准的情况?哪些条目当时还不存在?”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会读取“上个月”或“2024 年第三季度”等日期表达,将其转换为标准日期,然后在问题中加入该时间限制。它会返回按排名排列的结果,并标注有效日期,以及每个条目在目标时间是否已存在。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

/semantica:temporal

Temporal graph operations. Usage: /semantica:temporal <sub-command> [args]

$ARGUMENTS = sub-command + query/node + date expression.


query "<question>" [at|before|after <date>]

Temporally-scoped natural-language graph query.

from semantica.kg.temporal_query_rewriter import TemporalQueryRewriter
from semantica.kg.temporal_normalizer import TemporalNormalizer

normalizer = TemporalNormalizer()
# Normalize natural date expressions: "last month", "Q3 2024", "2025-01-15"
date = normalizer.normalize(date_expr)

rewriter = TemporalQueryRewriter()
# Rewrite query with temporal constraint
rewritten = rewriter.rewrite(
    query=question,
    temporal_constraint={"op": direction, "value": date},  # op: "at"|"before"|"after"
)

Then run the rewritten query through AgentContext.retrieve() or ContextGraph.query().

Return ranked results with Valid From, Valid Until, Active At <date> columns. Mark nodes that were not yet created at the target time as [not yet created].


snapshot <date>

Reconstruct the full graph state as it existed at a specific point in time.

from semantica.context import ContextGraph

graph = ContextGraph(advanced_analytics=True)

# state_at returns a dict snapshot of the graph at that timestamp
snapshot = graph.state_at(timestamp=date)  # ISO string or datetime

Output:

Graph snapshot at <date>:
  Nodes:       N  (M added since prev snapshot, K removed)
  Edges:       P
  Density:     0.21
  Communities: Q

Active decision categories at <date>:
  | Category | Count | Avg Confidence |

Top 10 nodes (by degree at <date>):
  | Node | Type | Degree |

[Compact Mermaid graph TD — top-10 most connected nodes at that time]

timeline <node_id>

Show attribute and relationship changes for a node across its full history.

from semantica.context import ContextGraph

graph = ContextGraph()

# Use state_at() at multiple time points to reconstruct history
# Check add_node timestamps and edge addition times from graph data
node_data = graph.find_node(node_id)

Output as Markdown timeline:

Timeline for "<node_id>" (<type>):

  <timestamp>  CREATED
    Properties: {confidence: 0.71, category: "loan_approval"}
    Source: extraction/pipeline

  <timestamp>  UPDATED
    confidence: 0.71 → 0.91  [source: review]

  <timestamp>  RELATIONSHIP ADDED
    "<node_id>" →[CAUSED]→ "Decision_B"

  <timestamp>  RELATIONSHIP REMOVED
    "<node_id>" →[PRECEDED_BY]→ "Decision_X"  (superseded)

Total lifespan: <duration>
Current state:  <active|superseded>

causal-at <decision_id> <date> [--direction upstream|downstream]

Trace a causal chain as it existed at a specific point in time.

from semantica.context.causal_analyzer import CausalChainAnalyzer
from semantica.context import AgentContext

ctx = AgentContext(decision_tracking=True)
analyzer = CausalChainAnalyzer(graph_store=ctx.graph_store)

historical_chain = analyzer.trace_at_time(
    event_id=decision_id,
    at_time=date,           # ISO string or datetime
    direction=direction or "upstream",
    max_depth=10,
)

Output:

Historical causal chain for <decision_id> at <date>:
  Direction: upstream (what caused it?)

  [Mermaid graph TD showing chain as it existed at <date>]

  Decisions present then but not now: [list]
  Decisions added since then: [list]

precedents-at "<scenario>" <date> [--category <cat>]

Find precedent decisions that existed as of a specific date — useful for auditing what context was available when a decision was made.

from semantica.context import AgentContext

ctx = AgentContext(decision_tracking=True, advanced_analytics=True)

# find_precedents supports as_of parameter for temporal precedent search
precedents = ctx.find_precedents(
    scenario=scenario,
    category=category or None,
    limit=10,
    use_hybrid_search=True,
    include_context=True,
    include_superseded=False,
    as_of=date,  # Only return precedents that existed at this date
)

Return: | Rank | Decision ID | Scenario | Outcome | Confidence | Set Date | Valid Until |

Note decisions that were superseded before or after the target date.

常见问题

它能理解“上个月”这样的说法吗?

能。它会把日常的日期表达转换为标准日期。

尚未存在的条目如何显示?

它们会被标记为尚未创建。

它能重建过去某个日期的图谱吗?

能。它可以重建所选日期的完整图谱状态。

详情

作者的原始描述

Temporal graph operations on Semantica — scoped queries at a point in time, graph snapshots, node change timelines, temporal causal analysis, and graph state reconstruction. Uses AgentContext.find_precedents(as_of=), ContextGraph.state_at(), CausalChainAnalyzer.trace_at_time(), and TemporalQueryRewriter. Sub-commands: query, snapshot, timeline, causal-at, precedents-at.

repo: semantica-agi/semantica

热度

GitHub 星标
14k
排名
#11156
许可证
MIT
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能